ontocast.onto.model¶
Attributes¶
Classes¶
BasePydanticModel
¶
Bases: BaseModel
Shared base for the pipeline's Pydantic models.
Carries no behaviour of its own since the JSON save/load helpers were removed with their only consumer; it is kept as the common ancestor the state and report models already declare.
Source code in ontocast/onto/model.py
ExternalEvidenceCacheEntry
¶
Bases: BaseModel
Node-scoped external evidence planning/fetch outputs.
Source code in ontocast/onto/model.py
Attributes¶
domains = Field(default_factory=list)
class-attribute
instance-attribute
¶
hits = Field(default_factory=list)
class-attribute
instance-attribute
¶
plan = Field(default_factory=ExternalEvidencePlan)
class-attribute
instance-attribute
¶
source_count = Field(default=0, ge=0)
class-attribute
instance-attribute
¶
text = Field(default='')
class-attribute
instance-attribute
¶
ExternalEvidenceHit
¶
Bases: BaseModel
Normalized external evidence hit metadata.
Source code in ontocast/onto/model.py
ExternalEvidencePlan
¶
Bases: BaseModel
Structured plan for optional external evidence retrieval.
Source code in ontocast/onto/model.py
Attributes¶
confidence = Field(default=0.0, ge=0.0, le=1.0, description='Confidence in the decision.')
class-attribute
instance-attribute
¶
intent = Field(default='none', description='Primary reason for searching external evidence.')
class-attribute
instance-attribute
¶
queries = Field(default_factory=list, description='Targeted search queries.')
class-attribute
instance-attribute
¶
rationale = Field(default='', description='Short explanation of why search is or is not needed.')
class-attribute
instance-attribute
¶
should_search = Field(default=False, description='Whether external evidence retrieval should run for this node.')
class-attribute
instance-attribute
¶
Methods:¶
coerce_rationale(v)
classmethod
¶
Mirror the coercion on ExternalEvidenceRequest.rationale.
normalize_queries(value)
classmethod
¶
Source code in ontocast/onto/model.py
ExternalEvidenceRequest
¶
Bases: BaseModel
Node-level request for optional web search.
Nodes use this to explicitly signal whether downstream evidence planning/fetching should run for another pass.
Source code in ontocast/onto/model.py
Attributes¶
confidence = Field(default=0.0, ge=0.0, le=1.0, description='Confidence in this search decision.')
class-attribute
instance-attribute
¶
initiate_search = Field(default=False, description='Whether this node requests external evidence before retrying.')
class-attribute
instance-attribute
¶
query_hints = Field(default_factory=list, description='Optional focused query hints for planner targeting.')
class-attribute
instance-attribute
¶
rationale = Field(default='', description='Short reason explaining why search is needed (or not needed).')
class-attribute
instance-attribute
¶
Methods:¶
coerce_rationale(v)
classmethod
¶
normalize_query_hints(value)
classmethod
¶
Source code in ontocast/onto/model.py
FactsCompletionReport
¶
Bases: BaseModel
Output of the insert-only facts completion pass.
Structurally the ADD-only slice of :class:FactsCritiqueReport: no
success/score because this pass does not judge the render, and no
systemic_critique_summary because there is nothing to summarize beyond
the fixes themselves. No web-search request either -- the pass runs after
the critic loop has already used its evidence budget.
Source code in ontocast/onto/model.py
Attributes¶
proposed_fixes = Field(default_factory=list, description='One fix per new subject closure, action ADD only -- never REMOVE or REPLACE, and `triple_ids` is unused. `correct_value` holds every triple the closure needs (rdf:type, the recovered measurement, rdfs:label), attached to an existing catalog-typed subject when the EXISTING SUBJECTS chapter offers one for the same entity rather than minting a duplicate.')
class-attribute
instance-attribute
¶
FactsCritiqueReport
¶
Bases: BaseModel
Source code in ontocast/onto/model.py
Attributes¶
actionable_triple_fixes = Field(default_factory=list, description='List of specific fixes to correct the facts graph. For each fix, provide text evidence, action type, and relevant triples in deployment graph syntax (Turtle or JSON-LD per output instructions).')
class-attribute
instance-attribute
¶
external_evidence_request = Field(default_factory=ExternalEvidenceRequest, description='Optional request to run web search before retrying.')
class-attribute
instance-attribute
¶
score = Field(ge=0, le=100, description='Score 0-100 for how well the triples of facts represent the original document. 0 is the worst, 100 is the best.')
class-attribute
instance-attribute
¶
success = Field(description='True if the facts triples fully represent the document, False otherwise.')
class-attribute
instance-attribute
¶
systemic_critique_summary = Field(default='', description='A high-level, non-itemized summary of systemic or pattern-based issues identified across the facts graph.\nFocus on strategic problems rather than individual triple fixes, such as:\n- Consistent failure to extract certain data types (e.g., dates, currencies)\n- Structural patterns like creating entities instead of reusing existing ontology entities\n- Repeated misinterpretation of specific ontology properties or classes\n- Missing coverage of entire categories of information\n\nThis guides strategic improvements to the fact-extraction process.')
class-attribute
instance-attribute
¶
Methods:¶
coerce_score(v)
classmethod
¶
FactsGateRepairKind
¶
Bases: StrEnum
Kinds of machine-applied repair at the post-aggregation gate.
Distinct from :class:FactsUnitFindingKind: these are shape-driven and
apply to the merged graph, where the SHACL report is available.
Source code in ontocast/onto/model.py
Attributes¶
CODE_RESOLVED = 'code_resolved'
class-attribute
instance-attribute
¶
LITERAL_VARIANT_PRUNED = 'literal_variant_pruned'
class-attribute
instance-attribute
¶
SHACL_CODE_RESOLVED = 'shacl_code_resolved'
class-attribute
instance-attribute
¶
SHACL_PRUNE = 'shacl_prune'
class-attribute
instance-attribute
¶
SHACL_RETYPE = 'shacl_retype'
class-attribute
instance-attribute
¶
FactsRenderReport
¶
Bases: BaseModel
Facts rendering output with optional search decision.
Source code in ontocast/onto/model.py
Attributes¶
external_evidence_request = Field(default_factory=ExternalEvidenceRequest, description='Optional request to run web search before retrying.')
class-attribute
instance-attribute
¶
ontology_relevance_score = Field(default=None, ge=0, le=100, description='Score between 0 and 100 of how well the ontology represents the domain of the document.')
class-attribute
instance-attribute
¶
semantic_graph = Field(default_factory=RDFGraph, description='Semantic triples (facts) representing the document. Encoding is defined by deployment llm_graph_format and OUTPUT INSTRUCTION.')
class-attribute
instance-attribute
¶
triples_generation_score = Field(default=None, ge=0, le=100, description='Score 0-100 for how well the semantic triples represent the document. 0 is the worst, 100 is the best.')
class-attribute
instance-attribute
¶
FactsUnitFinding
¶
Bases: UnitFinding
One deterministic, machine-found issue in a rendered facts graph.
Source code in ontocast/onto/model.py
FactsUnitFindingKind
¶
Bases: StrEnum
Kinds of deterministic per-unit facts findings.
Source code in ontocast/onto/model.py
Attributes¶
CLOSED_RANGE_LITERAL = 'closed_range_literal'
class-attribute
instance-attribute
¶
COMPACT_IRI_LITERAL = 'compact_iri_literal'
class-attribute
instance-attribute
¶
CRITIC_FIX = 'critic_fix'
class-attribute
instance-attribute
¶
DOMAIN_ADHERENCE = 'domain_adherence'
class-attribute
instance-attribute
¶
DOMAIN_VIOLATION = 'domain_violation'
class-attribute
instance-attribute
¶
LABEL_ONLY_NUMBER = 'label_only_number'
class-attribute
instance-attribute
¶
LITERAL_TYPE_OBJECT = 'literal_type_object'
class-attribute
instance-attribute
¶
NUMERIC_COVERAGE = 'numeric_coverage'
class-attribute
instance-attribute
¶
PROPERTY_ALIAS = 'property_alias'
class-attribute
instance-attribute
¶
QUARANTINED_LITERAL = 'quarantined_literal'
class-attribute
instance-attribute
¶
SCALAR_AS_BOUNDS = 'scalar_as_bounds'
class-attribute
instance-attribute
¶
UNIT_SYMBOL_CASE_MISMATCH = 'unit_symbol_case_mismatch'
class-attribute
instance-attribute
¶
UNKNOWN_TERM = 'unknown_term'
class-attribute
instance-attribute
¶
FactsValidationFinding
¶
Bases: BaseModel
One invariant violation detected in the aggregated facts graph.
Error-severity findings of the merge-signature kinds
(FUNCTIONAL_VIOLATION, SUSPECT_MULTI_VALUE,
DEGENERATE_COREFERENCE) on subjects that resulted from an identity
merge drive the deterministic un-merge repair (full-cluster pair vetoes
plus re-aggregation). SHACL findings never drive it — a constraint
violation says a node is under-specified, not that two entities were
wrongly identified. Warning findings are telemetry only.
Source code in ontocast/onto/model.py
Attributes¶
component = Field(default='', description='SHACL constraint component IRI (sh:MinCountConstraintComponent, …) for SHACL findings; empty otherwise. Grouping by it is what turns a list of violations into a diagnosis.')
class-attribute
instance-attribute
¶
kind
instance-attribute
¶
message
instance-attribute
¶
predicate = ''
class-attribute
instance-attribute
¶
severity = 'error'
class-attribute
instance-attribute
¶
source_shape = Field(default='', description='SHACL shape that reported the violation; empty otherwise.')
class-attribute
instance-attribute
¶
subject = ''
class-attribute
instance-attribute
¶
values = Field(default_factory=list)
class-attribute
instance-attribute
¶
FactsValidationFindingKind
¶
Bases: StrEnum
Kinds of deterministic post-aggregation facts findings.
Source code in ontocast/onto/model.py
Attributes¶
DANGLING_REFERENCE = 'dangling_reference'
class-attribute
instance-attribute
¶
DEGENERATE_COREFERENCE = 'degenerate_coreference'
class-attribute
instance-attribute
¶
FUNCTIONAL_VIOLATION = 'functional_violation'
class-attribute
instance-attribute
¶
MIXED_OBJECT_KINDS = 'mixed_object_kinds'
class-attribute
instance-attribute
¶
NON_CATALOG_VOCABULARY = 'non_catalog_vocabulary'
class-attribute
instance-attribute
¶
SHACL = 'shacl'
class-attribute
instance-attribute
¶
SUSPECT_MULTI_VALUE = 'suspect_multi_value'
class-attribute
instance-attribute
¶
GraphRepairRecord
¶
Bases: BaseModel
One machine-applied deterministic rewrite on a facts graph.
LLM-free by construction: every repair either rewrites a term the catalog
already declares or removes a node that asserts nothing. Records what the
repair passes changed (near-miss predicate rewrites, literal rdf:type
coercions, shape-driven retyping/pruning) so downstream consumers can
distinguish machine-altered triples from what the LLM asserted.
Source code in ontocast/onto/model.py
GraphUpdateRenderReport
¶
Bases: BaseModel
Graph update rendering output with optional search decision.
The wire shape is deliberately flat, and deliberately the same shape as
:class:FactsRenderReport: two sibling graph fields, no wrapper object and
no list. The previous shape nested the graph inside
graph_update.triple_operations[], and a singleton list holding one
long JSON-LD document is a shape models close wrongly -- measured at 20/24
malformed above ~4k characters on gpt-5-mini, versus 0/22 whenever the list
happened to hold two or more operations and the },{ boundary reinforced
the array frame. Nothing here may reintroduce a list-of-one around a large
payload.
The internal :class:GraphUpdate keeps its ordered TripleOp list; this
is a wire encoding, not the patch model. See :meth:to_graph_update.
Source code in ontocast/onto/model.py
Attributes¶
delete_graph = Field(default_factory=RDFGraph, description='Triples to REMOVE, matching the stored triples exactly. Encoding is defined by deployment llm_graph_format and OUTPUT INSTRUCTION. Omit or leave empty when removing nothing.')
class-attribute
instance-attribute
¶
external_evidence_request = Field(default_factory=ExternalEvidenceRequest, description='Optional request to run web search before retrying.')
class-attribute
instance-attribute
¶
insert_graph = Field(default_factory=RDFGraph, description='Triples to ADD. Encoding is defined by deployment llm_graph_format and OUTPUT INSTRUCTION. Omit or leave empty when adding nothing.')
class-attribute
instance-attribute
¶
Methods:¶
to_graph_update()
¶
Compile the wire payload into an ordered patch.
Deletes are ordered before inserts, and an empty side contributes no operation. Interleaving the two within a single render is not expressible on this wire: it would only matter for a patch that removes and re-adds the same triple, which nets out to nothing.
Source code in ontocast/onto/model.py
LoopAttempt
¶
Bases: BaseModel
Telemetry record for one attempt inside a per-unit render/critic loop.
Shared by the facts and the ontology loop — the fields are phase-neutral
and a record's home (``UnitFactsState.attempt_log`` vs
``UnitOntologyState.attempt_log``) says which loop produced it.
``n_deterministic_findings`` / ``n_mandatory_findings`` count findings
against the graph as of this record: for ``llm_repair`` records that is the
residual *after* the repair render, so summing the last repair record per
unit yields the true document-level residual.
kind="critic_patch" is the LLM-free application of a critique: it costs
nothing and is recorded separately from the critic call that produced
the fixes, so "what the critique cost" and "what it changed" stay
distinguishable. kind="llm_repair" is retained for artifacts written by
earlier releases, when a separate finding-driven repair render existed.
kind="critic_skipped" records a pass the loop decided not to spend --
no call was billed -- with the reason in accept_reason
(empty_render, citation_metadata). A critic record whose
accept_reason is critic_unavailable is a billed call that
produced no critique; the unit leaves the loop unreviewed.
kind="completion" is the insert-only completion pass.
Source code in ontocast/onto/model.py
842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 | |
Attributes¶
accept_reason = ''
class-attribute
instance-attribute
¶
action_severity_counts = Field(default_factory=dict, description="Proposed fixes keyed 'ACTION:severity'. Severity alone cannot be read: a REMOVE never blocks acceptance whatever its severity, so 'critical' counts mix fixes that gate a render with fixes that cannot. Splitting by action is what makes the two distinguishable from the artifacts.")
class-attribute
instance-attribute
¶
critic_attempt = 0
class-attribute
instance-attribute
¶
delta_triple_count = None
class-attribute
instance-attribute
¶
failure_reason = None
class-attribute
instance-attribute
¶
failure_stage = None
class-attribute
instance-attribute
¶
incumbent_accepted = Field(default=None, description='What the retired score gate would have decided for this critic attempt, recorded so the switch to a findings-based gate can be judged against a distribution rather than an argument.')
class-attribute
instance-attribute
¶
kind = 'render'
class-attribute
instance-attribute
¶
n_actionable_fixes = 0
class-attribute
instance-attribute
¶
n_deterministic_findings = 0
class-attribute
instance-attribute
¶
n_fixes_applied = 0
class-attribute
instance-attribute
¶
n_fixes_junk_refused = Field(default=0, description='Inserts refused at compile time for minting a placeholder: a subject named for an ignored token or artifact, or a new node carrying only annotations and no type.')
class-attribute
instance-attribute
¶
n_fixes_noop = Field(default=0, description='Fixes whose delete set and insert set were the same statements. Counted because a critique made mostly of these is a critic producing motion rather than corrections.')
class-attribute
instance-attribute
¶
n_fixes_rolled_back = 0
class-attribute
instance-attribute
¶
n_fixes_targeting_snapshot = 0
class-attribute
instance-attribute
¶
n_fixes_unresolved_prefix = Field(default=0, description='Fixes whose payload named a prefix nothing declared, so the statement it meant could not be identified.')
class-attribute
instance-attribute
¶
n_mandatory_findings = 0
class-attribute
instance-attribute
¶
n_measurements_recovered = Field(default=0, description='Completion pass only: missed measurements the numeric inventory no longer lists after the inserts that stayed.')
class-attribute
instance-attribute
¶
n_triples_deleted = 0
class-attribute
instance-attribute
¶
n_triples_inserted = 0
class-attribute
instance-attribute
¶
patch_delete_capped = Field(default=False, description='The delete-share cap fired: the pass kept its inserts and dropped its deletes.')
class-attribute
instance-attribute
¶
patch_rolled_back = Field(default=False, description='At least one fix of the pass was undone for leaving the unit worse. Fixes are applied and judged one at a time, so the rest of the pass stands; ``n_fixes_rolled_back`` says how many went.')
class-attribute
instance-attribute
¶
render_attempt = 0
class-attribute
instance-attribute
¶
repair_delete_only = False
class-attribute
instance-attribute
¶
repair_failed = False
class-attribute
instance-attribute
¶
rolled_back_fixes = Field(default_factory=list, description='The undone fixes, each with the reason it was refused.')
class-attribute
instance-attribute
¶
score = None
class-attribute
instance-attribute
¶
severity_counts = Field(default_factory=dict)
class-attribute
instance-attribute
¶
success = None
class-attribute
instance-attribute
¶
triple_count = 0
class-attribute
instance-attribute
¶
OntologyCritiqueReport
¶
Bases: BaseModel
Report from ontology update critique process.
Source code in ontocast/onto/model.py
Attributes¶
actionable_ontology_fixes = Field(default_factory=list, description='List of specific fixes to correct the ontology graph. For each fix, provide text evidence, action type, and relevant triples in deployment graph syntax (Turtle or JSON-LD per output instructions).')
class-attribute
instance-attribute
¶
external_evidence_request = Field(default_factory=ExternalEvidenceRequest, description='Optional request to run web search before retrying.')
class-attribute
instance-attribute
¶
score = Field(ge=0, le=100, description='Score 0-100 for how well the presented ontology serves as the ontology for the document. 0 is the worst, 100 is the best.')
class-attribute
instance-attribute
¶
success = Field(description='True if the presented ontology is appropriate, complete, consistent and represents well the domain of the provided text, False otherwise.')
class-attribute
instance-attribute
¶
systemic_critique_summary = Field(default='', description='A high-level summary of systemic deficiencies in the ontology (e.g., poor hierarchy structure, redundant concepts, lack of appropriate granularity, or general failures in Domain Coverage). This addresses strategic issues beyond individual term fixes.')
class-attribute
instance-attribute
¶
Methods:¶
coerce_score(v)
classmethod
¶
OntologyRenderReport
¶
Bases: BaseModel
Ontology rendering output with optional search decision.
Source code in ontocast/onto/model.py
OntologySelectorReport
¶
Bases: BasePydanticModel
Base class for ontology selection report.
Note: Use create_ontology_selector_report_model() to create a model with the correct answer_index constraint.
Source code in ontocast/onto/model.py
OntologyUnitFinding
¶
Bases: UnitFinding
One deterministic, machine-found issue in a unit's ontology delta.
Source code in ontocast/onto/model.py
OntologyUnitFindingKind
¶
Bases: StrEnum
Kinds of deterministic per-unit ontology findings.
Computed against the unit's net insert/delete delta, never the whole
working graph — validating snapshot+delta would attribute every
pre-existing catalog defect to this unit, and the facts UNKNOWN_TERM
rule is semantically inverted here (minting new terms is the ontology
renderer's job).
Source code in ontocast/onto/model.py
Attributes¶
CARDINALITY_CONTRADICTION = 'cardinality_contradiction'
class-attribute
instance-attribute
¶
DEGENERATE_RESTRICTION = 'degenerate_restriction'
class-attribute
instance-attribute
¶
FOREIGN_DELETE = 'foreign_delete'
class-attribute
instance-attribute
¶
FOREIGN_NAMESPACE = 'foreign_namespace'
class-attribute
instance-attribute
¶
LABEL_COLLISION = 'label_collision'
class-attribute
instance-attribute
¶
MISSING_LABEL = 'missing_label'
class-attribute
instance-attribute
¶
ROLE_CONFUSION = 'role_confusion'
class-attribute
instance-attribute
¶
SUBCLASS_CYCLE = 'subclass_cycle'
class-attribute
instance-attribute
¶
RolledBackFix
¶
Bases: BaseModel
One critic fix applied and undone on its own for leaving the unit worse.
Carried on the critic_patch attempt that rolled it back, so a dump
shows which correction was refused and why -- previously the whole
pass was undone and the record said only that it had been.
Source code in ontocast/onto/model.py
Suggestions
¶
Bases: BaseModel
Report from knowledge graph critique process.
Attributes:
| Name | Type | Description |
|---|---|---|
systemic_critique_summary |
str
|
A compilation of general improvement suggestions. |
actionable_fixes |
list[TripleFix]
|
An itemized list of concrete suggestions for improvement. |
Source code in ontocast/onto/model.py
1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 | |
Attributes¶
actionable_fixes = Field(default_factory=list, description='An itemized list of concrete suggestions for improvement.')
class-attribute
instance-attribute
¶
systemic_critique_summary = Field(default='', description='A general improvement suggestion.')
class-attribute
instance-attribute
¶
Methods:¶
coerce_systemic_critique_summary(v)
classmethod
¶
from_critique_report(critique)
classmethod
¶
Create Suggestions from any critique report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
critique
|
OntologyCritiqueReport | FactsCritiqueReport
|
Either an OntologyCritiqueReport or FactsCritiqueReport to convert. |
required |
Returns:
| Type | Description |
|---|---|
Suggestions
|
Suggestions object with actionable fixes and systemic critique summary. |
Source code in ontocast/onto/model.py
to_markdown()
¶
Convert actionable fixes and systemic critique summary to a unified markdown block.
Returns:
| Type | Description |
|---|---|
str
|
Markdown formatted string with both actionable fixes and systemic critique summary. |
Source code in ontocast/onto/model.py
TripleFix
¶
Bases: BaseModel
A single actionable correction to an RDF facts or ontology graph.
incorrect_value / correct_value are plain strings; encoding follows
deployment llm_graph_format and GRAPH FORMAT INSTRUCTION.
Source code in ontocast/onto/model.py
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 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 | |
Attributes¶
action = Field(description='Type of fix:\n- ADD: Add new triple, prefix declaration, or missing information\n- REMOVE: Delete incorrect or redundant triple\n- REPLACE: Substitute one entity, property, or literal for another')
class-attribute
instance-attribute
¶
correct_value = Field(default=None, description='Proposed correct triple/entity/value (for ADD and REPLACE). Encoding is defined by deployment llm_graph_format and GRAPH FORMAT INSTRUCTION.')
class-attribute
instance-attribute
¶
explanation = Field(description="Why this fix is needed. Examples:\n- 'Missing xsd:date datatype for temporal literal'\n- 'Namespace prefix fca: not declared'\n- 'Property onto:decidedBy is canonical, not cd:judgedBy'")
class-attribute
instance-attribute
¶
incorrect_value = Field(default=None, description='Legacy. Prefer `triple_ids`. Only consulted when a REMOVE or REPLACE cites no ids, because a retyped statement matches the stored one a minority of the time.')
class-attribute
instance-attribute
¶
severity = Field(description="Severity level: 'critical' (breaks semantic graph), 'important' (significant gap), or 'minor' (polish). Note: 'major' will be automatically converted to 'important'.")
class-attribute
instance-attribute
¶
target = Field(default=None, description="What is being fixed. Examples:\n- 'triple' (for triple-level changes)\n- 'entity' (replacing cd: with ontology entity)\n- 'property' (using correct property)\n- 'datatype' (fixing literal type)\n- 'prefix' (adding namespace declaration)\n- 'language_tag' (adding/fixing @lang)")
class-attribute
instance-attribute
¶
text_fragment = Field(description='Exact quote from source text justifying this change')
class-attribute
instance-attribute
¶
triple_ids = Field(default_factory=list, description='Ids of the statements this fix removes, taken from the bracketed numbers in the graph chapter. REQUIRED for REMOVE and REPLACE. Cite the id; never retype the statement.')
class-attribute
instance-attribute
¶
Methods:¶
coerce_free_text(v)
classmethod
¶
Coerce the two required free-text fields.
Both are required with no default, so a provider answering either with a
bulleted list raised and discarded the whole critique report. Deliberately
not applied to incorrect_value/correct_value: those carry graph
syntax, where joining a list would corrupt the payload rather than
recover it.
Source code in ontocast/onto/model.py
coerce_triple_ids(v)
classmethod
¶
Accept the shapes providers actually return for a list of ints.
A bare 12, a string "12", a stringified list "[12, 13]" and a
list of strings all mean the same thing. This field is the only way a
REMOVE or REPLACE can address anything, so a formatting quirk here would
discard the fix -- and, because the report validates as a whole, every
other fix alongside it.
Source code in ontocast/onto/model.py
normalize_severity(v)
classmethod
¶
Normalize severity values to accepted literals.
Maps 'major' to 'important' for backward compatibility with prompts that use 'major' terminology. This allows the LLM to use either term.
Source code in ontocast/onto/model.py
to_markdown()
¶
Convert this TripleFix to markdown format.
Returns:
| Type | Description |
|---|---|
str
|
Markdown formatted string representing this fix. |
Source code in ontocast/onto/model.py
UnitFailure
¶
Bases: BaseModel
One content unit that produced no usable output.
Carried to the document level so a caller can tell "nothing to extract"
from "every unit failed" -- previously both produced an empty result with
status: success.
Source code in ontocast/onto/model.py
UnitFinding
¶
Bases: BaseModel
One deterministic, machine-found issue in a rendered unit graph.
Base shape shared by the facts and ontology validators; the subclasses
pin kind to their own enum. Mandatory findings are violations the
renderer must fix; non-mandatory findings list candidates the renderer
adjudicates item by item.
Source code in ontocast/onto/model.py
Attributes¶
facet = Field(default='', description="Variant within ``kind`` for findings that come in more than one: numeric coverage is split into 'measurements' (a number written with its unit) and 'unclassified' (a bare number).")
class-attribute
instance-attribute
¶
kind
instance-attribute
¶
mandatory = True
class-attribute
instance-attribute
¶
message
instance-attribute
¶
predicate = ''
class-attribute
instance-attribute
¶
subject = ''
class-attribute
instance-attribute
¶
suggestions = Field(default_factory=list)
class-attribute
instance-attribute
¶
value = ''
class-attribute
instance-attribute
¶
Functions:¶
create_ontology_selector_report_model(num_ontologies)
¶
Create a dynamic OntologySelectorReport model with answer_index constraint.
The answer_index field is constrained to be between 1 and num_ontologies + 1, where: - 1 to num_ontologies: corresponds to the ontology at that index (1-based) - num_ontologies + 1: represents "None" (no suitable ontology)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_ontologies
|
int
|
The number of ontologies in the selection list. |
required |
Returns:
| Type | Description |
|---|---|
type[BasePydanticModel]
|
A dynamically created Pydantic model class with the appropriate constraint. |
Source code in ontocast/onto/model.py
format_findings_for_prompt(findings, *, advisory_heading='## Verify numeric coverage')
¶
Render findings as MANDATORY-fixes + advisory blocks for a prompt.
The default advisory heading is the facts loop's (its only advisory kind is numeric coverage) and is part of prompts already in the LLM cache — callers with different advisory content pass their own heading rather than changing the default.