ontocast.tool.ontology_validation.reconcile¶
Reduce-time reconciliation of minted terms against full catalog terminals.
The per-unit lane cannot do this job: under vector-retrieval context the
snapshot is a retrieved subset, so a unit that re-mints a concept the catalog
already defines is — from inside the unit — inventing a genuinely new term.
The duplicate lives precisely in the part of the catalog the snapshot does not
contain, which is why _label_collision_findings (indexed on the snapshot)
is structurally blind to it. The reduce step is the first place the full
terminals are in hand — they are already fetched there for the namespace owner
map — so that is where minted terms are checked.
Matching is deliberately the strictest rule that exists in this codebase:
exact surface form (build_surface_index — case-sensitive labels,
prefLabels, notations), resolving to exactly one catalog IRI
(resolve_unique_surface refuses ambiguous surfaces), with a compatible
role (a minted property never reconciles onto a catalog class or vice versa).
Everything looser is a judgment call and stays out of the deterministic lane.
MintedDuplicate
¶
Bases: BaseModel
One minted term that exactly matches an existing catalog term.
Source code in ontocast/tool/ontology_validation/reconcile.py
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, terminal_graphs)
¶
Find minted terms whose surface form the full catalog already declares.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
merged_inserts
|
RDFGraph
|
Document-level merged insert delta. |
required |
terminal_graphs
|
dict[str, RDFGraph]
|
Writable IRI -> the freshest full terminal graph (the same graphs the apply step writes onto). |
required |
Returns:
| Type | Description |
|---|---|
list[MintedDuplicate]
|
One record per (minted term, catalog term) unique-surface match with a |
list[MintedDuplicate]
|
compatible role, ordered by minted IRI. Detection only — the caller |
list[MintedDuplicate]
|
decides whether to rewrite. |