trilium_alchemy.core.attribute#

Class index#

Canonical

Attribute

Encapsulates an attribute, a key-value record attached to a note.

Label

Encapsulates a label.

Relation

Encapsulates a relation.

Symbols#

class trilium_alchemy.core.attribute.Attribute(name: str, inheritable: bool = False, **kwargs)#

Bases:

trilium_alchemy.core.entity.Entity
abc.ABC

Aliases:

trilium_alchemy.Attribute
trilium_alchemy.core.Attribute

Encapsulates an attribute, a key-value record attached to a note.

Can’t be instantiated directly; use Label or Relation concrete classes.

Once instantiated, the attribute needs to be added to a Note. See the documentation of Note.attributes for details.

Note

Value is accessed differently depending on the concrete class:

attribute_id: str#

EntityIdDescriptor()

Read-only access to attributeId.

name: str#

ReadOnlyDescriptor()

Read-only access to attribute name.

inheritable: bool#

FieldDescriptor()

Whether this attribute is inherited to children and by template/inherit relations.

utc_date_modified: str#

ReadOnlyFieldDescriptor()

UTC modified datetime, e.g. 2021-12-31 19:18:11.939Z.

note: note#

ReadOnlyDescriptor()

Read-only access to note which owns this attribute.

position#

ReadOnlyDescriptor()

Read-only access to position of this attribute.

Note

This is maintained automatically based on the order of this attribute in its note’s Note.attributes list.

attribute_type: str#

None

Type of attribute, to be populated by subclass.

property state: State#

Inherited from: trilium_alchemy.core.entity.Entity

Current state.

property session: Session#

Inherited from: trilium_alchemy.core.entity.Entity

Session to which this entity belongs.

property str_short: str#

Inherited from: trilium_alchemy.core.entity.Entity

Get a short description of this entity.

property str_summary: str#

Inherited from: trilium_alchemy.core.entity.Entity

Get a summary of this entity, including its current state and model values.

flush() None#

Inherited from: trilium_alchemy.core.entity.Entity

Commit changes to Trilium for this entity and its dependencies.

invalidate() None#

Inherited from: trilium_alchemy.core.entity.Entity

Discard cached contents and user-provided data for this object. Upon next access, data will be fetched from Trilium.

delete() None#

Inherited from: trilium_alchemy.core.entity.Entity

Mark this entity for pending delete.

class trilium_alchemy.core.attribute.Label(name: str, value: str = '', inheritable: bool = False, session: Session = None, **kwargs)#
Parameters:
name: str

Label name

value: str = ''

Label value, or empty string

inheritable: bool = False

Whether attribute is inherited to children

session: Session = None

Session, or None to use default

Bases:

trilium_alchemy.core.attribute.Attribute

Aliases:

trilium_alchemy.Label
trilium_alchemy.core.Label

Encapsulates a label.

Once instantiated, the label needs to be added to a Note. See the documentation of Note.attributes for details.

value: str#

FieldDescriptor()

Label value, or empty string

attribute_type: str#

"label"

attribute_id: str#

EntityIdDescriptor()

Inherited from: trilium_alchemy.core.attribute.Attribute

Read-only access to attributeId.

name: str#

ReadOnlyDescriptor()

Inherited from: trilium_alchemy.core.attribute.Attribute

Read-only access to attribute name.

inheritable: bool#

FieldDescriptor()

Inherited from: trilium_alchemy.core.attribute.Attribute

Whether this attribute is inherited to children and by template/inherit relations.

utc_date_modified: str#

ReadOnlyFieldDescriptor()

Inherited from: trilium_alchemy.core.attribute.Attribute

UTC modified datetime, e.g. 2021-12-31 19:18:11.939Z.

note: note#

ReadOnlyDescriptor()

Inherited from: trilium_alchemy.core.attribute.Attribute

Read-only access to note which owns this attribute.

position#

ReadOnlyDescriptor()

Inherited from: trilium_alchemy.core.attribute.Attribute

Read-only access to position of this attribute.

Note

This is maintained automatically based on the order of this attribute in its note’s Note.attributes list.

property state: State#

Inherited from: trilium_alchemy.core.entity.Entity

Current state.

property session: Session#

Inherited from: trilium_alchemy.core.entity.Entity

Session to which this entity belongs.

property str_short: str#

Inherited from: trilium_alchemy.core.entity.Entity

Get a short description of this entity.

property str_summary: str#

Inherited from: trilium_alchemy.core.entity.Entity

Get a summary of this entity, including its current state and model values.

flush() None#

Inherited from: trilium_alchemy.core.entity.Entity

Commit changes to Trilium for this entity and its dependencies.

invalidate() None#

Inherited from: trilium_alchemy.core.entity.Entity

Discard cached contents and user-provided data for this object. Upon next access, data will be fetched from Trilium.

delete() None#

Inherited from: trilium_alchemy.core.entity.Entity

Mark this entity for pending delete.

class trilium_alchemy.core.attribute.Relation(name: str, target: Note, inheritable: bool = False, session: Session | None = None, **kwargs)#
Parameters:
name: str

Relation name

target: Note

Target note

inheritable: bool = False

Whether attribute is inherited to children

session: Session | None = None

Session, or None to use default

Bases:

trilium_alchemy.core.attribute.Attribute

Aliases:

trilium_alchemy.Relation
trilium_alchemy.core.Relation

Encapsulates a relation.

Once instantiated, the relation needs to be added to a Note. See the documentation of Note.attributes for details.

target: Note#

WriteThroughDescriptor()

Target note of this relation.

attribute_type: str#

"relation"

attribute_id: str#

EntityIdDescriptor()

Inherited from: trilium_alchemy.core.attribute.Attribute

Read-only access to attributeId.

name: str#

ReadOnlyDescriptor()

Inherited from: trilium_alchemy.core.attribute.Attribute

Read-only access to attribute name.

inheritable: bool#

FieldDescriptor()

Inherited from: trilium_alchemy.core.attribute.Attribute

Whether this attribute is inherited to children and by template/inherit relations.

utc_date_modified: str#

ReadOnlyFieldDescriptor()

Inherited from: trilium_alchemy.core.attribute.Attribute

UTC modified datetime, e.g. 2021-12-31 19:18:11.939Z.

note: note#

ReadOnlyDescriptor()

Inherited from: trilium_alchemy.core.attribute.Attribute

Read-only access to note which owns this attribute.

position#

ReadOnlyDescriptor()

Inherited from: trilium_alchemy.core.attribute.Attribute

Read-only access to position of this attribute.

Note

This is maintained automatically based on the order of this attribute in its note’s Note.attributes list.

property state: State#

Inherited from: trilium_alchemy.core.entity.Entity

Current state.

property session: Session#

Inherited from: trilium_alchemy.core.entity.Entity

Session to which this entity belongs.

property str_short: str#

Inherited from: trilium_alchemy.core.entity.Entity

Get a short description of this entity.

property str_summary: str#

Inherited from: trilium_alchemy.core.entity.Entity

Get a summary of this entity, including its current state and model values.

flush() None#

Inherited from: trilium_alchemy.core.entity.Entity

Commit changes to Trilium for this entity and its dependencies.

invalidate() None#

Inherited from: trilium_alchemy.core.entity.Entity

Discard cached contents and user-provided data for this object. Upon next access, data will be fetched from Trilium.

delete() None#

Inherited from: trilium_alchemy.core.entity.Entity

Mark this entity for pending delete.