Ontology Implementation Selectors
In the command line interface and in Python code, descriptors can be used as a shorthand way to refer to either a local or remote ontology, plus a method for parsing/querying it. The OntologyResource that is returned can be used to instantiate an implementation. The descriptors can also be used in the cli
Note
Ontologies are available in a sometimes bewildering range of formats. One thing that constantly trips people up is the distinction between ontology language and serialization. OWL is an ontology language, not a syntax. OWL has its own syntaxes such as Manchester, OWL-XML and Functional – additionally it can be mapped to RDF, which is its own datamodel/language, with its own serializations (Turtle, RDF/XML (NOT the same as OWL-XML), JSON-LD, …). Confusing, huh? We are doing our best in this library to simplify things for you the user, please be patient!
Syntax
A descriptor is EITHER:
prefixed with a scheme OR
is a *path (in which case the scheme is inferred)
Examples
Examples of scheme-less descriptors, implicit implementation:
tests/input/go-nucleus.obo
- local obo format file loaded with prontotests/input/go-nucleus.json
- local obojson format file loaded with prontotests/input/go-nucleus.owl
- local OWL rdf/xml format file (loaded with rdflib at the moment, may change)tests/input/go-nucleus.owl.ttl
- local OWL turtle format file (loaded with rdflib at the moment, may change)tests/input/go-nucleus.db
- local sqlite3 db loaded with SqlImplementationhttp://purl.obolibrary.org/obo/pato.obo
- NOT IMPLEMENTED; download locally for nowhttp://purl.obolibrary.org/obo/pato.owl
- NOT IMPLEMENTED; download locally for now
Examples of explicit schemes:
sparql:tests/input/go-nucleus.owl.ttl
- local OWL file in turtle serializationsparql:tests/input/go-nucleus.owl
- local OWL file (RDF/XML assumed unless explicit format option passed)pronto:tests/input/go-nucleus.obo
- local obo format file loaded with prontopronto:tests/input/go-nucleus.json
- local obojson format file loaded with prontopronto:tests/input/go-nucleus.owl
- local OWL rdf/xml format file (loaded with pronto at the moment may change)pronto:tests/input/go-nucleus.db
- local sqlite3 db loaded with SqlImplementationprontolib:pato.obo
- remote obo format file loaded from OBO Library with prontoprontolib:pato.owl
- remote owl format file loaded from OBO Library with prontosqlite:tests/input/go-nucleus.owl
- convert OWL to SQLite and query using sql_implementationbioportal:
all of bioportalbioportal:pato
pato in bioportal (NOT IMPLEMENTED)ontobee:
all of ontobeeontobee:pato
pato in ontobee (NOT IMPLEMENTED)ols:
all of OLSols:pato
pato in OLS (NOT IMPLEMENTED)ubergraph:
all of OLSubergraph:pato
pato in ubergraph (NOT IMPLEMENTED)
See cli for more examples
Schemes
pronto
Implementation: ProntoImplementation
The slug is a path to a file on disk. Must be in obo or owl or json
prontolib
Implementation: ProntoImplementation
The slug is the name of the resource on obo, e.g. pato.obo, cl.owl
sqlite
Implementation: SqlImplementation
The slug is the path to the sqlite .db file on local disk
obosqlite
Implementation: SqlImplementation
The slug is the name of the ontology, e.g ‘hp’, ‘uberon’
TODO: download from s3
ontobee
Implementation: OntobeeImplementation
Currently the slug is ignored
ols
Implementation: OlsImplementation
Currently the slug is ignored
bioportal
Implementation: BioportalImplementation
Currently the slug is ignored
funowl
Implementation: OwlImplementation
NOT IMPLEMENTED YET
owlery
Implementation: OwleryImplementation
NOT IMPLEMENTED YET
Functions
- oaklib.selector.get_implementation_from_shorthand(descriptor: str, format: Optional[str] = None) oaklib.interfaces.basic_ontology_interface.BasicOntologyInterface [source]
See get_resource_from_shorthand
Example:
>>> oi = get_implementation_from_shorthand('my-ont.owl') >>> for term in oi.all_entities(): >>> ...
- Parameters
descriptor –
format –
- Returns
- oaklib.selector.get_resource_from_shorthand(descriptor: str, format: Optional[str] = None, import_depth: Optional[int] = None) oaklib.resource.OntologyResource [source]
Maps from a shorthand descriptor to an OntologyResource.
- Parameters
descriptor –
format – file format/syntax, e.g obo, turtle
import_depth – maximum import depth to traverse
- Returns