Object model¶
- class besser.BUML.metamodel.object.object.AttributeLink(value: DataValue, attribute: Property)[source]¶
Bases:
objectAn 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.
- Attributes:¶
name (str) – inherited from NamedElement, represents the name of the attribute link.
value (DataValue) – the value of the attribute.
attribute (Property) – the attribute or property from the structural metamodel.
- class besser.BUML.metamodel.object.object.Instance(name: str, classifier: Type)[source]¶
Bases:
NamedElementThe 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.
- Attributes:¶
name (str) – inherited from NamedElement, represents 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.
-
_abc_impl =
<_abc._abc_data object>¶
-
class besser.BUML.metamodel.object.object.Object(name: str, classifier: Type, slots: list[AttributeLink] =
None)[source]¶ Bases:
InstanceAn 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
- Attributes:¶
name (str) – inherited from NamedElement, represents the name of the object instance.
classifier (Type) – Inherited from Instance, represents the classifier of the object.
slots (list[AttributeLink]) – list of properties of the instance
- property slots : list[AttributeLink]¶
Get the list of slots (attributes) of the object instance.
- Type:¶
- add_slot(slot: AttributeLink)[source]¶
Add a slot (attribute) to the object instance.
- _is_internal_attr(key: str) bool[source]¶
Check if the key is an internal attribute of the Object class.
- _set_slot_value(key: str, value) bool[source]¶
Set the value of an attribute link if it exists in the slots.
- _set_classifier_attribute(key: str, value) bool[source]¶
Set the value of an attribute if it exists in the classifier’s attributes.
- _handle_association_end(key: str, value) bool[source]¶
Handle the case where the key matches an association end.
- _create_link(src_end, tgt_end, target, association)[source]¶
Create a link between the source end and the target object.
-
_abc_impl =
<_abc._abc_data object>¶
-
class besser.BUML.metamodel.object.object.DataValue(classifier: Type, value, name=
'')[source]¶ Bases:
InstanceAn 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.
- Attributes:¶
classifier (Type) – Inherited from Instance, represents the classifier of the DataValue instance.
value – value of the property Instance.
- property value¶
Method to retrieve Value
- _primitive_type_to_python_type(typename: str)[source]¶
Maps a BESSER primitive type name to the corresponding Python type.
-
_abc_impl =
<_abc._abc_data object>¶
-
class besser.BUML.metamodel.object.object.LinkEnd(name: str, association_end: Property, object: Object, owner: Link =
None)[source]¶ Bases:
NamedElementA 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
- Attributes:¶
name (str) – inherited from NamedElement, represents the name of the LinkEnd
association_end (Property) – the end of the link
object (Object) – the object pointed to by the LinkEnd
owner (Link) – the Link that owns this LinkEnd
-
_abc_impl =
<_abc._abc_data object>¶
- class besser.BUML.metamodel.object.object.Link(name: str, association: Association, connections: list[LinkEnd])[source]¶
Bases:
NamedElementA 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.
- Attributes:¶
name (str) – inherited from NamedElement, represents the name of the Link
association (Association) – the Association that represents the Link
connections – list of link ends.
-
_abc_impl =
<_abc._abc_data object>¶
-
class besser.BUML.metamodel.object.object.ObjectModel(name: str, objects: set[Object] =
None)[source]¶ Bases:
NamedElementAn 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
- Attributes:¶
name (str) – inherited from NamedElement, represents the name of the model
objects (set[Object]) – set of objects in the model
-
_abc_impl =
<_abc._abc_data object>¶
- property instances : set[Object | DataValue]¶
Method to retrieve the intances (Objects + DataValues).
-
validate(raise_exception: bool =
True) dict[source]¶ Validate the object model according to the UML object diagram constraints.
- _validate_unique_object_names(errors: list[str])[source]¶
Ensure each object has a unique name inside the model.
- _validate_links(errors: list[str])[source]¶
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_enum_values(errors: list[str])[source]¶
Validate that enumeration attribute values are valid literals of their enumeration.
- static _conforms_to_type(classifier: Type, expected_type: Type) bool[source]¶
Return True if classifier matches or specializes expected_type.