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.
Attributes¶
logger = logging.getLogger(__name__)
module-attribute
¶
Classes¶
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
Functions:¶
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
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | |
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).