Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement v3.0 of the metamodel specification #174

Merged
merged 456 commits into from
Nov 25, 2023
Merged

Implement v3.0 of the metamodel specification #174

merged 456 commits into from
Nov 25, 2023

Conversation

s-heppner
Copy link
Contributor

This PR merges the v3.0 implementation of the metamodel specification into main.

For the detailed documentation of the changes, please refer to the prior PRs

s-heppner and others added 30 commits July 14, 2022 09:17
The problem was, that with V3.0RC02, an Identifer is a string. Therefore
the distinction between File-Identifier and AAS-Identifier could not be
made anymore.
As a solution, remove the option to input the already hashed
File-Identifier.
implement global and model references
rename AASReference to ModelReference
add Reference/referredSemanticId
remove redundant definitions from XML schema (AAS and IEC61360)
rename SpecificAssetId/key to SpecificAssetId/name
change type of SpecificAssetId/externalSubjectId from Reference to GlobalReference
make CONCEPT_DICTIONARY a private member since it has been removed
from the spec
reflect this change in the json/xml schemata
add missing comments to protected KeyTypes enum members
In V3.0RC02 DataTypeDef has been split into DataTypeDefRdf and
DataTypeDefXsd. Since DataTypeDefRdf only consists of rdf::langString
and currently isn't used anywhere in the DotAAS specification, just
rename DataTypeDef to DataTypeDefXsd.
In V3.0RC02 the attributes `allowDuplicates` and `ordered` were removed
from `SubmodelElementCollection`. Additionally the `semanticId` of
contained elements is no longer unique. Because of that, the extra
classes `SubmodelElementCollectionOrdered`,
`SubmodelElementCollectionUnordered`,
`SubmodelElementCollectionOrderedUniqueSemanticId` and
`SubmodelElementCollectionUnorderedUniqueSemanticId` aren't needed
anymore.

Also ignore two tests which will be modified and re-enabled later.
The `item_add_hook` is a function that is called whenever items are
added to the `NamespaceSet`, even on initialization. It is supplied
to the `NamespaceSet` on initialization and allows the model class
to check constraints whenever a new item is added.
In turn re-enable the unittests that were disabled in
639b4b9.
jkhsjdhjs and others added 24 commits November 14, 2023 13:31
This commit makes `Operation` inherit from
`UniqueIdShortNamespace`, to implement Constraint AASd-134:

For an Operation, the idShort of all inputVariable/value,
outputVariable/value, and inoutputVariable/value shall be unique.

In the DotAAS spec, the attributes `inputVariable`, `outputVariable`
and `inoutputVariable` of `Operation` are defined to be a collection of
`OperationVariable` instances, which themselves just contain a single
`SubmodelElement`. Thus, the `OperationVariable` isn't really required
for `Operation`, as the `Operation` can just contain the
`SubmodelElements` directly, without an unnecessary wrapper. This makes
`Operation` less tedious to use and also allows us to use normal
`NamespaceSets` for the 3 attributes, which together with the
`UniqueIdShortNamespace` ensure, that the `idShort` of all contained
`SubmodelElements` is unique across all 3 attributes.

Aside this, the examples are updated since `SubmodelElements` as
children of an `Operation` are now linked to the parent. This prevents
us from reusing other `SubmodelElements` as `OperationVariables` as it
was done previously, since each `SubmodelElement` can only have one
parent.

Fix #146 #148
…e of a conflict

Currently a string constraints decorator silently overwrites existing
attributes in case of a naming conflict. This behavior is changed such
that the decorator checks for existing attributes beforehand and raises
an exception in case of a conflict.
Futhermore, tests for this behavior are added.
- Refactor `NamespaceSet.add()` as too big
- Extract some methods, in particular `_execute_item_del_hook` 
  to avoid code duplication
- As we check different constraints for uniqueness in the namespace, 
  I defined `ATTRIBUTES_CONSTRAINT_IDS`. 
  The dict will be used when throwing exception. 
  The solution with the dict is temporary, we need another solution here.
- Use correct constraint ids for each NamespaceSet in tests, use 000 if not constraint id is suitable
Please note, that according to [#72], we decided not
to include the `File` pattern, since the
specification is wrong at this.

[#72](#72)
These went unnoticed previously since the JSON schema doesn't prohibit
additional attributes. Now that the `modelType` is defined as a constant
string per definition, a `Property` object only matches against the
corresponding definition, allowing more strict validation, that catches
errors such as these null values.
This removes the two XSD datatypes

- `xs:dateTimeStamp`
- `xs:dayTimeDuration`

from the `DataTypeDefXsd` in the JSON schema, as they were
removed from the specification in v3.0
This commit remanes `valueDataType_t` from the XSD to
`valueDataType`.
Furthermore, it adds a missing `<reference>` tag around
the `refersTo` References of `Extension`.
The current order of the elements in `SubmodelElementList`
was wrong. This updates the order.
Version 3.0 of the spec removes the attribute `kind` from
`SubmodelElement`s.
While we already implemented this, it was still missing in the
XSD Schema, as well as the examples. This commit fixes that.
Currently, the XML deserialization missed the
`<aas:refersTo>` wrapper around the single references
inside `Extension.refers_to`. This commit fixes that.
Currently, `Extension.refers_to` is declared as a `Iterable[Reference]`.
This implies, that we can not necessarily check, whether or not the
attribute is empty or not.
This creates a problem with the XML serialization, since the
`<aas.refersTo>` element should only appear if there is at least
one `Reference` inside.

This commit changes the `Extension.refers_to` to be a set of
`Reference`s, as well as adapting a more clear check whether
or not the attribute is empty in `adapter.xml.xml_serialization`.
remove constraint, that if the second part of lang tag exists, it must be a region

See #157
Previously, the compliance tool would ignore `Extensions` of objects.
However, during the update to V3.0 and the changes to the JSON/XML
formats, we noticed that the adapters aren't properly tested this way.

The validation of `Extensions` can be disabled via the flag
`--dont-check-extensions` or the keyword argument `check_extensions` to
`AASDataChecker`, since many users are probably only interested in
comparing the main model, without any extensions.
@s-heppner s-heppner added the v3.0 label Nov 21, 2023
These comments were mistakenly re-added in a previous merge of main into
improve/V30.
@s-heppner s-heppner merged commit 2063c8a into main Nov 25, 2023
11 checks passed
@s-heppner s-heppner mentioned this pull request Nov 25, 2023
26 tasks
@s-heppner s-heppner deleted the improve/V30 branch November 25, 2023 20:19
Frosty2500 pushed a commit to rwth-iat/basyx-python-sdk that referenced this pull request Aug 22, 2024
Implement v3.0 of the metamodel specification

For the detailed documentation of the changes, please refer to the [prior PRs](https://github.com/eclipse-basyx/basyx-python-sdk/pulls?page=4&q=is%3Apr+base%3Aimprove%2FV30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants