Structural model#

class besser.BUML.metamodel.structural.structural.Association(name: str, ends: set[Property])[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.

name#

Inherited from NamedElement, represents the name of the association.

Type:

str

ends#

The set of ends related to the association.

Type:

set[Property]

_abc_impl = <_abc._abc_data object>#
property ends: set[Property]#

Get the ends of the association.

Type:

set[Property]

class besser.BUML.metamodel.structural.structural.AssociationClass(name: str, attributes: set[Property], association: Association)[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.

name#

Inherited from Class, represents the name of the association class.

Type:

str

attributes#

Inherited from Class, represents the set of attributes associated with the association class.

Type:

set[Property]

association#

The underlying association linked to the association class.

Type:

Association

_abc_impl = <_abc._abc_data object>#
property association: Association#

Get the underlying association of the association class.

Type:

Association

class besser.BUML.metamodel.structural.structural.BinaryAssociation(name: str, ends: set[Property])[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.

name#

Inherited from Association, represents the name of the binary association.

Type:

str

ends#

Inherited from NamedElement, represents the set of ends related to the binary association.

Type:

set[Property]

_abc_impl = <_abc._abc_data object>#
property ends: set[Property]#

Get the ends of the association.

Type:

set[Property]

class besser.BUML.metamodel.structural.structural.Class(name: str, attributes: set[Property], is_abstract: bool = False, is_read_only: 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.

  • is_abstract (bool) – Indicates whether the class is abstract.

  • is_read_only (bool) – Indicates whether the class is read only.

name#

Inherited from Type, represents the name of the class.

Type:

str

attributes#

The set of attributes associated with the class.

Type:

set[Property]

is_abstract#

Indicates whether the class is abstract.

Type:

bool

is_read_only#

Indicates whether the class is read only.

Type:

bool

__associations#

Set of associations involving the class.

Type:

set[Association]

__generalizations#

Set of generalizations involving the class.

Type:

set[Generalization]

_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.

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_parents() set[source]#

set[Class]: Get the set of direct and indirect parents of the class.

all_specializations() set[source]#

set[Class]: Get the set of direct and indirect specializations (children) of the class.

association_ends() set[source]#

set[Property]: Get the set of association ends of the class.

property associations: set#

Get the set of associations involving the class.

Type:

set[Association]

property attributes: set[Property]#

Get the attributes of the class.

Type:

set[Property]

property generalizations: set#

Get the set of generalizations involving the class.

Type:

set[Generalization]

id_attribute() Property[source]#

Property: Get the id attribute of the class.

inherited_attributes() set[Property][source]#

set[Property]: Get the set of inherited attributes.

property is_abstract: bool#

Get wheter the class is abstract.

Type:

bool

property is_read_only: bool#

Get wheter the class is read only.

Type:

bool

parents() set[source]#

set[Class]: Get the set of direct parents of the class.

specializations() set[source]#

set[Class]: Get the set of direct specializations (children) of the class.

class besser.BUML.metamodel.structural.structural.Constraint(name: str, context: Class, expression: Any, language: str)[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.

name#

Inherited from NamedElement, represents the name of the constraint.

Type:

str

context#

The class to which the constraint is associated.

Type:

Class

expression#

The expression or condition defined by the constraint.

Type:

str

language#

The language in which the constraint expression is written.

Type:

str

_abc_impl = <_abc._abc_data object>#
property context: Class#

Get the class to which the constraint is associated.

Type:

Class

property expression: str#

Get the expression or condition defined by the constraint.

Type:

str

property language: str#

Get the language in which the constraint expression is written.

Type:

str

class besser.BUML.metamodel.structural.structural.DataType(name: str)[source]#

Bases: Type

Represents a data type.

This class inherits from NamedElement and is used to model data types.

Parameters:

name (str) – The name of the data type.

name#

Inherited from NamedElement, represents the name of the data type.

Type:

str

_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, enumerations: set[Enumeration] = None, packages: set[Package] = None, constraints: set[Constraint] = 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.

  • associations (set[Association]) – The set of associations in the domain model.

  • generalizations (set[Generalization]) – The set of generalizations in the domain model.

  • enumerations (set[Enumeration]) – The set of enumerations in the domain model.

  • packages (set[Package]) – The set of packages in the domain model.

  • constraints (set[Constraint]) – The set of constraints in the domain model.

name#

Inherited from NamedElement, represents the name of the domain model.

Type:

str

types#

The set of types (classes and datatypes) in the domain model.

Type:

set[Type]

associations#

The set of associations in the domain model.

Type:

set[Association]

generalizations#

The set of generalizations in the domain model.

Type:

set[Generalization]

enumerations#

The set of enumerations in the domain model.

Type:

set[Enumeration]

packages#

The set of packages in the domain model.

Type:

set[Package]

constraints#

The set of constraints in the domain model.

Type:

set[Constraint]

_abc_impl = <_abc._abc_data object>#
property associations: set[Association]#

Get the set of associations in the domain model.

Type:

set[Association]

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:

set[Constraint]

property enumerations: set[Enumeration]#

Get the set of enumerations in the domain model.

Type:

set[Enumeration]

property generalizations: set[Generalization]#

Get the set of generalizations in the domain model.

Type:

set[Generalization]

get_class_by_name(class_name: str) Class[source]#

Class: Gets a class by name.

get_classes() set[Class][source]#

set[Class]: Get all classes within the domain model.

property packages: set[Package]#

Get the set of packages in the domain model.

Type:

set[Package]

property types: set[Type]#

Get the set of types in the domain model.

Type:

set[Type]

class besser.BUML.metamodel.structural.structural.Element[source]#

Bases: ABC

_abc_impl = <_abc._abc_data object>#
class besser.BUML.metamodel.structural.structural.Enumeration(name: str, literals: set[EnumerationLiteral])[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.

name#

Inherited from DataType, represents the name of the enumeration.

Type:

str

literals#

Represents a set of enumeration literals associated with the enumeration.

Type:

set[EnumerationLiteral]

_abc_impl = <_abc._abc_data object>#
property literals: set[EnumerationLiteral]#

Get the set of literals.

Type:

set[EnumerationLiteral]

class besser.BUML.metamodel.structural.structural.EnumerationLiteral(name: str, owner: DataType)[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:
  • name (str) – the name of the enumeration literal.

  • owner (DataType) – the owner data type of the enumeration literal.

name#

Inherited from NamedElement, represents the name of the enumeration literal.

Type:

str

owner#

Represents the owner data type of the enumeration literal.

Type:

DataType

_abc_impl = <_abc._abc_data object>#
property owner: DataType#

Get the owner.

Type:

Datatype

class besser.BUML.metamodel.structural.structural.Generalization(general: Class, specific: Class)[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.

general#

The general (parent) class in the generalization relationship.

Type:

Class

specific#

The specific (child) class in the generalization relationship.

Type:

Class

_abc_impl = <_abc._abc_data object>#
property general: Class#

Get the general (parent) class.

Type:

Class

property specific: Class#

Get the specific (child) class.

Type:

Class

class besser.BUML.metamodel.structural.structural.GeneralizationSet(name: str, generalizations: set[Generalization], is_disjoint: bool, is_complete: bool)[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).

name#

Inherited from NamedElement, represents the name of the generalization set.

Type:

str

generalizations#

The set of generalization relationships in the set.

Type:

set[Generalization]

is_disjoint#

Indicates whether the set is disjoint (instances cannot belong to more than one class in the set).

Type:

bool

is_complete#

Indicates whether the set is complete (every instance of the superclass must belong to a subclass).

Type:

bool

_abc_impl = <_abc._abc_data object>#
property generalizations: set[Generalization]#

Get the generalization relationships.

Type:

set[Generalization]

property is_complete: bool#

Get whether the set is complete.

Type:

bool

property is_disjoint: bool#

Get whether the set is disjoint.

Type:

bool

class besser.BUML.metamodel.structural.structural.Model(name: str)[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.

name#

Inherited from NamedElement, represents the name of the model.

Type:

str

_abc_impl = <_abc._abc_data object>#
class besser.BUML.metamodel.structural.structural.Multiplicity(min_multiplicity: int, max_multiplicity: int)[source]#

Bases: object

Represents the multiplicity of a Property.

It consists of a minimum and maximum value, indicating the allowed range.

Parameters:
  • min_multiplicity (int) – The minimum multiplicity.

  • max_multiplicity (int) – The maximum multiplicity. Use “*” for unlimited.

min#

The minimum multiplicity.

Type:

int

max#

The maximum multiplicity. Use “*” for unlimited.

Type:

int

property max: int#

Get the maximum multiplicity.

Type:

int

property min: int#

Get the minimum multiplicity.

Type:

int

class besser.BUML.metamodel.structural.structural.NamedElement(name: str, visibility: str = 'public')[source]#

Bases: Element

The NamedElement is the Superclass of all structural elements with a name.

Parameters:
  • name (str) – the name of the named element

  • visibility – Determines the kind of visibility of the named element (public as default).

name#

the name of the named element

Type:

str

visibility#

Determines the kind of visibility of the named element (public as default).

_abc_impl = <_abc._abc_data object>#
property name: str#

Get the name of the named element.

Type:

str

property visibility: str#

Get the visibility of the named element.

Type:

str

class besser.BUML.metamodel.structural.structural.Package(name: str, classes: set[Class])[source]#

Bases: NamedElement

A Package is a grouping mechanism that allows organizing and managing a set of classes.

name#

The name of the package.

Type:

str

classes#

The set of classes contained in the package.

Type:

set[Class]

name#

Inherited from NamedElement, represents the name of the package.

Type:

str

classes#

The set of classes contained in the package.

Type:

set[Class]

_abc_impl = <_abc._abc_data object>#
property classes: set[Class]#

Get the classes contained in the package.

Type:

set[Class]

class besser.BUML.metamodel.structural.structural.PrimitiveDataType(name: str)[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:

name (str) – the name of the primitive data type.

name#

Inherited from NamedElement, represents the name of the primitive data type.

Type:

str

_abc_impl = <_abc._abc_data object>#
property name: str#

Get the name of the named element.

Type:

str

class besser.BUML.metamodel.structural.structural.Property(name: str, type: Type, owner: Type = None, multiplicity: Multiplicity = Multiplicity(1, 1), visibility: str = 'public', is_composite: bool = False, is_navigable: bool = True, is_id: bool = False, is_read_only: 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.

  • multiplicity (Multiplicity) – The multiplicity of the property.

  • visibility (str) – The visibility of the property (‘public’, ‘private’, etc.).

  • is_composite (bool) – Indicates whether the property is a composite.

  • is_navigable (bool) – Indicates whether the property is navigable in a relationship.

  • is_id (bool) – Indicates whether the property is an id.

  • is_read_only (bool) – Indicates whether the property is read only.

name#

Inherited from TypedElement, represents the name of the property.

Type:

str

type#

Inherited from TypedElement, represents the type of the property.

Type:

Type

owner#

The type that owns the property.

Type:

Type

multiplicity#

The multiplicity of the property.

Type:

Multiplicity

visibility#

Inherited from TypedElement, represents the visibility of the property.

Type:

str

is_composite#

Indicates whether the property is a composite.

Type:

bool

is_navigable#

Indicates whether the property is navigable in a relationship.

Type:

bool

is_id#

Indicates whether the property is an id.

Type:

bool

is_read_only#

Indicates whether the property is read only.

Type:

bool

_abc_impl = <_abc._abc_data object>#
property is_composite: bool#

Get wheter the property is composite.

Type:

bool

property is_id: bool#

Get wheter the property is an id.

Type:

bool

property is_navigable: bool#

Get wheter the property is navigable.

Type:

bool

property is_read_only: bool#

Get wheter the property is read only.

Type:

bool

property multiplicity: Multiplicity#

Get the multiplicity of the property.

Type:

Multiplicity

property owner: Type#

Get the owner type of the property.

Type:

Type

class besser.BUML.metamodel.structural.structural.Type(name: str)[source]#

Bases: NamedElement

Type is the Superclass of classes and data types in the model.

Parameters:

name (str) – the name of the Type.

name#

Inherited from NamedElement, represents the name of the Type.

Type:

str

_abc_impl = <_abc._abc_data object>#
class besser.BUML.metamodel.structural.structural.TypedElement(name: str, type: Type, visibility: str = 'public')[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.

  • type (Type) – The data type of the typed element.

  • visibility – Determines the kind of visibility of the typed element (public as default).

name#

Inherited from NamedElement, represents the name of the typed element.

Type:

str

visibility#

Inherited from NamedElement, represents the visibility of the typed element.

type#

The data type of the typed element.

Type:

Type

_abc_impl = <_abc._abc_data object>#
property type: Type#