Annotators

Importers take an existing schema and annotate it with information

Annotators typically talk to an external ontology. We use the OAK library to wrap a large number of different sources that can be used for annotation, including:

  • BioPortal

  • OLS/ZOOMA

  • Arbitrary ontologies in obo format, OWL, RDF, or JSON

  • Ubergraph

  • Wikidata

  • LOV

For documentation on selecting the right ontology source, see:

Selectors

class schema_automator.annotators.SchemaAnnotator(ontology_implementation: oaklib.interfaces.basic_ontology_interface.BasicOntologyInterface, mine_descriptions: bool = False, allow_partial: bool = False, curie_only: bool = True, assign_element_uris: bool = False, assign_enum_meanings: bool = False)[source]

An engine for enhancing schemas by performing lookup and annotation operations using an ontology service.

A SchemaAnnotator wraps an OAK ontology interface. See OAK documentation for more details

annotate_element(elt: Union[linkml_runtime.linkml_model.meta.PermissibleValue, linkml_runtime.linkml_model.meta.Element]) None[source]

Annotates an element or a permissible value

Parameters

elt

Returns

annotate_schema(schema: Union[linkml_runtime.linkml_model.meta.SchemaDefinition, str]) linkml_runtime.linkml_model.meta.SchemaDefinition[source]

Annotate all elements of a schema, adding mappings.

This requires that the OntologyInterface implements either BasicOntologyInterface or SearchInterface

enrich(schema: Union[linkml_runtime.linkml_model.meta.SchemaDefinition, str]) linkml_runtime.linkml_model.meta.SchemaDefinition[source]

Enrich a schema by performing lookups on the external ontology/vocabulary endpoint, and copying over metadata

Currently, the only metadata obtained is text definitions


>>> from schema_automator.annotators.schema_annotator import SchemaAnnotator
>>> from oaklib.selector import get_implementation_from_shorthand
>>> oi = get_implementation_from_shorthand("sqlite:obo:so")
>>> sa = SchemaAnnotator(ontology_implementation=oi)
>>> schema = sa.enrich("tests/data/schema.yaml")
Parameters

schema

Returns

class schema_automator.annotators.JsonLdAnnotator[source]

Annotates a schema using URIs/Prefixes derived from a JSON-LD file

annotate(schema: Union[str, linkml_runtime.linkml_model.meta.SchemaDefinition], jsonld_path: str) linkml_runtime.linkml_model.meta.SchemaDefinition[source]

Annotate a schema

Parameters
  • schema – schema object (mutated) or path to schema

  • jsonld_path – path to input JSONLD context file

Returns