Aggregator Adapter

Documentation

class oaklib.implementations.aggregator.aggregator_implementation.AggregatorImplementation(resource: ~oaklib.resource.OntologyResource | None = None, strict: bool = False, _multilingual: bool | None = None, autosave: bool = <factory>, exclude_owl_top_and_bottom: bool = <factory>, ontology_metamodel_mapper: ~oaklib.mappers.ontology_metadata_mapper.OntologyMetadataMapper | None = None, _converter: ~curies.api.Converter | None = None, auto_relax_axioms: bool | None = None, cache_lookups: bool = False, property_cache: ~oaklib.utilities.keyval_cache.KeyValCache = <factory>, _edge_index: ~oaklib.indexes.edge_index.EdgeIndex | None = None, _entailed_edge_index: ~oaklib.indexes.edge_index.EdgeIndex | None = None, _prefix_map: ~typing.Mapping[str, str] | None = None, _association_index: ~oaklib.utilities.associations.association_index.AssociationIndex | None = None, normalizers: ~typing.List[~oaklib.interfaces.association_provider_interface.EntityNormalizer] = <factory>, implementations: ~typing.List[~oaklib.interfaces.basic_ontology_interface.BasicOntologyInterface] | None = None)[source]

An OAK adapter that wraps multiple implementations and integrates results together.

This allows for multiple implementations to be wrapped, with calls to the aggregator farming out queries to multiple implementations, and weaving the results together.

>>> from oaklib import get_adapter
>>> from oaklib.implementations import AggregatorImplementation
>>> from oaklib.datamodels.search import SearchConfiguration, SearchTermSyntax
>>> hp = get_adapter("sqlite:obo:hp")
>>> mp = get_adapter("sqlite:obo:mp")
>>> cfg = SearchConfiguration(syntax=SearchTermSyntax.REGULAR_EXPRESSION)
>>> agg = AggregatorImplementation(implementations=[hp, mp])
>>> for entity in sorted(agg.basic_search("parathyroid", config=cfg)):
...     print(entity, agg.label(entity))

...
HP:0000860 Parathyroid hypoplasia
...
MP:0000680 absent parathyroid glands
...

Command Line Usage

Use the --add (-a) option before the main command to add additional implementations.

E.g

runoak -i db/mp.db -a db/hp.db COMMAND [COMMAND OPTIONS]