Skip to content

Commit

Permalink
Add Constraint AASd-133 in SpecificAssetId
Browse files Browse the repository at this point in the history
Check if external_subject_id is ExternalReference
  • Loading branch information
zrgt committed Oct 20, 2023
1 parent 8fbaa64 commit 704e239
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions basyx/aas/model/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2130,6 +2130,9 @@ class SpecificAssetId(HasSemantics):
A specific asset ID describes a generic supplementary identifying attribute of the asset.
The specific asset ID is not necessarily globally unique.
*Constraint AASd-133:* SpecificAssetId/externalSubjectId shall be a global reference,
i.e. Reference/type = ExternalReference
:ivar name: Key of the identifier
:ivar value: The value of the identifier with the corresponding key.
:ivar external_subject_id: The (external) subject the key belongs to or has meaning to.
Expand All @@ -2153,6 +2156,10 @@ def __init__(self,
raise ValueError("value is not allowed to be an empty string")
_string_constraints.check_label_type(name)
_string_constraints.check_identifier(value)
if external_subject_id is not None and not isinstance(external_subject_id, ExternalReference):
raise AASConstraintViolation(133, f"external_subject_id shall be a global reference, given: "
f"{external_subject_id}")

self.name: LabelType
self.value: Identifier
self.external_subject_id: ExternalReference
Expand Down

0 comments on commit 704e239

Please sign in to comment.