ontocast.onto.unit_states¶
Dedicated state models for parallel unit loops.
UnitFactsState
¶
Bases: UnitState
Independent per-unit state for facts extraction and critique.
Source code in ontocast/onto/unit_states.py
update_facts()
¶
Apply facts_updates to content_unit.graph and clear the list.
Source code in ontocast/onto/unit_states.py
UnitOntologyState
¶
Bases: UnitState
Independent per-unit state for ontology improvement loop.
Source code in ontocast/onto/unit_states.py
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 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | |
all_updates
property
¶
All ontology updates produced by this unit (applied and pending).
build_delta()
¶
Net insert/delete delta of this unit against its prompt snapshot.
All GraphUpdates (applied and pending) are replayed in order onto a copy of the snapshot, then diffed against it. This honors operation order -- a triple deleted and later re-inserted nets out -- and yields:
inserts: true complements (U \ S), never restated context triples;deletes: snapshot triples removed by delete operations, to be propagated onto catalog terminals during reduce.
Fresh path (no GraphUpdates, empty seed): full working graph as inserts. Costs a snapshot copy per call, which is why the snapshot is otherwise shared by reference -- callers on the per-unit hot path budget-time it.
Source code in ontocast/onto/unit_states.py
model_post_init(__context)
¶
Initialize mutable working graph from immutable snapshot.
Source code in ontocast/onto/unit_states.py
update_ontology()
¶
Apply ontology_updates to working_graph and clear the list.
Returns:
| Type | Description |
|---|---|
bool
|
True when the updates were applied. False means the |
bool
|
|
bool
|
graph is unchanged -- the caller must not report that as a |
bool
|
successful render without saying so, because a validator run |
bool
|
afterwards would inspect the pre-update graph and find it clean. |
Source code in ontocast/onto/unit_states.py
working_graph_changed()
¶
True when the scratchpad graph differs from the seed snapshot.
Plain set comparison is sound here: the working graph starts as an in-process copy of the snapshot graph (blank-node identity preserved, no serialization round-trip), so canonicalization-grade hashing adds cost without adding correctness.
Source code in ontocast/onto/unit_states.py
UnitState
¶
Bases: BasePydanticModel
Common per-unit workflow state.
content_unit is typed to the :class:SourceUnit base here and narrowed
to :class:ContentUnit by :class:UnitFactsState, which needs the mutable
graph. Declaring it once keeps the progress string and the context-assembly
fields below from being written twice.
Source code in ontocast/onto/unit_states.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
clear_failure()
¶
get_content_unit_progress_string()
¶
get_external_evidence_cache_entry(node)
¶
Return node-scoped evidence cache entry.
get_external_evidence_request(node)
¶
Return node-scoped search request, defaulting to disabled.
load_external_evidence_for_node(node)
¶
Load node-scoped evidence cache into active prompt fields.
Source code in ontocast/onto/unit_states.py
set_external_evidence_cache_entry(node, entry)
¶
Persist node-scoped evidence plan/fetch result cache.