betty.associations.to_one module¶
To-one entity associations.
- final exception betty.associations.to_one.MissingAssociate¶
Bases:
AttributeError,GenericRaised when a to-one association is missing its required associate.
- __init__(association: Association[OwnerT, Any, Any, Any, Any], owner: OwnerT, reason: str, /)¶
- final class betty.associations.to_one.Placeholder¶
Bases:
_MissingAssociateA placeholder.
- final class betty.associations.to_one.ToOne¶
Bases:
Association[OwnerT,AssociateT,AssociateT,ToOneAssociate,DataDefinition],GenericA *-to-one entity association.
- __init__(associate: str | type[AssociateT], associate_attr: str | None = None, /, *, description: ResolvableLocalizable | None = None, label: ResolvableLocalizable)¶
- async dump_linked_data_for(project: Project, owner: OwnerT, /) PortableData¶
Dump the given target to JSON-LD.
- get(owner: OwnerT, /) AssociateT¶
Get the property value from the owner.
- get_associates(owner: OwnerT, /) Iterable[AssociateT]¶
Get the associates for the given owner.
- is_resolver(value: ToOneAssociate[OwnerT, AssociateT], /) TypeGuard[AssociateResolver[OwnerT, AssociateT]]¶
Test that the value is an entity (associate) resolver.
- async linked_data_schema_for(project: Project, /) Schema¶
Define the JSON Schema for
betty.linked_data.LinkedDataDumper.dump_linked_data_for().
- property optional: Association[OwnerT, AssociateT, AssociateT | None, Associate[OwnerT, AssociateT] | None, DataDefinition[AssociateT | None]]¶
Return a new association like this one, but that also allows
None.
- resolve(project: Project, owner: OwnerT, /) None¶
Resolve any associates the owner may have for this association.