betty.entity package

Subpackages

Module contents

Provide Betty’s data model API.

class betty.entity.Entity

Bases: LinkedDataDumpableWithSchemaJsonLdObject, DataPlugin[EntityDefinition], HasPrivacy

An entity is a uniquely identifiable data container.

To test your own subclasses, use betty.test_utils.entity.EntityTestBase.

__init__(*args: Any, id: ResolvableMachineName | None = None, privacy: Privacy = Privacy.UNDETERMINED, **kwargs: Any)
final classmethod associations() Iterable[Association[Self]]

Get all associations on entities of this type.

async dump_linked_data(project: Project, /) PortableMapping

Dump this instance to JSON-LD.

id: Final[MachineName]

The entity ID.

This MUST be unique per entity type, per ancestry.

property label: Localizable

The entity’s human-readable label.

async classmethod linked_data_schema(project: Project, /) JsonLdObject

Define the JSON Schema for betty.linked_data.LinkedDataDumpable.dump_linked_data().

final class betty.entity.EntityDefinition

Bases: CountableHumanFacingDefinition, ObjectDefinition, DataPluginDefinition, Generic

The entity plugin type. Entities represent the information in your ancestry, such as people and places.

Plugin type ID

entity

Definition

@EntityDefinition(...)

Built-in entities:

citation (Citation)
Citation
enclosure (Enclosure)
Enclosure
event (Event)
Event
file (File)
File
file-reference (FileReference)
File reference
link (Link)
Link
note (Note)
Note
person (Person)
Person
person-name (PersonName)
Person name
place (Place)
Place
place-name (PlaceName)
Place name
presence (Presence)
Presence: A person's presence at an event.
source (Source)
Source
__init__(plugin_id: ResolvableMachineName, *, label: ResolvableLocalizable, label_plural: ResolvableLocalizable, label_countable: CountableLocalizable, auto: bool = True, description: ResolvableLocalizable | None = None, public_facing: bool = True, requires: Requires = ())
public_facing: Final[bool]

Whether entities of this type are public-facing.

static type() PluginTypeDefinition[Self]

The plugin type definition.

betty.entity.resolve(project: Project, entity: ResolvableEntity[EntityT], /) EntityT

Resolve an entity or entity resolver to its entity.