Source code for oaklib.interfaces.search_interface

from abc import ABC
from typing import Iterable, List, Optional

from oaklib.datamodels.search import SearchConfiguration
from oaklib.interfaces.basic_ontology_interface import BasicOntologyInterface
from oaklib.types import CURIE

__all__ = ["SearchConfiguration", "SearchInterface"]


[docs] class SearchInterface(BasicOntologyInterface, ABC): """ An Ontology Interface that supports text-based search. The search interface provides a largely implementation-neutral way to query an ontology. It allows for - exact or partial matches - matching the beginning of a term - regular expression search It also allows you to control which metadata elements are searched over (typically labels and aliases) Implementations may differ in their behavior. Some implementations may not be able to honor specific requests. For example, the :ref:`SqlDatabaseImplementation` implementation may not be able to fulfil regular expression queries. Some endpoints may return results that are ranked by relevance, others may be arbitrary Command Line ------------ A good way to explore this interface is via the search subcommand: Ubergraph uses relevancy ranking: .. code:: runoak -i ubergraph:uberon search limb Exact match for a label using sqlite: .. code:: runoak -i db/cl.db search l=neuron Inexact match for a label or synonym using sqlite: .. code:: poetry run runoak -i db/cl.db search .~neuron Datamodels ---------- Search uses `<https://w3id.org/oak/search>`_ to specify both an input query and search results, see :ref:`datamodels` """