ontocast.onto.util¶
Attributes¶
CONVENTIONAL_MAPPINGS = get_rdflib_namespace_mappings()
module-attribute
¶
RDFLIB_DEFAULT_NAMESPACE_URIS = frozenset(CONVENTIONAL_MAPPINGS)
module-attribute
¶
Functions:¶
derive_ontology_id(iri)
¶
Derive a short ontology handle from an absolute IRI.
Prefers rdflib conventional namespace prefixes (SKOS → skos). Falls back
to the last non-opaque path segment. Returns None instead of inventing
garbage ids (e.g. FOAF 0.1 → would-be 01).
Source code in ontocast/onto/util.py
get_rdflib_namespace_mappings()
¶
is_rdflib_default_namespace(namespace)
¶
non_domain_namespaces()
¶
Namespaces that are never a document's domain vocabulary.
Every rdflib built-in binding (brick, csvw, xml, …), every
namespace in COMMON_PREFIXES, both schema.org spellings, and the facts
namespace itself. Two callers ask the same question of this set and used to
each build their own copy: the delta partitioner, which must not treat a
standard namespace as writable, and the prompt's "domain ontologies" clause,
which must not list one. They diverge only in shape -- the partitioner
compares normalized stems -- so the shape conversion lives with each caller
and the membership is defined once, here.
This is deliberately not the facts-vocabulary standard set
(tool/facts_validation/terms.py), which answers a different question --
which terms a render may use without being flagged unknown -- and is
operator-extensible through FACTS_ADDITIONAL_STANDARD_NAMESPACES.
Nor is it the aggregator's type-comparison set, which is narrower again.
Source code in ontocast/onto/util.py
normalize_ontology_iri(iri)
¶
Normalize an ontology IRI for catalog lookup and alias resolution.
Strips angle brackets and trailing / or # so that
http://example.org/ont, …/ont/, and …/ont# compare equal as
lookup keys. Author namespace delimiters for prefix bindings remain the
responsibility of :func:normalize_namespace_iri.