admin-shell-io / submodel-templates

Submodel Templates for AAS
Creative Commons Attribution 4.0 International
42 stars 15 forks source link

ZVEI_Digital_Nameplate does not comply to spec #14

Open vChavezB opened 2 years ago

vChavezB commented 2 years ago

I am using the Basyx Python SDK to read the template but it failed. After posting the issue there I got pointed out that the template does not comply with the spec. In specific the following:

You seem to experience three distinct issues:

1.

    KeyError: aas:mimeType on line 505 has no text!
    -> Failed to construct aas:file on line 495 using construct_submodel_element!
Here the XML parser is trying to instantiate a `SubmodelElement` of type `File`. I extracted the respective data from the AASX package [SMT_pure_ZVEI_Digital_Nameplate_V10.aasx](https://github.com/admin-shell-io/submodel-templates/blob/main/published/ZVEI_Digital_Nameplate/1/0/SMT_pure_ZVEI_Digital_Nameplate_V10.aasx):
```xml
<aas:submodelElement>
  <aas:file>
    <aas:idShort>MarkingFile</aas:idShort>
    <aas:category>VARIABLE</aas:category>
    <aas:kind>Template</aas:kind>
    <aas:semanticId>
      <aas:keys>
        <aas:key type="ConceptDescription" local="true" idType="IRI">https://admin-shell.io/zvei/nameplate/1/0/Nameplate/Markings/Marking/MarkingFile</aas:key>
      </aas:keys>
    </aas:semanticId>
    <aas:qualifier />
    <aas:mimeType />
    <aas:value />
  </aas:file>
</aas:submodelElement>
```
The `File` submodel element is specified at the bottom of page 67 (section 4.7.12) of the [DotAAS specification](https://www.plattform-i40.de/IP/Redaktion/DE/Downloads/Publikation/Details_of_the_Asset_Administration_Shell_Part1_V2.html). There it specifies the cardinality of the `mimeType` property as 1, meaning that this property has to be present and is not optional. In the excerpt above you see that `<aas:mimeType />` is just an empty tag, so the mime type isn't given for this `File` element, which is invalid. Because of this invalidity, the `File` element cannot be instantiated using this SDK.

2.

    ValueError: A revision requires a version. This means, if there is no version there is no revision neither.
     -> Failed to construct aas:administration on line 590 using construct_administrative_information!
The AASX package contains a lot of `AdministrativeInformation` objects which specify the `revision`, but not the `version`. Here is an excerpt from [SMT_pure_ZVEI_Digital_Nameplate_V10.aasx](https://github.com/admin-shell-io/submodel-templates/blob/main/published/ZVEI_Digital_Nameplate/1/0/SMT_pure_ZVEI_Digital_Nameplate_V10.aasx):
```xml
<aas:administration>
  <aas:version />
  <aas:revision>1</aas:revision>
</aas:administration>
```
If you have a look at the [DotAAS specification (v2.0.1)](https://www.plattform-i40.de/IP/Redaktion/DE/Downloads/Publikation/Details_of_the_Asset_Administration_Shell_Part1_V2.html) on the top of page 54 (section 4.7.2.4) you can see that the `revision` attribute of `AdministrativeInformation` has a constraint, stating that if no version is given, there can't be a revision. Thus the AASX package is invalid in this regard.
Anyways, because the `AdministrativeInformation` is an optional attribute, the parent objects such as `AssetAdministrationShell`, `Submodel`, `ConceptDescription` or `Asset` are still parsed, just without their `administration` attribute.

3.

    IEC61360ConceptDescription[Identifier(IRI=https://admin-shell.io/zvei/nameplate/1/0/Nameplate)] has a duplicate identifier already parsed in the document! skipping it...
The AASX package contains two `Identifiable` objects with the same Identifier:
```xml
<aas:submodel>
  <aas:idShort>Nameplate</aas:idShort>
  <aas:category>VARIABLE</aas:category>
  <aas:identification idType="IRI">https://admin-shell.io/zvei/nameplate/1/0/Nameplate</aas:identification>
  [...]
</aas:submodel>
```
```xml
<aas:conceptDescription>
  <aas:idShort />
  <aas:identification idType="IRI">https://admin-shell.io/zvei/nameplate/1/0/Nameplate</aas:identification>
  [...]
</aas:conceptDescription>
```
As you can see, both, the `Submodel` and the `ConceptDescription`, use the IRI `https://admin-shell.io/zvei/nameplate/1/0/Nameplate` as their identifier.
The [DotAAS specification](https://www.plattform-i40.de/IP/Redaktion/DE/Downloads/Publikation/Details_of_the_Asset_Administration_Shell_Part1_V2.html) says on page 54 (section 4.7.2.1) that `identification` attribute of an `Identifiable` object must be a globally unique identifier. Thus, if two objects thave the same identifier, it isn't globally unique anymore, making it invalid.

If you have the time, please forward these issue to https://github.com/admin-shell-io/submodel-templates/issues so the AASX package can get fixed. Thanks!

Originally posted by @jkhsjdhjs in https://github.com/eclipse-basyx/basyx-python-sdk/issues/25#issuecomment-1192822889

Rudra-sandeep commented 3 months ago

@vChavezB Please check the latest version of the SMT link provided below https://github.com/admin-shell-io/submodel-templates/tree/main/published/Digital%20nameplate/2/0

vChavezB commented 3 months ago

Thanks for the feedback, will have a look on the update!