ontocast.tool.facts_validation.terms¶
Catalog term inventory, namespace closure rules, and alias candidates.
What the catalog declares versus merely references decides which
namespaces the term checks may treat as closed; ValidationPolicy carries
the deployment-level exemptions every check honours.
ValidationPolicy
¶
Bases: BaseModel
Deployment-level exemptions and vocabulary for deterministic validation.
One object instead of a parameter per concern: the namespaces a deployment shares across catalogs, the sanctioned quantity fallback vocabulary, and the code predicates — everything the term checks must never flag, because configuration explicitly blessed it.
Source code in ontocast/tool/facts_validation/terms.py
build_surface_index(ontology_graph, code_predicates=())
¶
Map exact catalog surface forms to the IRIs declaring them.
Case-sensitive and exact: these are codes and names a model may have
transcribed verbatim ("d", "meV", "CsPbBr3"), not free text to
be fuzzy-matched. A form claimed by more than one IRI stays in the index and
is rejected at lookup time — an ambiguous code is not a repairable one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ontology_graph
|
RDFGraph | None
|
Merged ontology context to index. |
required |
code_predicates
|
Sequence[str]
|
Extra code-bearing predicates (UCUM codes, symbols, notations) on top of the standard name predicates. |
()
|
Returns:
| Type | Description |
|---|---|
dict[str, set[str]]
|
Surface form -> set of IRIs declaring it. |
Source code in ontocast/tool/facts_validation/terms.py
collect_catalog_terms(ontology_graph)
¶
All IRIs appearing anywhere in the ontology context.
Source code in ontocast/tool/facts_validation/terms.py
collect_declared_namespaces(ontology_graph)
¶
Namespaces the catalog declares terms in (subject-position IRIs).
The UNKNOWN_TERM check treats a namespace as closed — flagging members the
catalog does not list — only when the catalog actually declares terms
there. A namespace the catalog merely references (qudt:QuantityValue
in an rdfs:subClassOf, qudt:unit in an owl:onProperty) is an
external vocabulary the catalog borrows from, and the catalog is not an
authority on its membership. Treating referenced-only namespaces as closed
produced mandatory findings against canonical external properties
(qudt:numericValue), which repair renders then obeyed by deleting
correct data.
Source code in ontocast/tool/facts_validation/terms.py
expand_vocabulary_terms(vocabulary, *graphs)
¶
Expand configured vocabulary terms (CURIEs or full IRIs) to IRI strings.
CURIEs are expanded against the prefix bindings of every graph given, in order; a CURIE whose prefix no graph binds is dropped rather than guessed.
Source code in ontocast/tool/facts_validation/terms.py
resolve_unique_surface(index, text)
¶
The single IRI declaring text as a surface form, if exactly one does.