ontocast.onto.ontology_apply¶
Apply ontology update deltas onto catalog ontologies by namespace ownership.
U → O*: complement inserts and catalog deletes are partitioned by
subject/predicate namespace onto writable catalog IRIs, then applied
(delete-then-insert) onto each ontology's freshest terminal — or an explicit
in-run base override.
OntologyDelta
¶
Bases: BasePydanticModel
Net ontology change relative to a prompt snapshot.
inserts holds complement triples (U \ S); deletes holds
snapshot triples removed by GraphUpdate delete operations, destined for
propagation onto catalog terminals.
Source code in ontocast/onto/ontology_apply.py
apply_partitioned_updates(partitioned_inserts, *, ontology_manager, normalize_units_fn, tools, partitioned_deletes=None, base_overrides=None)
¶
Apply each per-IRI delta (delete-then-insert) onto its catalog base.
The base is the freshest catalog terminal for the IRI unless
base_overrides supplies an in-run artifact (e.g. the map-stage output a
consolidation delta must build on). normalize_units_fn is typically
:func:ontocast.agent.normalize_ontology.normalize_ontology_units.
Returns (artifacts, metrics, applied_updates) where applied_updates
are the GraphUpdates actually executed, for version-bump analysis.
Source code in ontocast/onto/ontology_apply.py
build_namespace_owner_map(ontology_manager, writable_iris, base_overrides=None)
¶
Map namespace stem → catalog ontology IRI for writable sources.
base_overrides supplies in-run artifacts (not yet registered with the
manager) whose namespaces must resolve, keyed by ontology IRI.
Source code in ontocast/onto/ontology_apply.py
complement_inserts(inserts, snapshot_graph)
¶
Return insert triples not already present in the prompt snapshot.
Source code in ontocast/onto/ontology_apply.py
partition_triples_by_namespace(triples, *, writable_iris, ontology_manager, base_overrides=None)
¶
Partition delta triples onto writable catalog IRIs by namespace ownership.
Works for both insert and delete deltas. Ownership prefers the subject URI
namespace, then the predicate namespace.
Returns (iri → graph, unattributed_triple_count).