ontocast.stategraph.helpers¶
all_unit_patch_source_iris(state)
¶
Sorted unique ontology IRIs appearing in any unit's patch source list.
Source code in ontocast/stategraph/helpers.py
build_document_excerpt(state)
¶
Create a representative excerpt from sampled source units.
Source code in ontocast/stategraph/helpers.py
enforce_redeclared_deletes(delta)
¶
Drop merged deletes whose subject the merged inserts do not redeclare.
Applied only under vector-retrieval context: each unit judged its deletes
on a retrieved subset, so a delete is trusted only as part of a
redeclaration — the corrected statement must reappear in the inserts. A
bare delete of catalog content, judged on partial evidence, would
propagate onto shared catalog terminals cross-document. A safety invariant
like the insert-wins veto in :func:merge_unit_deltas, not a knob; the
per-unit foreign_delete finding teaches the loop, this backstops the
write.
Returns:
| Type | Description |
|---|---|
int
|
Number of delete triples dropped. |
Source code in ontocast/stategraph/helpers.py
merge_unit_deltas(deltas)
¶
Union per-unit deltas into one document-level delta.
Delete consensus across parallel units is conservative: a triple inserted by any unit wins over another unit's delete of the same triple, so the merged delta stays monotone-safe under parallel map/reduce.
Source code in ontocast/stategraph/helpers.py
reconcile_fresh_ontologies(fresh_ontologies)
¶
Reconcile the fresh-create fan-out's N independent ontologies.
Units on the fresh path each return a whole ontology. Same-IRI artifacts are union-merged (the reduce used to keep whichever indexed last, silently dropping the others' content); across different fresh IRIs, minted duplicates are detected pairwise so the overlap is at least visible — no LLM harmonization is attempted.
Returns:
| Type | Description |
|---|---|
list[Ontology]
|
The reconciled artifact list and the metrics to record |
dict[str, int]
|
( |
tuple[list[Ontology], dict[str, int]]
|
present only when non-zero). |