ontocast.onto.ontology_namespace¶
The namespace an ontology defines its terms in.
An ontology's IRI does not say where its terms live: OM-2 is
…/om-2 with terms under …/om-2/, PROV-O is …/prov-o with terms
under …/prov#. The namespace is read from the graph instead: the one the
header declares (vann:preferredNamespaceUri) when terms live there, else
the one in which the graph describes the most terms.
Attributes¶
__all__ = ['described_namespaces', 'ontology_namespace']
module-attribute
¶
Functions:¶
described_namespaces(graph, *, exclude=None)
¶
The namespaces in which graph describes the most terms (ties kept).
A term is described when it is the subject of a triple. Terms an ontology only reuses (a standard vocabulary's annotation properties, a borrowed superclass) are described less often than its own, so they lose.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
Graph
|
An ontology graph. |
required |
exclude
|
URIRef | None
|
A subject not counted, typically the ontology header. |
None
|
Source code in ontocast/onto/ontology_namespace.py
ontology_namespace(graph, iri)
¶
The namespace the ontology iri defines its terms in.
In order: the header's vann:preferredNamespaceUri when graph
describes a term under it; else :func:described_namespaces, a tie going
to the namespace under the ontology IRI, then to the lexically first; else
<iri>#, the namespace OntoCast mints terms under.