ontocast.tool.facts_validation.mandate¶
What one gap pass is asked for, and the only thing it may add.
The gap pass (an insert-only model call after the critic loop) is called for
four kinds of gap: statements missing a role their class requires, results
held by a node that is not a statement, instances linked to nothing, and
measurements the text states that the graph lacks (listed only when
measurement recovery is on). :class:GapMandate holds the
gaps of one call. The prompt's chapters are rendered from it, and
:meth:GapMandate.admits refuses any proposed fix that adds something the
request did not list, so the request and the filter cannot disagree.
Admitted: a role link on a listed statement, a link with a listed detached instance at one end, a value whose every number the measurement list or a misplaced result holds (with its components and the link to it), a statement's result link to a misplaced named value, and the type and label of a node an admitted triple introduces, with the role links of a statement it introduces. A misplaced result is restated, never moved: the pass inserts only, and the exit removes the misplaced link.
Attributes¶
DETACHED_TRIGGER_MIN = 2
module-attribute
¶
RefusalReason = TypingLiteral['value_not_listed', 'outside_mandate']
module-attribute
¶
Why a fix is refused: it adds a number the measurement list does not hold, or any other statement the request did not ask for.
Triple = tuple[Node, Node, Node]
module-attribute
¶
__all__ = ['DETACHED_TRIGGER_MIN', 'GapMandate', 'RefusalReason']
module-attribute
¶
Classes¶
GapMandate
¶
Bases: BaseModel
The gaps one gap-pass call is asked to close.
Build with :meth:of; the unit graph is read again by :meth:admits.
Attributes:
| Name | Type | Description |
|---|---|---|
role_gaps |
tuple[FactsUnitFinding, ...]
|
The unit's |
misplaced |
tuple[FactsUnitFinding, ...]
|
The unit's |
detached |
tuple[URIRef, ...]
|
Instances linked to nothing that no role gap names. |
inventory |
NumericInventory
|
The missing measurements; empty when recovery is off. |
contract |
StatementContract
|
The catalog's statement contract. |
fact_namespaces |
tuple[str, ...]
|
Namespaces holding minted instances. |
Source code in ontocast/tool/facts_validation/mandate.py
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 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 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 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 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | |
Attributes¶
calls
property
¶
Whether the gaps pay for a call.
A measurement, a role gap or a misplaced result does; detached
instances do from :data:DETACHED_TRIGGER_MIN on.
contract = StatementContract()
class-attribute
instance-attribute
¶
detached = ()
class-attribute
instance-attribute
¶
fact_namespaces = ()
class-attribute
instance-attribute
¶
inventory = NumericInventory()
class-attribute
instance-attribute
¶
misplaced = ()
class-attribute
instance-attribute
¶
model_config = ConfigDict(frozen=True, arbitrary_types_allowed=True)
class-attribute
instance-attribute
¶
role_gaps = ()
class-attribute
instance-attribute
¶
Methods:¶
admit(fixes, graph)
¶
The fixes :meth:admits, and the refused ones counted by reason.
Judged together, in order: a node an admitted fix introduces counts as introduced for the fixes after it, so a link and the type and label of its new end may come as two fixes.
Source code in ontocast/tool/facts_validation/mandate.py
admits(fix, graph, introduced=frozenset())
¶
Why fix is refused, or None when every triple it adds is asked for.
A payload that does not parse is not judged here:
:func:~ontocast.tool.facts_validation.critic_patch.compile_critic_fixes
refuses it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fix
|
TripleFix
|
A proposed insert. |
required |
graph
|
Graph
|
The unit graph before the pass. |
required |
introduced
|
Collection[Node]
|
Nodes that fixes already admitted in this pass introduce; their type and label are admitted here too. |
frozenset()
|
Source code in ontocast/tool/facts_validation/mandate.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 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 | |
misplaced_values(graph)
¶
(holder, link, value) of each misplaced result still in graph.
Source code in ontocast/tool/facts_validation/mandate.py
of(findings, isolated, inventory, contract, fact_namespaces)
classmethod
¶
The mandate for the unit's current findings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
findings
|
Sequence[FactsUnitFinding]
|
The unit's findings; |
required |
isolated
|
Sequence[URIRef]
|
The unit's instances linked to nothing; those a role gap names are left out. |
required |
inventory
|
NumericInventory
|
The missing measurements, empty when recovery is off. |
required |
contract
|
StatementContract
|
The catalog's statement contract. |
required |
fact_namespaces
|
Sequence[str]
|
Namespaces holding minted instances. |
required |