Skip to content

Commit

Permalink
V3.1: Introduce new abstract Container_element
Browse files Browse the repository at this point in the history
The new version of the specification introduces a
new abstract class `Container_element`. This class
is used to describe concrete classes that are able
to "contain" other classes from the meta-model.

Concretely, this means that the classes:
- `Annotated_relationship_element`
- `Entity`
- `Submodel_element_collection`
- `Submodel_element_list`
now inherit from the `Container_element` class.

See these resources:
- [Link to spec]
- Issue that introduces the class: [aas-specs#420]
- Issue for the reasoning behind the
  new class: [aas-specs#333]
- PR that introduces it into
  the spec: [aas-specs#500]

[Link to spec]: https://admin-shell-io.github.io/aas-specs-antora/IDTA-01001/v3.1/spec-metamodel/submodel-elements.html#container-element-and-overview-of-data-element-types
[aas-specs#420]: admin-shell-io/aas-specs#420
[aas-specs#333]: admin-shell-io/aas-specs#333
[aas-specs#500]: admin-shell-io/aas-specs#500
  • Loading branch information
s-heppner committed Jan 7, 2025
1 parent a1cc962 commit 586c7cb
Showing 1 changed file with 48 additions and 7 deletions.
55 changes: 48 additions & 7 deletions aas_core_meta/v3_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -2621,6 +2621,41 @@ def __init__(
)


@abstract
class Container_element(Submodel_element):
"""
A container element is a submodel element that is composed of
other submodel elements.
"""

def __init__(
self,
extensions: Optional[List["Extension"]] = None,
category: Optional[Name_type] = None,
ID_short: Optional[ID_short_type] = None,
display_name: Optional[List["Lang_string_name_type"]] = None,
description: Optional[List["Lang_string_text_type"]] = None,
semantic_ID: Optional["Reference"] = None,
supplemental_semantic_IDs: Optional[List["Reference"]] = None,
qualifiers: Optional[List["Qualifier"]] = None,
embedded_data_specifications: Optional[
List["Embedded_data_specification"]
] = None,
) -> None:
Submodel_element.__init__(
self,
extensions=extensions,
category=category,
ID_short=ID_short,
display_name=display_name,
description=description,
semantic_ID=semantic_ID,
supplemental_semantic_IDs=supplemental_semantic_IDs,
qualifiers=qualifiers,
embedded_data_specifications=embedded_data_specifications,
)


class Relationship_element(Submodel_element):
"""
A relationship element is used to define a relationship between two elements
Expand Down Expand Up @@ -2688,6 +2723,7 @@ class AAS_submodel_elements(Enum):
Reference_element = "ReferenceElement"
Relationship_element = "RelationshipElement"
Submodel_element = "SubmodelElement"
Container_element = "ContainerElement"
Submodel_element_list = "SubmodelElementList"
Submodel_element_collection = "SubmodelElementCollection"

Expand Down Expand Up @@ -2764,7 +2800,7 @@ class AAS_submodel_elements(Enum):
"Value must be either not set or have at least one item."
)
# fmt: on
class Submodel_element_list(Submodel_element):
class Submodel_element_list(Container_element):
"""
A submodel element list is an ordered list of submodel elements.
Expand Down Expand Up @@ -2867,7 +2903,7 @@ def __init__(
value_type_list_element: Optional["Data_type_def_XSD"] = None,
value: Optional[List["Submodel_element"]] = None,
) -> None:
Submodel_element.__init__(
Container_element.__init__(
self,
extensions=extensions,
category=category,
Expand Down Expand Up @@ -2912,7 +2948,7 @@ def __init__(
"Value must be either not set or have at least one item."
)
# fmt: on
class Submodel_element_collection(Submodel_element):
class Submodel_element_collection(Container_element):
"""
A submodel element collection is a kind of struct, i.e. a a logical encapsulation
of multiple named values. It has a fixed number of submodel elements.
Expand All @@ -2938,7 +2974,7 @@ def __init__(
] = None,
value: Optional[List["Submodel_element"]] = None,
) -> None:
Submodel_element.__init__(
Container_element.__init__(
self,
extensions=extensions,
category=category,
Expand Down Expand Up @@ -3423,7 +3459,7 @@ def __init__(
"Annotations must be either not set or have at least one item."
)
# fmt: on
class Annotated_relationship_element(Relationship_element):
class Annotated_relationship_element(Relationship_element, Container_element):
"""
An annotated relationship element is a relationship element that can be annotated
with additional data elements.
Expand Down Expand Up @@ -3514,7 +3550,7 @@ def __init__(
"Statements must be either not set or have at least one item."
)
# fmt: on
class Entity(Submodel_element):
class Entity(Container_element):
"""
An entity is a submodel element that is used to model entities.
Expand Down Expand Up @@ -3568,7 +3604,7 @@ def __init__(
global_asset_ID: Optional["Identifier"] = None,
specific_asset_IDs: Optional[List["Specific_asset_ID"]] = None,
) -> None:
Submodel_element.__init__(
Container_element.__init__(
self,
extensions=extensions,
category=category,
Expand Down Expand Up @@ -4754,6 +4790,7 @@ class Key_types(Enum):
Blob = "Blob"
Capability = "Capability"
Concept_description = "ConceptDescription"
Container_element = "ContainerElement"

Data_element = "DataElement"
"""
Expand Down Expand Up @@ -4871,6 +4908,7 @@ class Key_types(Enum):
Key_types.Basic_event_element,
Key_types.Blob,
Key_types.Capability,
Key_types.Container_element,
Key_types.Data_element,
Key_types.Entity,
Key_types.Event_element,
Expand All @@ -4895,6 +4933,7 @@ class Key_types(Enum):
Key_types.Basic_event_element,
Key_types.Blob,
Key_types.Capability,
Key_types.Container_element,
Key_types.Data_element,
Key_types.Entity,
Key_types.Event_element,
Expand Down Expand Up @@ -4935,6 +4974,7 @@ class Key_types(Enum):
Key_types.Referable,
Key_types.Relationship_element,
Key_types.Submodel_element,
Key_types.Container_element,
Key_types.Submodel_element_collection,
Key_types.Submodel_element_list,
],
Expand Down Expand Up @@ -4964,6 +5004,7 @@ class Key_types(Enum):
Key_types.Basic_event_element,
Key_types.Blob,
Key_types.Capability,
Key_types.Container_element,
Key_types.Data_element,
Key_types.Entity,
Key_types.Event_element,
Expand Down

0 comments on commit 586c7cb

Please sign in to comment.