betty.model package¶
Submodules¶
- betty.model.ancestry module
- betty.model.ancestry.Ancestry
- betty.model.ancestry.AnonymousCitation
- betty.model.ancestry.AnonymousSource
- betty.model.ancestry.Attendee
- betty.model.ancestry.Beneficiary
- betty.model.ancestry.Celebrant
- betty.model.ancestry.Citation
- betty.model.ancestry.Dated
- betty.model.ancestry.Described
- betty.model.ancestry.Enclosure
- betty.model.ancestry.Event
- betty.model.ancestry.File
- betty.model.ancestry.HasCitations
- betty.model.ancestry.HasFiles
- betty.model.ancestry.HasLinks
- betty.model.ancestry.HasLinksEntity
- betty.model.ancestry.HasMediaType
- betty.model.ancestry.HasNotes
- betty.model.ancestry.HasPrivacy
- betty.model.ancestry.Link
- betty.model.ancestry.Note
- betty.model.ancestry.Organizer
- betty.model.ancestry.Person
- betty.model.ancestry.PersonName
- betty.model.ancestry.Place
- betty.model.ancestry.PlaceName
- betty.model.ancestry.Presence
- betty.model.ancestry.PresenceRole
- betty.model.ancestry.Privacy
- betty.model.ancestry.Source
- betty.model.ancestry.Speaker
- betty.model.ancestry.Subject
- betty.model.ancestry.Witness
- betty.model.ancestry.is_private
- betty.model.ancestry.is_public
- betty.model.ancestry.merge_privacies
- betty.model.ancestry.ref_link
- betty.model.ancestry.ref_link_collection
- betty.model.ancestry.ref_media_type
- betty.model.ancestry.ref_role
- betty.model.ancestry.resolve_privacy
- betty.model.event_type module
- betty.model.event_type.Adoption
- betty.model.event_type.Baptism
- betty.model.event_type.Birth
- betty.model.event_type.Burial
- betty.model.event_type.Conference
- betty.model.event_type.Confirmation
- betty.model.event_type.Correspondence
- betty.model.event_type.CreatableDerivableEventType
- betty.model.event_type.Cremation
- betty.model.event_type.Death
- betty.model.event_type.DerivableEventType
- betty.model.event_type.Divorce
- betty.model.event_type.DivorceAnnouncement
- betty.model.event_type.DuringLifeEventType
- betty.model.event_type.Emigration
- betty.model.event_type.EndOfLifeEventType
- betty.model.event_type.Engagement
- betty.model.event_type.EventType
- betty.model.event_type.EventTypeProvider
- betty.model.event_type.FinalDispositionEventType
- betty.model.event_type.Funeral
- betty.model.event_type.Immigration
- betty.model.event_type.Marriage
- betty.model.event_type.MarriageAnnouncement
- betty.model.event_type.Missing
- betty.model.event_type.Occupation
- betty.model.event_type.PostDeathEventType
- betty.model.event_type.PreBirthEventType
- betty.model.event_type.Residence
- betty.model.event_type.Retirement
- betty.model.event_type.StartOfLifeEventType
- betty.model.event_type.UnknownEventType
- betty.model.event_type.Will
Module contents¶
Provide Betty’s data model API.
- class betty.model.AliasedEntity(original_entity, aliased_entity_id=None)[source]¶
Bases:
Generic[EntityT]- property id : str¶
- unalias()[source]¶
- Return type:¶
typing.TypeVar(EntityT, bound=betty.model.Entity)
- class betty.model.BidirectionalEntityTypeAssociation(owner_type, owner_attr_name, associate_type_name, associate_attr_name)[source]¶
Bases:
Generic[OwnerT,AssociateT],_EntityTypeAssociation[OwnerT,AssociateT]- property associate_attr_name : str¶
- inverse()[source]¶
- Return type:¶
betty.model.BidirectionalEntityTypeAssociation[typing.TypeVar(AssociateT),typing.TypeVar(OwnerT)]
- class betty.model.BidirectionalToManyEntityTypeAssociation(owner_type, owner_attr_name, associate_type_name, associate_attr_name)[source]¶
Bases:
Generic[OwnerT,AssociateT],ToManyEntityTypeAssociation[OwnerT,AssociateT],BidirectionalEntityTypeAssociation[OwnerT,AssociateT]
- class betty.model.BidirectionalToOneEntityTypeAssociation(owner_type, owner_attr_name, associate_type_name, associate_attr_name)[source]¶
Bases:
Generic[OwnerT,AssociateT],ToOneEntityTypeAssociation[OwnerT,AssociateT],BidirectionalEntityTypeAssociation[OwnerT,AssociateT]
- class betty.model.Entity(id=None, *args, **kwargs)[source]¶
Bases:
LinkedDataDumpable- property ancestry_id : tuple[type[Self], str]¶
- async dump_linked_data(app)[source]¶
Dump this instance to JSON-LD.
- Parameters:¶
- app¶
- Return type:¶
dict[str,typing.Union[bool,int,float,str,None,typing.Sequence[typing.Union[bool,int,float,str,None,typing.Sequence[Dump],typing.Mapping[str, Dump]]],typing.Mapping[str,typing.Union[bool,int,float,str,None,typing.Sequence[Dump],typing.Mapping[str, Dump]]]]]
- property id : str¶
- async classmethod linked_data_schema(app)[source]¶
Define the JSON Schema for self.dump_linked_data().
- Parameters:¶
- app¶
- Return type:¶
dict[str,typing.Union[bool,int,float,str,None,typing.Sequence[typing.Union[bool,int,float,str,None,typing.Sequence[Dump],typing.Mapping[str, Dump]]],typing.Mapping[str,typing.Union[bool,int,float,str,None,typing.Sequence[Dump],typing.Mapping[str, Dump]]]]]
- property type : type[Self]¶
- class betty.model.EntityCollection[source]¶
Bases:
Generic[TargetT]- property view : list[TargetT & Entity]¶
- class betty.model.EntityGraphBuilder[source]¶
Bases:
_EntityGraphBuilder- add_association(owner_type, owner_id, owner_attr_name, associate_type, associate_id)[source]¶
- class betty.model.EntityTypeAssociationRegistry[source]¶
Bases:
object- classmethod get_all_associations(owner)[source]¶
- Parameters:¶
- owner¶
- Return type:¶
set[typing.Union[betty.model.ToOneEntityTypeAssociation[typing.Any,typing.Any],betty.model.ToManyEntityTypeAssociation[typing.Any,typing.Any]]]
- classmethod get_associates(owner, association)[source]¶
- classmethod get_association(owner, owner_attr_name)[source]¶
- exception betty.model.EntityTypeImportError(entity_type_name)[source]¶
Bases:
EntityTypeError,ImportErrorRaised when an alleged entity type cannot be imported.
- exception betty.model.EntityTypeInvalidError(entity_type)[source]¶
Bases:
EntityTypeError,ImportErrorRaised for types that are not valid entity types.
- class betty.model.EntityTypeProvider[source]¶
Bases:
object- async entity_types()[source]¶
- Return type:¶
set[type[betty.model.Entity]]
- class betty.model.GeneratedEntityId(entity_id: str | None = None)[source]¶
Bases:
strGenerate a unique entity ID.
Entities must have IDs for identification. However, not all entities can be provided with an ID that exists in the original data set (such as a third-party family tree loaded into Betty), so IDs can be generated.
- class betty.model.ManyToMany(owner_type, owner_attr_name, associate_type_name, associate_attr_name)[source]¶
Bases:
Generic[OwnerT,AssociateT],BidirectionalToManyEntityTypeAssociation[OwnerT,AssociateT]
- class betty.model.ManyToOne(owner_type, owner_attr_name, associate_type_name, associate_attr_name)[source]¶
Bases:
Generic[OwnerT,AssociateT],BidirectionalToOneEntityTypeAssociation[OwnerT,AssociateT]
- class betty.model.MultipleTypesEntityCollection[source]¶
Bases:
Generic[TargetT],EntityCollection[TargetT]
- class betty.model.OneToMany(owner_type, owner_attr_name, associate_type_name, associate_attr_name)[source]¶
Bases:
Generic[OwnerT,AssociateT],BidirectionalToManyEntityTypeAssociation[OwnerT,AssociateT]
- class betty.model.OneToOne(owner_type, owner_attr_name, associate_type_name, associate_attr_name)[source]¶
Bases:
Generic[OwnerT,AssociateT],BidirectionalToOneEntityTypeAssociation[OwnerT,AssociateT]
- class betty.model.SingleTypeEntityCollection(target_type)[source]¶
Bases:
Generic[TargetT],EntityCollection[TargetT]
- class betty.model.ToMany(owner_type, owner_attr_name, associate_type_name)[source]¶
Bases:
Generic[OwnerT,AssociateT],ToManyEntityTypeAssociation[OwnerT,AssociateT]
- class betty.model.ToManyEntityTypeAssociation(owner_type, owner_attr_name, associate_type_name)[source]¶
Bases:
Generic[OwnerT,AssociateT],_EntityTypeAssociation[OwnerT,AssociateT]
- class betty.model.ToOne(owner_type, owner_attr_name, associate_type_name)[source]¶
Bases:
Generic[OwnerT,AssociateT],ToOneEntityTypeAssociation[OwnerT,AssociateT]
- class betty.model.ToOneEntityTypeAssociation(owner_type, owner_attr_name, associate_type_name)[source]¶
Bases:
Generic[OwnerT,AssociateT],_EntityTypeAssociation[OwnerT,AssociateT]
- betty.model.get_entity_type(entity_type_name)[source]¶
Get the entity type for an entity type name.
- Parameters:¶
- entity_type_name¶
- Return type:¶
type[betty.model.Entity]
- betty.model.get_entity_type_name(entity_type_definition)[source]¶
Get the entity type name for an entity or entity type.
- betty.model.many_to_many(owner_attr_name, associate_type_name, associate_attr_name)[source]¶
Add a bidirectional many-to-many association to an entity or entity mixin.
- betty.model.many_to_one(owner_attr_name, associate_type_name, associate_attr_name)[source]¶
Add a bidirectional many-to-one association to an entity or entity mixin.
- betty.model.many_to_one_to_many(left_associate_type_name, left_associate_attr_name, left_owner_attr_name, right_owner_attr_name, right_associate_type_name, right_associate_attr_name)[source]¶
Add a bidirectional many-to-one-to-many association to an entity or entity mixin.
- betty.model.one_to_many(owner_attr_name, associate_type_name, associate_attr_name)[source]¶
Add a bidirectional one-to-many association to an entity or entity mixin.
- betty.model.one_to_one(owner_attr_name, associate_type_name, associate_attr_name)[source]¶
Add a bidirectional one-to-one association to an entity or entity mixin.
- betty.model.record_added(entities)[source]¶
Record all entities that are added to a collection.
- Parameters:¶
- entities¶
- Return type:¶
typing.Iterator[betty.model.MultipleTypesEntityCollection[typing.TypeVar(EntityT, bound=betty.model.Entity)]]
- betty.model.to_many(owner_attr_name, associate_type_name)[source]¶
Add a unidirectional to-many association to an entity or entity mixin.
- betty.model.to_one(owner_attr_name, associate_type_name)[source]¶
Add a unidirectional to-one association to an entity or entity mixin.