Capabilities / Mapping
EffectiveModelMappingCapability
- class teksi_hooks.capabilities.mapping.EffectiveModelMappingCapability(explicit_mapping, implicit_mapping=None)[source]
Resolve effective source-to-canonical mappings.
Explicit mappings take precedence at the most specific lookup level. Missing explicit classes, attributes, values, identities and relations fall back to the implicit mapping provider.
A function-backed explicit class remains authoritative for projection. Consumers must inspect ClassMapping.function before requesting attribute mappings for that class.
- Parameters:
explicit_mapping (ModelMappingCapability)
implicit_mapping (ImplicitModelMappingCapability | None)
- class_definition(class_id)[source]
Return the effective class mapping.
- Parameters:
class_id (str)
- Return type:
- try_class_definition(class_id)[source]
Return the effective class mapping if available.
- Parameters:
class_id (str)
- Return type:
ClassMapping | None
- attribute_definition(class_id, attribute_name)[source]
Return the effective attribute mapping.
- Parameters:
class_id (str)
attribute_name (str)
- Return type:
- try_attribute_definition(class_id, attribute_name)[source]
Return the effective attribute mapping if available.
- Parameters:
class_id (str)
attribute_name (str)
- Return type:
AttributeMapping | None
- value_mapping(class_id, attribute_name, value)[source]
Return the effective static value mapping.
- Parameters:
class_id (str)
attribute_name (str)
value (str)
- Return type:
- try_value_mapping(class_id, attribute_name, value)[source]
Return the effective static value mapping if available.
- Parameters:
class_id (str)
attribute_name (str)
value (str)
- Return type:
ValueMapping | None
- identity_definition(class_id, canonical_class_id)[source]
Return the effective target identity.
- Parameters:
class_id (str)
canonical_class_id (str)
- Return type:
- try_identity_definition(class_id, canonical_class_id)[source]
Return the effective target identity if available.
- Parameters:
class_id (str)
canonical_class_id (str)
- Return type:
CanonicalIdentityMapping | None
- relation_definition(class_id, relation_id)[source]
Return the effective relation mapping.
- Parameters:
class_id (str)
relation_id (str)
- Return type:
- try_relation_definition(class_id, relation_id)[source]
Return the effective relation mapping if available.
- Parameters:
class_id (str)
relation_id (str)
- Return type:
RelationMapping | None
- property is_ssot: bool
Return whether the explicit mapping is a source-of-truth mapping.
Fields
explicit_mappingType:
ModelMappingCapabilityimplicit_mappingType:
ImplicitModelMappingCapability | None
ModelMappingCapability
- class teksi_hooks.capabilities.mapping.ModelMappingCapability(mapping)[source]
Provide runtime lookup access to one resolved ModelMapping.
The model mapping describes how one source model maps to the canonical internal model. Model inheritance, model defaults, localized source identifiers and conditional default attributes must already be resolved before this capability is created.
Existing class, attribute and value lookup methods remain available for compatibility with current mapping consumers.
- Parameters:
mapping (ModelMapping)
- class_definition(class_id)[source]
Return the mapping for a source-model class.
Parameters
- class_id:
Resolved source-model class identifier.
Raises
- KeyError
If the source class is unknown.
- Parameters:
class_id (str)
- Return type:
- try_class_definition(class_id)[source]
Return a class mapping if available.
- Parameters:
class_id (str)
- Return type:
ClassMapping | None
- attribute_definition(class_id, attribute_name)[source]
Return the mapping for a source-model attribute.
Parameters
- class_id:
Resolved source-model class identifier.
- attribute_name:
Source-model runtime attribute identifier.
Raises
- KeyError
If the class or attribute is unknown.
- Parameters:
class_id (str)
attribute_name (str)
- Return type:
- try_attribute_definition(class_id, attribute_name)[source]
Return an attribute mapping if available.
- Parameters:
class_id (str)
attribute_name (str)
- Return type:
AttributeMapping | None
- value_mapping(class_id, attribute_name, value)[source]
Return the static mapping for a source-model value.
Database-backed value-list translations are represented by AttributeMapping.value_list and are not returned by this method.
Parameters
- class_id:
Resolved source-model class identifier.
- attribute_name:
Source-model runtime attribute identifier.
- value:
Source-model value.
Raises
- KeyError
If the class, attribute or value is unknown.
- Parameters:
class_id (str)
attribute_name (str)
value (str)
- Return type:
- try_value_mapping(class_id, attribute_name, value)[source]
Return a static value mapping if available.
Database-backed value-list translations are represented by AttributeMapping.value_list and are not returned by this method.
- Parameters:
class_id (str)
attribute_name (str)
value (str)
- Return type:
ValueMapping | None
- identity_definition(class_id, canonical_class_id)[source]
Return the resolved identity for a canonical target class.
Parameters
- class_id:
Resolved source-model class identifier.
- canonical_class_id:
Canonical target class identifier.
Raises
- KeyError
If the source class or target identity is unknown.
- Parameters:
class_id (str)
canonical_class_id (str)
- Return type:
- try_identity_definition(class_id, canonical_class_id)[source]
Return the resolved identity for a target class if available.
- Parameters:
class_id (str)
canonical_class_id (str)
- Return type:
CanonicalIdentityMapping | None
- relation_definition(class_id, relation_id)[source]
Return the resolved mapping for a canonical relation.
Parameters
- class_id:
Resolved source-model class identifier.
- relation_id:
Stable canonical relation identifier.
Raises
- KeyError
If the source class or relation is unknown.
- Parameters:
class_id (str)
relation_id (str)
- Return type:
- try_relation_definition(class_id, relation_id)[source]
Return a resolved relation mapping if available.
- Parameters:
class_id (str)
relation_id (str)
- Return type:
RelationMapping | None
- property is_ssot: bool
Return whether the mapping describes a source-of-truth model.
Fields
mappingType:
ModelMapping