cadrumo.application.modelo.semantic_role_resolution module¶
Single-casilla semantic-role resolution for modelo application services.
Snapshot-backed callers pass a RegistrySnapshot so semantic roles
resolve only to declared canonical casilla.id values for that revision.
Advisory helpers that already hold a revision object use the structural
revision resolver and get the same ambiguity guard.
See also
calculate_inputWork-unit input shortcuts that resolve operator-facing semantic-role tokens through a registry snapshot.
binding_resolutionDeclaration-period metadata binding path that only accepts informational semantic-role casillas.
taxation_comparisonSnapshot-backed comparison surface that uses semantic roles for the Modelo 100 result and quota casillas.
- class SemanticRoleCasillaAmbiguity(semantic_role, modelo_id, revision_id, casilla_ids)[source]¶
Bases:
objectStructured detail for a semantic role that resolves to multiple casillas.
Attached to
AmbiguousSemanticRoleCasillaErrorso callers can relay the ambiguous role, modelo, revision, and candidate casillas without parsing the error message.- Parameters:
- exception AmbiguousSemanticRoleCasillaError(ambiguity)[source]¶
Bases:
ModeloErrorRaised when a semantic-role resolver would emit an arbitrary casilla id.
The exception carries a
SemanticRoleCasillaAmbiguitypayload instead of selecting one candidate, preserving the canonicalcasilla.idcontract.- Parameters:
ambiguity (SemanticRoleCasillaAmbiguity)
- Return type:
None
- code¶
- casilla_id_for_unique_semantic_role(snapshot, semantic_role)[source]¶
Return the unique casilla id for
semantic_roleinsnapshot.Nonemeans the concrete revision does not declare the role. Multiple matches are refused because returning one would silently convert a non- canonical reference into an arbitrary canonicalcasilla.id.- Parameters:
snapshot (
RegistrySnapshot) – TheRegistrySnapshotwhose revision is inspected.semantic_role (
str) – Semantic role token to resolve.
- Return type:
TypeAliasType|None
- casilla_id_for_unique_revision_semantic_role(revision, semantic_role, *, modelo_id=None)[source]¶
Return the unique casilla id for
semantic_roleinrevision.This accepts a structural revision object so advisory helpers that only receive a revision can share the same ambiguity guard as snapshot-backed services. The object must expose
idandcasillasattributes compatible with the registryModeloRevisionshape.
- casilla_id_for_unambiguous_revision_semantic_role(revision, semantic_role, *, modelo_id=None)[source]¶
Return the casilla id only when
semantic_roleresolves unambiguously.The sibling above raises on ambiguity so a caller that must not proceed on a guess gets an instructive refusal. An advisory has the opposite need: it is a non-blocking diagnostic, so a revision it cannot address unambiguously is a revision it declines to speak about, and
Nonealready means “no casilla to address” for the absent case. This collapses both to that one answer.Two returns share it, and they are not the same fact: an absent role and an ambiguous one. A caller that needs to tell them apart must use the raising sibling, because this function deliberately cannot.