ontocast.agent.repair_facts_domain¶
Facts domain-repair agent.
Runs after the facts render/critic loop, only on a unit with a mandatory
domain_violation finding: a statement whose property declares an
rdfs:domain its subject's asserted types contradict. One LLM call per unit
is shown those statements under citable ids and may replace each one's
property; :func:property_swaps keeps only patches that do exactly that and
leave the subject fitting the new property's domain. The unit loop
(ontocast.stategraph.atomic) applies them through the same per-fix
regression check as a critic fix, and drops what is still in violation.
Attributes¶
logger = logging.getLogger(__name__)
module-attribute
¶
Classes¶
Functions:¶
property_swaps(patches, index, graph, ontology_graph)
¶
The patches that only replace the property of the statements they cite.
Each cited statement s p o is replaced by s p' o with p' a
different property whose declared domain s's types do not contradict,
and nothing else is written. A patch doing anything more is refused: the
call is shown only the cited statements, so it may change nothing else.
Source code in ontocast/agent/repair_facts_domain.py
repair_domain_violations(state, atomic, findings)
async
¶
Ask for a fitting property for each statement in domain violation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
UnitFactsState
|
The unit's current facts state. Read-only here. |
required |
atomic
|
AtomicToolBox
|
Toolbox for the LLM call. |
required |
findings
|
Sequence[FactsUnitFinding]
|
The unit's findings; only mandatory |
required |
Returns:
| Type | Description |
|---|---|
list[TripleFix]
|
|
TripleIndex
|
Any other action is dropped. |
Source code in ontocast/agent/repair_facts_domain.py
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 | |
violating_statements(graph, findings)
¶
The statements of the (subject, property) pairs mandatory domain violations name.
Source code in ontocast/agent/repair_facts_domain.py
violations_index(graph, statements)
¶
Ids over exactly statements, listed with their ends' types and labels.