ontocast.tool.ontology_validation.reconcile¶
Reduce-time reconciliation of minted terms against the whole catalog.
The per-unit lane sees a snapshot; under vector-retrieval context that is a
retrieved subset, so a unit that re-mints a concept the catalog already
defines is -- from inside the unit -- inventing a new term. The reduce step
checks the merged document delta against every catalog ontology, through the
manager's :class:~ontocast.tool.ontology_validation.shape.CatalogSurfaceIndex.
A minted term matches a catalog term when one of its labels, preferred labels
or notations equals a catalog one case-insensitively, or else when its local
name does (httpHeaderProperty and HTTPHeaderProperty). The match must
resolve to exactly one catalog IRI -- an ambiguous name is refused -- and
the roles must be compatible: a minted property never reconciles onto a
catalog class, nor the reverse.
Attributes¶
logger = logging.getLogger(__name__)
module-attribute
¶
Classes¶
MintedDuplicate
¶
Bases: BaseModel
One minted term that names an existing catalog term.
Source code in ontocast/tool/ontology_validation/reconcile.py
Functions:¶
apply_minted_duplicate_rewrites(merged_inserts, duplicates)
¶
Rewrite minted IRIs to their catalog IRIs, in place.
Substitutes in subject and object position — a second minted term referencing the duplicate must end up pointing at the catalog term, or the rewrite would strand it. Predicate position is included for completeness (a minted property duplicate used as a predicate elsewhere in the delta).
Returns:
| Type | Description |
|---|---|
int
|
Number of triples rewritten. |
Source code in ontocast/tool/ontology_validation/reconcile.py
detect_minted_duplicates(merged_inserts, catalog_index)
¶
Find minted terms that name an existing catalog term.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
merged_inserts
|
RDFGraph
|
Document-level merged insert delta. |
required |
catalog_index
|
CatalogSurfaceIndex
|
Names of every catalog term. |
required |
Returns:
| Type | Description |
|---|---|
list[MintedDuplicate]
|
One record per minted term with a unique, role-compatible match, |
list[MintedDuplicate]
|
ordered by minted IRI. Detection only — the caller decides whether to |
list[MintedDuplicate]
|
rewrite. |
Source code in ontocast/tool/ontology_validation/reconcile.py
match_catalog_term(subject, inserts, catalog_index, role)
¶
The catalog term a minted subject names, if exactly one does.
Labels are tried before the local name; the role must be compatible. A subject the catalog already holds is not minted and never matches.
Source code in ontocast/tool/ontology_validation/reconcile.py
minted_roles(inserts)
¶
Role of each minted subject, from the delta's own declarations.
Source code in ontocast/tool/ontology_validation/reconcile.py
surfaces_of(subject, graph)
¶
The labels, preferred labels and notations graph gives subject.