Structural model#
- class besser.BUML.metamodel.structural.structural.Association(name: str, ends: set[Property], timestamp: int = None, metadata: Metadata = None, is_derived: bool = False)[source]#
Bases:
NamedElement
Represents an association between classes.
An Association defines a relationship between classes and is composed of two or more ends, each associated with a class. An association must have more than one end.
- Parameters:
name (str) – The name of the association.
ends (set[Property]) – The set of ends related to the association.
timestamp (datetime) – Object creation datetime (default is current time).
metadata (Metadata) – Metadata information for the association (None as default).
is_derived (bool) – Inherited from NamedElement, indicates whether the element is derived (False as default).
- timestamp#
Inherited from NamedElement; object creation datetime (default is current time).
- Type:
datetime
- is_derived#
Inherited from NamedElement, indicates whether the element is derived (False as default).
- Type:
- _abc_impl = <_abc._abc_data object>#
- class besser.BUML.metamodel.structural.structural.AssociationClass(name: str, attributes: set[Property], association: Association, timestamp: int = None, metadata: Metadata = None, is_derived: bool = False)[source]#
Bases:
Class
An AssociationClass is a class that that has an association nature. It inherits from Class and is associated with an underlying Association.
- Parameters:
name (str) – The name of the association class.
attributes (set[Property]) – The set of attributes associated with the association class.
association (Association) – The underlying association linked to the association class.
timestamp (datetime) – Object creation datetime (default is current time).
metadata (Metadata) – Metadata information for the association class (None as default).
is_derived (bool) – Inherited from NamedElement, indicates whether the element is derived (False as default).
- attributes#
Inherited from Class, represents the set of attributes associated with the association class.
- association#
The underlying association linked to the association class.
- Type:
- timestamp#
Inherited from NamedElement; object creation datetime (default is current time).
- Type:
datetime
- is_derived#
Inherited from NamedElement, indicates whether the element is derived (False as default).
- Type:
- _abc_impl = <_abc._abc_data object>#
- property association: Association#
Get the underlying association of the association class.
- Type:
- class besser.BUML.metamodel.structural.structural.BehaviorDeclaration(name: str, implementations: set[BehaviorImplementation])[source]#
Bases:
NamedElement
A BehaviorDeclaration represents the signature of a behavior associated with a class.
- Parameters:
name (str) – The name of the behavior.
implementations (set[BehaviorImplementation]) – The implementations associated with the behavior.
- implementations#
The implementations associated with the behavior.
- Type:
- _abc_impl = <_abc._abc_data object>#
- property implementations: set[BehaviorImplementation]#
Get the implementations of the behavior.
- Type:
- class besser.BUML.metamodel.structural.structural.BehaviorImplementation(name: str)[source]#
Bases:
NamedElement
A behaviorImplementation represents the body of a behavior associated with a class.
- Parameters:
name (str) – The name of the behavior implementation.
- _abc_impl = <_abc._abc_data object>#
- class besser.BUML.metamodel.structural.structural.BinaryAssociation(name: str, ends: set[Property], timestamp: int = None, metadata: Metadata = None, is_derived: bool = False)[source]#
Bases:
Association
Represents a binary association between two classes.
A BinaryAssociation is a specialized form of Association that specifically involves two ends, each associated with a class. It enforces constraints on the association, such as having exactly two ends. Exactly two ends are required
- Parameters:
name (str) – The name of the binary association.
ends (set[Property]) – The set of ends related to the binary association.
timestamp (datetime) – Object creation datetime (default is current time).
metadata (Metadata) – Metadata information for the binary association (None as default).
is_derived (bool) – Inherited from NamedElement, indicates whether the element is derived (False as default).
- ends#
Inherited from NamedElement, represents the set of ends related to the binary association.
- timestamp#
Inherited from NamedElement; object creation datetime (default is current time).
- Type:
datetime
- is_derived#
Inherited from NamedElement, indicates whether the element is derived (False as default).
- Type:
- _abc_impl = <_abc._abc_data object>#
- class besser.BUML.metamodel.structural.structural.Class(name: str, attributes: set[Property] = None, methods: set[Method] = None, is_abstract: bool = False, is_read_only: bool = False, behaviors: set[BehaviorDeclaration] = None, timestamp: int = None, metadata: Metadata = None, is_derived: bool = False)[source]#
Bases:
Type
Represents a class in a modeling context.
A Class is a type that defines a blueprint for objects. It can have attributes, associations, and generalizations with other classes.
- Parameters:
name (str) – The name of the class.
attributes (set[Property]) – The set of attributes associated with the class (None as default).
methods (set[Method]) – The set of methods of the class (None as default).
is_abstract (bool) – Indicates whether the class is abstract (False as default).
is_read_only (bool) – Indicates whether the class is read only (False as default).
behaviors (set[BehaviorDeclaration]) – The set of behaviors associated with the class (None as default).
timestamp (datetime) – Object creation datetime (default is current time).
metadata (Metadata) – Metadata information for the class (None as default).
is_derived (bool) – Indicates whether the element is derived (False as default).
- behaviors#
The set of behaviors associated with the class (None as default).
- Type:
- behaviors#
The set of behaviors associated with the class (None as default).
- Type:
- timestamp#
Object creation datetime (default is current time).
- Type:
datetime
- is_derived#
Inherited from NamedElement, indicates whether the element is derived (False as default).
- Type:
- _abc_impl = <_abc._abc_data object>#
- _add_association(association)[source]#
Association: Add an association to the set of class associations.
- _add_generalization(generalization)[source]#
Generalization: Add a generalization to the set of class generalizations.
- _delete_association(association)[source]#
Association: Remove an association to the set of class associations.
- _delete_generalization(generalization)[source]#
Generalization: Remove a generalization to the set of class generalizations.
- add_attribute(attribute: Property)[source]#
Property: Add an attribute to the set of class attributes.
- Raises:
ValueError – if the attribute name already exist.
- add_method(method: Method)[source]#
Method: Add a method to the set of class methods.
- Raises:
ValueError – if the method name already exist.
- all_association_ends() set[Property] [source]#
set[Property]: Get the set of direct and indirect association ends of the class.
- all_attributes() set[Property] [source]#
set[Property]: Get all attributes, including inherited ones.
- all_specializations() set [source]#
set[Class]: Get the set of direct and indirect specializations (children) of the class.
- property behaviors: set[BehaviorDeclaration]#
Get the behaviors associated with the class.
- Type:
- class besser.BUML.metamodel.structural.structural.Constraint(name: str, context: Class, expression: Any, language: str, timestamp: int = None, metadata: Metadata = None, is_derived: bool = False)[source]#
Bases:
NamedElement
A Constraint is a statement that restricts or defines conditions on the behavior, structure, or other aspects of the modeled system.
- Parameters:
name (str) – The name of the constraint.
context (Class) – The class to which the constraint is associated.
expression (str) – The expression or condition defined by the constraint.
language (str) – The language in which the constraint expression is written.
timestamp (datetime) – Object creation datetime (default is current time).
metadata (Metadata) – Metadata information for the constraint (None as default).
is_derived (bool) – Inherited from NamedElement, indicates whether the element is derived (False as default).
- timestamp#
Inherited from NamedElement; object creation datetime (default is current time).
- Type:
datetime
- is_derived#
Inherited from NamedElement, indicates whether the element is derived (False as default).
- Type:
- _abc_impl = <_abc._abc_data object>#
- class besser.BUML.metamodel.structural.structural.DataType(name: str, timestamp: int = None, metadata: Metadata = None, is_derived: bool = False)[source]#
Bases:
Type
Represents a data type.
This class inherits from NamedElement and is used to model data types.
- Parameters:
- timestamp#
Inherited from NamedElement; object creation datetime (default is current time).
- Type:
datetime
- _abc_impl = <_abc._abc_data object>#
- class besser.BUML.metamodel.structural.structural.DomainModel(name: str, types: set[Type] = None, associations: set[Association] = None, generalizations: set[Generalization] = None, packages: set[Package] = None, constraints: set[Constraint] = None, timestamp: int = None, metadata: Metadata = None, is_derived: bool = False, elements: set[Element] = None)[source]#
Bases:
Model
A domain model comprises a number of types, associations, generalizations, packages, constraints, and others.
- Parameters:
name (str) – The name of the domain model.
types (set[Type]) – The set of types (classes and datatypes) in the domain model (set() as default).
associations (set[Association]) – The set of associations in the domain model (set() as default).
generalizations (set[Generalization]) – The set of generalizations in the domain model (set() as default).
packages (set[Package]) – The set of packages in the domain model (set() as default).
constraints (set[Constraint]) – The set of constraints in the domain model (set() as default).
timestamp (datetime) – Object creation datetime (default is current time).
metadata (Metadata) – Metadata information for the domain model (None as default).
is_derived (bool) – Inherited from NamedElement, indicates whether the element is derived (False as default).
elements (set[Element]) – Set of model Elements in the Model. This property is derived (auto-calculated).
- types#
The set of types (classes and datatypes) in the domain model (set() as default).
- associations#
The set of associations in the domain model (set() as default).
- Type:
- generalizations#
The set of generalizations in the domain model (set() as default).
- Type:
- constraints#
The set of constraints in the domain model (set() as default).
- Type:
- timestamp#
Inherited from NamedElement; object creation datetime (default is current time).
- Type:
datetime
- is_derived#
Inherited from NamedElement, indicates whether the element is derived (False as default).
- Type:
- elements#
Set of model Elements in the Model. This property is derived (auto-calculated).
- _abc_impl = <_abc._abc_data object>#
- add_association(association: Association)[source]#
Association: Add an association to the set of associations of the model.
- add_generalization(generalization: Generalization)[source]#
Generalization: Add a generalization to the set of generalizations of the model.
- add_type(type_: Type)[source]#
Type: Add a type (Class or DataType) to the set of types of the model.
- property associations: set[Association]#
Get the set of associations in the domain model.
- Type:
- classes_sorted_by_inheritance() list[Class] [source]#
list[Class]: Get the list of classes ordered by inheritance.
- property constraints: set[Constraint]#
Get the set of constraints in the domain model.
- Type:
- property generalizations: set[Generalization]#
Get the set of generalizations in the domain model.
- Type:
- get_enumerations() set[Enumeration] [source]#
set[Enumeration]: Get the set of enumerations in the domain model.
- class besser.BUML.metamodel.structural.structural.Element(timestamp: datetime = None, is_derived: bool = False)[source]#
Bases:
ABC
Element is the Superclass of all structural model elements.
- Parameters:
timestamp (datetime) – Object creation datetime (default is current time).
is_derived (bool) – Indicates whether the element is derived (False as default).
- timestamp#
Object creation datetime (default is current time).
- Type:
datetime
- _abc_impl = <_abc._abc_data object>#
- class besser.BUML.metamodel.structural.structural.Enumeration(name: str, literals: set[EnumerationLiteral] = None, timestamp: int = None, metadata: Metadata = None)[source]#
Bases:
DataType
Class representing an enumeration.
This class is a subclass of DataType and is used to represent enumerations with a specified name and a set of enumeration literals.
- Parameters:
name (str) – The name of the enumeration data type.
literals (set[EnumerationLiteral]) – Set of enumeration literals associated with the enumeration (None as default).
timestamp (datetime) – Object creation datetime (default is current time).
metadata (Metadata) – Metadata information for the enumeration (None as default).
- literals#
Represents a set of enumeration literals associated with the enumeration (None as default).
- Type:
- timestamp#
Inherited from NamedElement; object creation datetime (default is current time).
- Type:
datetime
- _abc_impl = <_abc._abc_data object>#
- add_literal(literal: EnumerationLiteral)[source]#
Add an enumeration literal to the set.
- Raises:
ValueError – if the enumeration literal name already exist.
- property literals: set[EnumerationLiteral]#
Get the set of literals.
- Type:
- class besser.BUML.metamodel.structural.structural.EnumerationLiteral(name: str, owner: DataType = None, timestamp: int = None, metadata: Metadata = None)[source]#
Bases:
NamedElement
Class representing an enumeration literal.
This class is a subclass of NamedElement and is used to represent individual literals within an enumeration.
- Parameters:
- timestamp#
Inherited from NamedElement; object creation datetime (default is current time).
- Type:
datetime
- _abc_impl = <_abc._abc_data object>#
- class besser.BUML.metamodel.structural.structural.Generalization(general: Class, specific: Class, timestamp: int = None, is_derived: bool = False)[source]#
Bases:
Element
Represents a generalization relationship between two classes.
A Generalization is a relationship between two classes, where one class (specific) inherits attributes and behaviors from another class (general).
- Parameters:
general (Class) – The general (parent) class in the generalization relationship.
specific (Class) – The specific (child) class in the generalization relationship.
timestamp (datetime) – Object creation datetime (default is current time).
is_derived (bool) – Inherited from NamedElement, indicates whether the element is derived (False as default).
- timestamp#
Inherited from NamedElement; object creation datetime (default is current time).
- Type:
datetime
- is_derived#
Inherited from NamedElement, indicates whether the element is derived (False as default).
- Type:
- _abc_impl = <_abc._abc_data object>#
- class besser.BUML.metamodel.structural.structural.GeneralizationSet(name: str, generalizations: set[Generalization], is_disjoint: bool, is_complete: bool, timestamp: int = None, metadata: Metadata = None, is_derived: bool = False)[source]#
Bases:
NamedElement
Represents a set of generalization relationships.
- Parameters:
name (str) – The name of the generalization set.
generalizations (set[Generalization]) – The set of generalization relationships in the set.
is_disjoint (bool) – Indicates whether the set is disjoint (instances cannot belong to more than one class in the set).
is_complete (bool) – Indicates whether the set is complete (every instance of the superclass must belong to a subclass).
timestamp (datetime) – Object creation datetime (default is current time).
metadata (Metadata) – Metadata information for the generalization set (None as default).
is_derived (bool) – Inherited from NamedElement, indicates whether the element is derived (False as default).
- generalizations#
The set of generalization relationships in the set.
- Type:
- is_disjoint#
Indicates whether the set is disjoint (instances cannot belong to more than one class in the set).
- Type:
- is_complete#
Indicates whether the set is complete (every instance of the superclass must belong to a subclass).
- Type:
- timestamp#
Inherited from NamedElement; object creation datetime (default is current time).
- Type:
datetime
- is_derived#
Inherited from NamedElement, indicates whether the element is derived (False as default).
- Type:
- _abc_impl = <_abc._abc_data object>#
- property generalizations: set[Generalization]#
Get the generalization relationships.
- Type:
- class besser.BUML.metamodel.structural.structural.Metadata(description: str = None, uri: str = None, synonyms: List[str] = None, timestamp: datetime = None)[source]#
Bases:
Element
The Metadata class stores additional information about named elements.
- Parameters:
- timestamp#
Object creation datetime (default is current time).
- Type:
datetime
- _abc_impl = <_abc._abc_data object>#
- class besser.BUML.metamodel.structural.structural.Method(name: str, visibility: str = 'public', is_abstract: bool = False, parameters: set[Parameter] = None, type: Type = None, owner: Type = None, code: str = '', timestamp: int = None, metadata: Metadata = None, is_derived: bool = False)[source]#
Bases:
TypedElement
Method is used to represent a method of a class.
- Parameters:
name (str) – The name of the method.
visibility (str) – Determines the kind of visibility of the method (public as default).
is_abstract (bool) – Indicates if the method is abstract (False as default).
parameters (set[Parameter]) – The set of parameters for the method (set() as default).
type (Type) – The type of the method (None as default).
owner (Type) – The type that owns the method (None as default).
code (str) – code of the method (”” as default).
timestamp (datetime) – Object creation datetime (default is current time).
metadata (Metadata) – Metadata information for the method (None as default).
is_derived (bool) – Inherited from NamedElement, indicates whether the element is derived (False as default).
- visibility#
Inherited from TypedElement, represents the visibility of the method (public as default).
- Type:
- timestamp#
Inherited from NamedElement; object creation datetime (default is current time).
- Type:
datetime
- is_derived#
Inherited from NamedElement, indicates whether the element is derived (False as default).
- Type:
- _abc_impl = <_abc._abc_data object>#
- add_parameter(parameter: Parameter)[source]#
Parameter: Add a parameter to the set of class parameters.
- Raises:
ValueError – if the parameter name already exist.
- class besser.BUML.metamodel.structural.structural.Model(name: str, timestamp: int = None, metadata: Metadata = None, is_derived: bool = False, elements: set[Element] = None)[source]#
Bases:
NamedElement
A model is the root element. A model is the root element. There are different types of models that inherit from this class. For example, DomainModel, ObjectModel, or GUIModel.
- Parameters:
name (str) – The name of the model.
timestamp (datetime) – Object creation datetime (default is current time).
metadata (Metadata) – Metadata information for the model (None as default).
is_derived (bool) – Inherited from NamedElement, indicates whether the element is derived (False as default).
elements (set[Element]) – Set of model Elements in the Model.
- timestamp#
Inherited from NamedElement; object creation datetime (default is current time).
- Type:
datetime
- is_derived#
Inherited from NamedElement, indicates whether the element is derived (False as default).
- Type:
- _abc_impl = <_abc._abc_data object>#
- class besser.BUML.metamodel.structural.structural.Multiplicity(min_multiplicity: int, max_multiplicity: int, is_derived: bool = False)[source]#
Bases:
Element
Represents the multiplicity of a Property.
It consists of a minimum and maximum value, indicating the allowed range.
- Parameters:
- max#
The maximum multiplicity. Use “*” for unlimited. is_derived (bool): Inherited from NamedElement, indicates whether the element is derived (False as default).
- Type:
- _abc_impl = <_abc._abc_data object>#
- class besser.BUML.metamodel.structural.structural.NamedElement(name: str, timestamp: datetime = None, metadata: Metadata = None, visibility: str = 'public', is_derived: bool = False)[source]#
Bases:
Element
NamedElement represent a structural element with a name.
- Parameters:
name (str) – The name of the named element
timestamp (datetime) – Object creation datetime (default is current time).
metadata (Metadata) – Metadata information for the named element (None as default).
visibility (str) – Determines the kind of visibility of the named element (public as default).
is_derived (bool) – Indicates whether the element is derived (False as default).
- timestamp#
Object creation datetime (default is current time).
- Type:
datetime
- visibility#
Determines the kind of visibility of the named element (public as default).
- _abc_impl = <_abc._abc_data object>#
- class besser.BUML.metamodel.structural.structural.Package(name: str, elements: set[NamedElement], timestamp: int = None, metadata: Metadata = None, is_derived: bool = False)[source]#
Bases:
NamedElement
A Package is a grouping mechanism that allows organizing and managing a set of NamedElements.
- elements#
The set of elements contained in the package.
- Type:
- timestamp#
Object creation datetime (default is current time).
- Type:
datetime
- is_derived#
Inherited from NamedElement, indicates whether the element is derived (False as default).
- Type:
- elements#
The set of elements contained in the package.
- Type:
- timestamp#
Inherited from NamedElement; object creation datetime (default is current time).
- Type:
datetime
- is_derived#
Inherited from NamedElement, indicates whether the element is derived (False as default).
- Type:
- _abc_impl = <_abc._abc_data object>#
- property elements: set[NamedElement]#
Get the named elements contained in the package.
- Type:
- get_associations() set[Association] [source]#
set[Association]: Get all associations within the package.
- get_enumerations() set[Enumeration] [source]#
set[Enumeration]: Get all enumerations within the package.
- get_generalizations() set[Generalization] [source]#
set[Generalization]: Get all generalizations within the package.
- class besser.BUML.metamodel.structural.structural.Parameter(name: str, type: Type, default_value: Any = None, timestamp: int = None, metadata: Metadata = None, is_derived: bool = False)[source]#
Bases:
TypedElement
Parameter is used to represent a parameter of a method with a specific type.
- Parameters:
name (str) – The name of the parameter.
type (Type) – The data type of the parameter.
default_value (Any) – The default value of the parameter (None as default).
timestamp (datetime) – Object creation datetime (default is current time).
metadata (Metadata) – Metadata information for the parameter (None as default).
is_derived (bool) – Inherited from NamedElement, indicates whether the element is derived (False as default).
- default_value#
The default value of the parameter (None as default).
- Type:
Any
- timestamp#
Inherited from NamedElement; object creation datetime (default is current time).
- Type:
datetime
- _abc_impl = <_abc._abc_data object>#
- class besser.BUML.metamodel.structural.structural.PrimitiveDataType(name: str, timestamp: int = None, metadata: Metadata = None, is_derived: bool = False)[source]#
Bases:
DataType
Class representing a primitive data type.
This class is a subclass of DataType and is used to represent primitive data types with a specified name.
- Parameters:
- timestamp#
Inherited from NamedElement; object creation datetime (default is current time).
- Type:
datetime
- _abc_impl = <_abc._abc_data object>#
- class besser.BUML.metamodel.structural.structural.Property(name: str, type: Type, owner: Type = None, multiplicity: Multiplicity = Multiplicity(1, 1, is_derived=False), visibility: str = 'public', is_composite: bool = False, is_navigable: bool = True, is_id: bool = False, is_read_only: bool = False, timestamp: int = None, metadata: Metadata = None, is_derived: bool = False)[source]#
Bases:
TypedElement
A property can represents an attribute of a class or an end of an association.
Properties are owned by a class or an association.
- Parameters:
name (str) – The name of the property.
type (Type) – The type of the property.
owner (Type) – The type that owns the property (None as default).
multiplicity (Multiplicity) – The multiplicity of the property (1..1 as default).
visibility (str) – The visibility of the property (public as default).
is_composite (bool) – Indicates whether the property is a composite (False as default).
is_navigable (bool) – Indicates whether the property is navigable in a relationship (True as default).
is_id (bool) – Indicates whether the property is an id (False as default).
is_read_only (bool) – Indicates whether the property is read only (False as default).
timestamp (datetime) – Object creation datetime (default is current time).
metadata (Metadata) – Metadata information for the property (None as default). is_derived (bool): Inherited from NamedElement, indicates whether the element is derived (False as default).
- multiplicity#
The multiplicity of the property (1..1 as default).
- Type:
- visibility#
Inherited from TypedElement, represents the visibility of the property (public as default).
- Type:
Indicates whether the property is navigable in a relationship (True as default).
- Type:
- timestamp#
Inherited from NamedElement; object creation datetime (default is current time).
- Type:
datetime
- is_derived#
Inherited from NamedElement, indicates whether the element is derived (False as default).
- Type:
- _abc_impl = <_abc._abc_data object>#
- property multiplicity: Multiplicity#
Get the multiplicity of the property.
- Type:
- class besser.BUML.metamodel.structural.structural.Type(name: str, timestamp: int = None, metadata: Metadata = None, is_derived: bool = False)[source]#
Bases:
NamedElement
Type is the Superclass of classes and data types in the model.
- Parameters:
- timestamp#
Inherited from NamedElement; object creation datetime (default is current time).
- Type:
datetime
- _abc_impl = <_abc._abc_data object>#
- class besser.BUML.metamodel.structural.structural.TypedElement(name: str, type: Type | str, timestamp: int = None, metadata: Metadata = None, visibility: str = 'public', is_derived: bool = False)[source]#
Bases:
NamedElement
TypedElement is a subclass of NamedElement and is used to represent elements that have a specific type.
- Parameters:
name (str) – The name of the typed element.
timestamp (datetime) – Object creation datetime (default is current time).
metadata (Metadata) – Metadata information for the typed element (None as default).
visibility (str) – Determines the kind of visibility of the typed element (public as default).
is_derived (bool) – Indicates whether the element is derived (False as default).
- timestamp#
Inherited from NamedElement; object creation datetime (default is current time).
- Type:
datetime
- visibility#
Inherited from NamedElement, represents the visibility of the typed element (public as default).
- Type:
- is_derived#
Inherited from NamedElement, indicates whether the element is derived (False as default).
- Type:
- _abc_impl = <_abc._abc_data object>#
- type_mapping = {'bool': PrimitiveDataType(bool, 2025-06-10 12:16:53.990546, None), 'date': PrimitiveDataType(date, 2025-06-10 12:16:53.990558, None), 'datetime': PrimitiveDataType(datetime, 2025-06-10 12:16:53.990564, None), 'float': PrimitiveDataType(float, 2025-06-10 12:16:53.990540, None), 'int': PrimitiveDataType(int, 2025-06-10 12:16:53.990531, None), 'str': PrimitiveDataType(str, 2025-06-10 12:16:53.990493, None), 'string': PrimitiveDataType(str, 2025-06-10 12:16:53.990493, None), 'time': PrimitiveDataType(time, 2025-06-10 12:16:53.990552, None), 'timedelta': PrimitiveDataType(timedelta, 2025-06-10 12:16:53.990573, None)}#