Skip to content

Commit 7430a4a

Browse files
authored
Update/metamodel v3.1.2: AASd-014 (#70)
AASd-014: `entityType` now optional. Update documentation and changed related code accordingly ([Changelog/AASd-014](https://industrialdigitaltwin.io/aas-specifications/IDTA-01001/v3.1.2/changelog.html#:~:text=CHANGED:%20Entity/entityType%20and%20Constraint%20AASd%2D014:%20entityType%20now%20optional%20(#287))).
1 parent 56e4fe7 commit 7430a4a

4 files changed

Lines changed: 16 additions & 9 deletions

File tree

sdk/basyx/aas/adapter/json/json_deserialization.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2025 the Eclipse BaSyx Authors
1+
# Copyright (c) 2026 the Eclipse BaSyx Authors
22
#
33
# This program and the accompanying materials are made available under the terms of the MIT License, available in
44
# the LICENSE file of this project.
@@ -528,9 +528,12 @@ def _construct_entity(cls, dct: Dict[str, object], object_class=model.Entity) ->
528528
if 'specificAssetIds' in dct:
529529
for desc_data in _get_ts(dct, "specificAssetIds", list):
530530
specific_asset_id.add(cls._construct_specific_asset_id(desc_data, model.SpecificAssetId))
531-
531+
if 'entityType' in dct:
532+
entity_type = ENTITY_TYPES_INVERSE[_get_ts(dct, 'entityType', str)]
533+
else:
534+
entity_type = None
532535
ret = object_class(id_short=None,
533-
entity_type=ENTITY_TYPES_INVERSE[_get_ts(dct, "entityType", str)],
536+
entity_type=entity_type,
534537
global_asset_id=global_asset_id,
535538
specific_asset_id=specific_asset_id)
536539
cls._amend_abstract_attributes(ret, dct)

sdk/basyx/aas/adapter/xml/xml_deserialization.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2025 the Eclipse BaSyx Authors
1+
# Copyright (c) 2026 the Eclipse BaSyx Authors
22
#
33
# This program and the accompanying materials are made available under the terms of the MIT License, available in
44
# the LICENSE file of this project.
@@ -827,10 +827,14 @@ def construct_entity(cls, element: etree._Element, object_class=model.Entity, **
827827
for id in _child_construct_multiple(specific_asset_ids, NS_AAS + "specificAssetId",
828828
cls.construct_specific_asset_id, cls.failsafe):
829829
specific_asset_id.add(id)
830-
830+
entity_type_text = _get_text_or_none(element.find(NS_AAS + "entityType"))
831+
if entity_type_text is not None:
832+
entity_type = ENTITY_TYPES_INVERSE[entity_type_text]
833+
else:
834+
entity_type = None
831835
entity = object_class(
832836
id_short=None,
833-
entity_type=_child_text_mandatory_mapped(element, NS_AAS + "entityType", ENTITY_TYPES_INVERSE),
837+
entity_type=entity_type,
834838
global_asset_id=_get_text_or_none(element.find(NS_AAS + "globalAssetId")),
835839
specific_asset_id=specific_asset_id)
836840

sdk/basyx/aas/model/submodel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,8 +1041,8 @@ class Entity(SubmodelElement, base.UniqueIdShortNamespace):
10411041
"""
10421042
An entity is a :class:`~.SubmodelElement` that is used to model entities
10431043
1044-
**Constraint AASd-014:** global_asset_id or specific_asset_id must be set if ``entity_type`` is set to
1045-
:attr:`~basyx.aas.model.base.EntityType.SELF_MANAGED_ENTITY`. They must be empty otherwise.
1044+
**Constraint AASd-014:** Either the attribute ``globalAssetId`` or ``specificAssetId`` of an ``Entity``
1045+
must be set if ``Entity/entityType`` is set to ``SelfManagedEntity``.
10461046
10471047
:ivar id_short: Identifying string of the element within its name space. (inherited from
10481048
:class:`~basyx.aas.model.base.Referable`)

sdk/docs/source/constraints.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ an :class:`~basyx.aas.model.base.AASConstraintViolation` will be raised
1919
.. |aasd006| replace:: If both, the ``value`` and the ``valueId`` of a ``Qualifier`` are present, the value shall be identical to the value of the referenced coded value in ``Qualifier/valueId``.
2020
.. |aasd007| replace:: If both the ``Property/value`` and the ``Property/valueId`` are present, the value of ``Property/value`` shall be identical to the value of the referenced coded value in ``Property/valueId``.
2121
.. |aasd012| replace:: if both the ``MultiLanguageProperty/value`` and the ``MultiLanguageProperty/valueId`` are present, the meaning must be the same for each string in a specific language, as specified in ``MultiLanguageProperty/valueId``.
22-
.. |aasd014| replace:: Either the attribute ``globalAssetId`` or ``specificAssetId`` of an ``Entity`` must be set if ``Entity/entityType`` is set to ``SelfManagedEntity``. Otherwise, they do not exist.
22+
.. |aasd014| replace:: Either the attribute ``globalAssetId`` or ``specificAssetId`` of an ``Entity`` must be set if ``Entity/entityType`` is set to ``SelfManagedEntity``.
2323
.. |aasd020| replace:: The value of ``Qualifier/value`` shall be consistent with the data type as defined in ``Qualifier/valueType``.
2424
.. |aasd021| replace:: Every qualifiable shall only have one qualifier with the same ``Qualifier/type``.
2525
.. |aasd022| replace:: ``idShort`` of non-identifiable referables within the same name space shall be unique (case-sensitive).

0 commit comments

Comments
 (0)