Object model

Bases: object

An attribute link is a named slot in an instance, which holds the value of an attribute

Parameters:
  • name (str) – the name of the attribute link

  • value (DataValue) – the value of the attribute.

  • attribute (Property) – the attribute or property from the structural metamodel.

name

inherited from NamedElement, represents the name of the attribute link.

Type:

str

value

the value of the attribute.

Type:

DataValue

attribute

the attribute or property from the structural metamodel.

Type:

Property

property attribute: Property

Get the attribute.

Type:

Property

property value: DataValue

Get value of the attribute.

Type:

DataValue

class besser.BUML.metamodel.object.object.DataValue(classifier: Type, value, name='')[source]

Bases: Instance

An DataValue represent the value of a property or attribute of an Object.

Parameters:
  • classifier (Type) – the classifier of the DataValue. It could be for example a Class or a PrimitiveDataType of the structural metamodel.

  • value – value of the property Instance.

classifier

Inherited from Instance, represents the classifier of the DataValue instance.

Type:

Type

value

value of the property Instance.

_abc_impl = <_abc._abc_data object>
_primitive_type_to_python_type(typename: str)[source]

Maps a BESSER primitive type name to the corresponding Python type.

property value

Method to retrieve Value

class besser.BUML.metamodel.object.object.Instance(name: str, classifier: Type)[source]

Bases: NamedElement

The instance defines an entity to which a set of operations can be applied and which has a state that stores the effects of the operations.

Parameters:
  • name (str) – the name of the instance

  • classifier (Type) – the classifier of the instance. It could be for example a Class or a PrimitiveDataType of the structural metamodel.

name

inherited from NamedElement, represents the name of the instance.

Type:

str

classifier

the classifier of the instance. It could be for example a Class or a PrimitiveDataType of the structural metamodel.

Type:

Type

_abc_impl = <_abc._abc_data object>
property classifier: Type

Get the classifier.

Type:

Type

Bases: NamedElement

A link represent a relationship between objects.

Parameters:
  • name (str) – the name of the Link

  • association (Association) – the Association that represents the Link

  • connections – list of link ends.

name

inherited from NamedElement, represents the name of the Link

Type:

str

association

the Association that represents the Link

Type:

Association

connections

list of link ends.

_abc_impl = <_abc._abc_data object>
add_to_connection(linkEnd)[source]

Method to add linkend

property association

Method to retrieve the association

Type:

Association

property connections

Method to retrieve the connections

Type:

list[LinkEnd]

class besser.BUML.metamodel.object.object.LinkEnd(name: str, association_end: Property, object: Object, owner: Link = None)[source]

Bases: NamedElement

A link end is an end point of a link.

Parameters:
  • name (str) – the name of the LinkEnd

  • association_end (Property) – the end represeted by the LinkEnd

  • object (Object) – the object pointed to by the LinkEnd

  • owner (Link) – the Link that owns this LinkEnd

name

inherited from NamedElement, represents the name of the LinkEnd

Type:

str

association_end

the end of the link

Type:

Property

object

the object pointed to by the LinkEnd

Type:

Object

owner

the Link that owns this LinkEnd

Type:

Link

_abc_impl = <_abc._abc_data object>
property association_end

Method to retrieve the association end

Type:

Property

property object

Method to retrieve the object

Type:

Object

property owner

Method to retrieve the owner link

Type:

Link

class besser.BUML.metamodel.object.object.Object(name: str, classifier: Type, slots: list[AttributeLink] = None)[source]

Bases: Instance

An object is an instance that originates from a class.

Parameters:
  • name (str) – the name of the object instance

  • classifier (Type) – the classifier of the object instance. It could be for example a Class or a PrimitiveDataType of the structural metamodel.

  • slots (list[AttributeLink]) – list of properties of the instance

name

inherited from NamedElement, represents the name of the object instance.

Type:

str

classifier

Inherited from Instance, represents the classifier of the object.

Type:

Type

slots

list of properties of the instance

Type:

list[AttributeLink]

_abc_impl = <_abc._abc_data object>

Add a link to the object instance.

Create a link between the source end and the target object.

Delete a link from the object instance.

_handle_association_end(key: str, value) bool[source]

Handle the case where the key matches an association end.

_is_fully_initialized() bool[source]

Check if the Object instance is fully initialized.

_is_internal_attr(key: str) bool[source]

Check if the key is an internal attribute of the Object class.

_set_classifier_attribute(key: str, value) bool[source]

Set the value of an attribute if it exists in the classifier’s attributes.

_set_slot_value(key: str, value) bool[source]

Set the value of an attribute link if it exists in the slots.

add_slot(slot: AttributeLink)[source]

Add a slot (attribute) to the object instance.

Get the set of link ends associated with the object instance.

Get the set of links associated with the object instance.

Type:

set[Link]

property name

Get the name of the object instance.

Type:

str

property name_

Get the name of the object instance.

Type:

str

property slots: list[AttributeLink]

Get the list of slots (attributes) of the object instance.

Type:

list[AttributeLink]

class besser.BUML.metamodel.object.object.ObjectModel(name: str, objects: set[Object] = None)[source]

Bases: NamedElement

An object model is the root element that comprises a number of objects.

Parameters:
  • name (str) – the name of the object model

  • objects (set[Object]) – set of objects in the model

name

inherited from NamedElement, represents the name of the model

Type:

str

objects

set of objects in the model

Type:

set[Object]

_abc_impl = <_abc._abc_data object>
static _conforms_to_type(classifier: Type, expected_type: Type) bool[source]

Return True if classifier matches or specializes expected_type.

static _format_multiplicity(assoc_end: Property) str[source]

Render multiplicity bounds readable for error messages.

_validate_enum_values(errors: list[str])[source]

Validate that enumeration attribute values are valid literals of their enumeration.

Validate that each link is well-formed and typed correctly.

_validate_multiplicities(errors: list[str])[source]

Verify that each object satisfies multiplicity constraints for every navigable association end.

_validate_object_completeness(warnings: list[str])[source]

Warn about objects with no attribute values defined.

_validate_unique_object_names(errors: list[str])[source]

Ensure each object has a unique name inside the model.

add_object(obj: Object)[source]

Object: Method to add an object to the set of objects.

property instances: set[Object | DataValue]

Method to retrieve the intances (Objects + DataValues).

Type:

set[Union[Object, DataValue]

Method to retrieve the links.

Type:

set[Link]

property objects: set[Object]

Method to retrieve the objects.

Type:

set[Object]

validate(raise_exception: bool = True) dict[source]

Validate the object model according to the UML object diagram constraints.

Parameters:

raise_exception (bool) – If True, raise ValueError when validation fails.

Returns:

Validation result with success flag, errors, and warnings.

Return type:

dict