Author

This module contains a basic Author Model

class loglan_core.author.BaseAuthor(abbreviation, full_name, notes)[source]

Bases: BaseModel

Base Author’s Database Model.

This class represents an author in the database, encapsulating the attributes and relationships associated with authors of words. It serves as a foundational model for managing author data, including their abbreviations, full names, and any additional notes.

The BaseAuthor class establishes a many-to-many relationship with the BaseWord class through the t_connect_authors association table, allowing for efficient querying and management of authors and their contributions to various words.

Key Features:
  • Supports unique abbreviations for each author.

  • Allows optional full names and notes for additional context.

  • Facilitates relationships with words, enabling easy access to all words associated with a given author.

Examples

{
    'id': 13, 'full_name': 'James Cooke Brown',
    'abbreviation': 'JCB', 'notes': ''
},
{
    'id': 29, 'full_name': 'Loglan 4&5', 'abbreviation': 'L4',
    'notes': 'The printed-on-paper book, 1975 version of the dictionary.'
 }
abbreviation

A unique abbreviation for the author.

Type:

Mapped[str_064]

full_name

The full name of the author, if available.

Type:

Mapped[str_064 | None]

notes

Additional notes about the author.

Type:

Mapped[str_128 | None]

contribution

A list of words associated with the author.

Type:

Mapped[list[BaseWord]]

__str__()[source]

Returns a string representation of the BaseAuthor instance.

Returns:

A string representing the instance with class name, author’s ID (if available), and abbreviation.

Return type:

str

abbreviation: Mapped[str_064]

The abbreviation for the author, used in the LOD.

This field is required and must be unique for each author. It helps in identifying the author in various contexts, including databases and references.

  • Type: str_064

  • Max Length: 64 characters

  • Nullable: False (this field cannot be empty)

  • Unique: True (no two authors can have the same abbreviation)

Examples

  • JCB: Abbreviation for James Cooke Brown

  • L4: Abbreviation for Loglan 4&5

contribution: Mapped[list[BaseWord]]

Establishes a many-to-many relationship between the author and their associated words.

This attribute connects the BaseAuthor to multiple BaseWord instances through the t_connect_authors secondary table. This relationship allows for efficient querying of all words associated with a given author.

  • Type: Mapped[list[BaseWord]]

  • Relationship: Many-to-many (an author can contribute to multiple words,

and a word can have multiple authors) - Back Population: This relationship is bidirectional, allowing access to the authors from the words.

Returns:

A list of BaseWord instances that are associated with the current author instance.

Return type:

Mapped[list[BaseWord]]

created: Mapped[datetime]

A class attribute mapped to a column in the database table. It represents the timestamp when a row is created. The default value is the current timestamp, and it can’t be null.

Type:

datetime

full_name: Mapped[str_064 | None]

The full name of the author, if available.

This field is optional and can be left empty if the author’s full name is not known. It provides additional context about the author and can be used in various references.

  • Type: str_064 | None

  • Max Length: 64 characters

  • Nullable: True (this field can be empty)

  • Unique: False (multiple authors can have the same full name)

Examples

  • James Cooke Brown: Full name of the author known for his contributions to linguistics.

  • Loglan 4&5: Full name associated with the Loglan language.

id: Mapped[int]

A class attribute mapped to a column in the database table. It serves as the primary key for the table.

Type:

int

notes: Mapped[str_128 | None]

Additional information or notes about the author, if available.

This field is optional and can be used to provide any relevant details or context about the author that may not be captured in other fields. It can be left empty if no additional information is provided.

  • Type: str_128 | None

  • Max Length: 128 characters

  • Nullable: True (this field can be empty)

  • Unique: False (multiple authors can have the same notes)

Examples

  • Notable linguist with contributions to Loglan.:

A brief note about the author’s significance. - Authors of the 1975 version of the dictionary.: Additional context regarding the author’s work.

updated: Mapped[datetime | None]

A class attribute mapped to a column in the database table. It represents the timestamp when a row is last updated. Whenever the row is updated, this timestamp is automatically set to the current time. It can be null if the row has never been updated.

Type:

datetime