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

Problem reading Nameplate template package #25

Closed
vChavezB opened this issue Jul 22, 2022 · 2 comments
Closed

Problem reading Nameplate template package #25

vChavezB opened this issue Jul 22, 2022 · 2 comments

Comments

@vChavezB
Copy link

vChavezB commented Jul 22, 2022

I am trying to see if I can import a template, in specific the Digital Nameplate. The aasx packages are located here .

Whenever I try to use the aasx.Reader and call read_into I get the following error:

KeyError: aas:mimeType on line 505 has no text!
 -> Failed to construct aas:file on line 495 using construct_submodel_element!
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!
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 627 using construct_administrative_information!
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 664 using construct_administrative_information!
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 701 using construct_administrative_information!
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 738 using construct_administrative_information!
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 775 using construct_administrative_information!
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 812 using construct_administrative_information!
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 849 using construct_administrative_information!
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 886 using construct_administrative_information!
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 923 using construct_administrative_information!
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 960 using construct_administrative_information!
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 997 using construct_administrative_information!
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 1034 using construct_administrative_information!
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 1071 using construct_administrative_information!
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 1108 using construct_administrative_information!
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 1145 using construct_administrative_information!
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 1182 using construct_administrative_information!
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 1219 using construct_administrative_information!
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 1256 using construct_administrative_information!
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 1293 using construct_administrative_information!
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 1330 using construct_administrative_information!
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 1367 using construct_administrative_information!
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 1404 using construct_administrative_information!
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 1441 using construct_administrative_information!
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 1478 using construct_administrative_information!
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 1515 using construct_administrative_information!
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 1552 using construct_administrative_information!
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 1589 using construct_administrative_information!
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 1626 using construct_administrative_information!
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 1659 using construct_administrative_information!
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 1691 using construct_administrative_information!
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 1723 using construct_administrative_information!
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 1755 using construct_administrative_information!
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 1787 using construct_administrative_information!
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 1819 using construct_administrative_information!
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 1851 using construct_administrative_information!
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 1888 using construct_administrative_information!
IEC61360ConceptDescription[Identifier(IRI=https://admin-shell.io/zvei/nameplate/1/0/Nameplate)] has a duplicate identifier already parsed in the document! skipping it...

Code with the problem

template_path= "SMT_pure_ZVEI_Digital_Nameplate_V10.aasx"

new_object_store: model.DictObjectStore[model.Identifiable] = model.DictObjectStore()
new_file_store = aasx.DictSupplementaryFileContainer()
with aasx.AASXReader(template_path) as reader:
    reader.read_into(object_store=new_object_store,
                     file_store=new_file_store)
@jkhsjdhjs
Copy link
Contributor

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:
    <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. 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.

  1. 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:
    <aas:administration>
      <aas:version />
      <aas:revision>1</aas:revision>
    </aas:administration>
    If you have a look at the DotAAS specification (v2.0.1) 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.

  1. 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:
    <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>
    <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 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!

@vChavezB
Copy link
Author

Thanks for the detailed answer. I will forward this issue back to there!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants