ontocast.onto.iri_policy¶
as_sparql_iriref(value)
¶
Render an IRI for a SPARQL IRIREF slot, or None if it cannot be one.
Callers should log-and-skip on None rather than raising: a single
malformed IRI must not fail a whole query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
IRI text, optionally wrapped in Turtle-style angle brackets. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
str | None: |
str | None
|
is empty or contains a codepoint |
Source code in ontocast/onto/iri_policy.py
canonicalize_namespace_iri(namespace)
¶
normalize_namespace_iri(namespace, *, context='auto')
¶
Return a namespace IRI with a deterministic terminal delimiter.
Existing trailing # or / are preserved. When absent, we append #
for ontology contexts and / for facts/default contexts. Known namespace
aliases (e.g. http://schema.org/) are mapped to their canonical form.
Source code in ontocast/onto/iri_policy.py
strip_iri_brackets(value)
¶
Strip optional Turtle-style <...> wrappers from an IRI string.