Closed aboeckenholt closed 7 months ago
Thank you for opening this issue.
Considering the template you tried to read "IDTA 2023-0-9 _Template_CarbonFootprint_Final.aasx"
appears to have been released last week, I assume it has been built with the current version of the AASX Package Explorer at version 3.0 of the specification.
Therefore, to my knowledge, it is still aas-package-explorer#666 that is the issue, as also shown by the stack-trace you provided that says that the aasx-origin Relationship is missing
Edit (2024-03-14, @s-heppner): The issue is now found here: eclipse-aaspe/aaspe#161
@s-heppner this issue doesn't exist anymore. And i get the same error for:
Traceback (most recent call last):
File "./venv/lib/python3.10/site-packages/basyx/aas/adapter/aasx.py", line 144, in read_into
aasx_origin_part = core_rels[RELATIONSHIP_TYPE_AASX_ORIGIN][0]
IndexError: list index out of range
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "./src/__main__.py", line 22, in <module>
reader.read_into(object_store=new_object_store,
File "./venv/lib/python3.10/site-packages/basyx/aas/adapter/aasx.py", line 146, in read_into
raise ValueError("Not a valid AASX file: aasx-origin Relationship is missing.") from e
ValueError: Not a valid AASX file: aasx-origin Relationship is missing.
I downloaded this file from: https://v3security.admin-shell-io.com/. I tried different submodels like @aboeckenholt from https://github.com/admin-shell-io/submodel-templates. Everytime i try to read an aasx file it fails either with the error above or with this error:
The following required namespaces are not declared: https://admin-shell.io/aas/3/0 - Is the input document of an older version?
Unexpected top-level list {http://admin-shell.io/aas/3/0}assetAdministrationShells on line 3!
Unexpected top-level list {http://admin-shell.io/aas/3/0}assets on line 20!
Unexpected top-level list {http://admin-shell.io/aas/3/0}submodels on line 21!
Unexpected top-level list {http://admin-shell.io/aas/3/0}conceptDescriptions on line 810!
I use the main branch. Where can i get a valid V3 aasx file to test? Thank you.
Everytime i try to read an aasx file it fails either with the error above or with this error:
The following required namespaces are not declared: https://admin-shell.io/aas/3/0 - Is the input document of an older version? Unexpected top-level list {http://admin-shell.io/aas/3/0}assetAdministrationShells on line 3! Unexpected top-level list {http://admin-shell.io/aas/3/0}assets on line 20! Unexpected top-level list {http://admin-shell.io/aas/3/0}submodels on line 21! Unexpected top-level list {http://admin-shell.io/aas/3/0}conceptDescriptions on line 810!
Looks like you'd only have to append an s
to http
in the namespace of the XML file inside the AASX file in this case.
Where can i get a valid V3 aasx file to test?
You can zip the _aasx
directories here individually to obtain the AASX files that are used to test this sdk. Just make sure that the directory itself is not contained in the zip file, i.e. the zip files should contain the file [Content_Types].xml
at the top level.
I've contacted the guys to make the aas-package-explorer#666 issue visible again, considering there are obviously lots of shells in the wild that still have this issue, even if the newest version of the AASX Package Explorer fixed it.
Edit: It's now found here: eclipse-aaspe/aaspe#161
thanks for the Reply!
Let's explain further what i did. i download the official Template from https://github.com/admin-shell-io/submodel-templates/blob/main/published/Contact%20Information/1/IDTA%2002002-1-0_Template_ContactInformation.aasx If i try to read it:
The following required namespaces are not declared: https://admin-shell.io/aas/3/0 - Is the input document of an older version?
Unexpected top-level list {http://admin-shell.io/aas/2/0}assetAdministrationShells on line 3!
Unexpected top-level list {http://admin-shell.io/aas/2/0}assets on line 20!
Unexpected top-level list {http://admin-shell.io/aas/2/0}submodels on line 21!
Unexpected top-level list {http://admin-shell.io/aas/2/0}conceptDescriptions on line 810!
ok, let's unzip it.
there is no result of http://admin-shell.io/aas/2/0
there are 34 results for /2/
in AssetAdministrationShell---61CFE571.aas.xml
<aas:key type="GlobalReference" local="false" idType="IRI">http://admin-shell.io/DataSpecificationTemplates/DataSpecificationIEC61360/2/0</aas:key>
there are 60 results for http://admin-shell
, 57 in AssetAdministrationShell---61CFE571.aas.xml
If i replace all /2/
with /3/
we get the same error:
The following required namespaces are not declared: https://admin-shell.io/aas/3/0 - Is the input document of an older version?
Unexpected top-level list {http://admin-shell.io/aas/3/0}assetAdministrationShells on line 3!
Unexpected top-level list {http://admin-shell.io/aas/3/0}assets on line 20!
Unexpected top-level list {http://admin-shell.io/aas/3/0}submodels on line 21!
Unexpected top-level list {http://admin-shell.io/aas/3/0}conceptDescriptions on line 810!
if i replace all http://admin
with https://admin
it fails with:
Traceback (most recent call last):
File "./basyx/basyx/aas/adapter/aasx.py", line 144, in read_into
aasx_origin_part = core_rels[RELATIONSHIP_TYPE_AASX_ORIGIN][0]
IndexError: list index out of range
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "./src/__main__.py", line 27, in <module>
reader.read_into(object_store=new_object_store,
File "./basyx/basyx/aas/adapter/aasx.py", line 146, in read_into
raise ValueError("Not a valid AASX file: aasx-origin Relationship is missing.") from e
ValueError: Not a valid AASX file: aasx-origin Relationship is missing.
What's also confusing is the line numbers, because there is no occur of http://admin-shell.io/aas/3/0
in this lines (line 1-28):
<?xml version="1.0"?>
<aas:aasenv xmlns:IEC="http://admin-shell.io/IEC61360/3/0" xmlns:xsi="http://w3.org/2001/XMLSchema-instance" xmlns:abac="http://admin-shell.io/aas/abac/3/0" xsi:schemaLocation="http://admin-shell.io/aas/3/0 AAS.xsd http://admin-shell.io/IEC61360/3/0 IEC61360.xsd" xmlns:aas="http://admin-shell.io/aas/3/0">
<aas:assetAdministrationShells>
<aas:assetAdministrationShell>
<aas:idShort />
<aas:identification idType="Custom">AssetAdministrationShell---61CFE571</aas:identification>
<aas:assetRef>
<aas:keys />
</aas:assetRef>
<aas:submodelRefs>
<aas:submodelRef>
<aas:keys>
<aas:key type="Submodel" local="true" idType="IRI">https://example.com/ids/sm/1231_6162_1022_9579</aas:key>
</aas:keys>
</aas:submodelRef>
</aas:submodelRefs>
<aas:conceptDictionaries />
</aas:assetAdministrationShell>
</aas:assetAdministrationShells>
<aas:assets />
<aas:submodels>
<aas:submodel>
<aas:idShort>ContactInformations</aas:idShort>
<aas:identification idType="IRI">https://example.com/ids/sm/1231_6162_1022_9579</aas:identification>
<aas:kind>Template</aas:kind>
<aas:semanticId>
<aas:keys>
<aas:key type="ConceptDescription" local="true" idType="IRI">http://admin-shell.io/zvei/nameplate/1/0/ContactInformations</aas:key>
line 810-828:
<aas:conceptDescriptions>
<aas:conceptDescription>
<aas:idShort>RoleOfContactPerson</aas:idShort>
<aas:identification idType="IRDI">0173-1#02-AAO204#003</aas:identification>
<aas:embeddedDataSpecification>
<aas:dataSpecificationContent>
<aas:dataSpecificationIEC61360>
<IEC:preferredName />
<IEC:shortName />
<IEC:unit />
<IEC:dataType />
<IEC:definition>
<IEC:langString lang="en">function of a contact person in a process</IEC:langString>
</IEC:definition>
</aas:dataSpecificationIEC61360>
</aas:dataSpecificationContent>
<aas:dataSpecification>
<aas:keys>
<aas:key type="GlobalReference" local="false" idType="IRI">http://admin-shell.io/DataSpecificationTemplates/DataSpecificationIEC61360/3/0</aas:key>
It would be nice if you could help me figure out what's wrong with this files. I don't know which tool or sdk is right or wrong. official templates <-> basyx-python-sdk = doesn't work basyx-python-sdk <-> aasx-server = doesn't work if i try to upload a aasx file that i created fresh with basyx tutorial 1.5 the server complains:
aasx-server | fail: IO.Swagger.Lib.V3.Middleware.ExceptionMiddleware[0]
aasx-server | Object reference not set to an instance of an object.
Same with the basyx testfiles.
Every project assert to support V3, but they don't work together.
PS:
You can zip the _aasx directories here individually to obtain the AASX files that are used to test this sdk.
That work's, i can read this files. But i would like to use templates. I don't want to create every file myself if i can avoid it. Thanks for your time.
If i replace all
/2/
with/3/
we get the same error:
You cannot just do that. The /2/
indicates that it is a version 2 XML file. Many things changed with the move to /3
, e.g. Assets
were removed and AssetInformation
was introduced instead, to name just one. You can use version 2 of the SDK, e.g. release 0.2.2 or the v2.0.1
branch. However, there are still a lot of errors in the templates, @zrgt has published fixed V2 templates here: https://github.com/zrgt/submodel-templates-fixed
if i replace all
http://admin
withhttps://admin
it fails with:
Did you perhaps also replace this in the .rels
files?
What's also confusing is the line numbers, because there is no occur of
http://admin-shell.io/aas/3/0
in this lines (line 1-28):
The curly braces {}
indicate an XML namespace in the error message. This corresponds to aas:
in the XML file. You can see the namespace corresponding to aas:
at the top of the XML file:
xmlns:aas="http://admin-shell.io/aas/3/0"
Oh wow, thank you for your detailed research!
I checked this Submodel Template's history and it's last been touched 2 years ago: https://github.com/admin-shell-io/submodel-templates/commits/main/published/Contact%20Information/1
Since v3.0 of the metamodel was released in April of last year, the SMT must be of version 2.0.1 of the metamodel (or even older). If you really need to use it, can you please try to open it with release 0.2.2 of our SDK? (Additionally, it would make sense to me to request an update of the SMT to v3.0 by the IDTA)
if i replace all http://admin with https://admin it fails with
Back then, the http://www.admin-shell-io
reference was still correct and part of the specification.
If i replace all /2/ with /3/ we get the same error
Since some of the model objects changed between v3.0 and v2.0.1, doing this will most likely break everything.
What's also confusing is the line numbers, because there is no occur of http://admin-shell.io/aas/3/0 in this lines (line 1-28)
Now it's me that gets confused. The file cannot be of v3.0. I have no idea, why the /3/0
even appears in any of the namespaces.
Every project assert to support V3, but they don't work together.
My conclusion that I draw from the information that I can see right now:
We try our best to follow the specification of the AAS verbatim.
Now it's me that gets confused. The file cannot be of v3.0. I have no idea, why the /3/0 even appears in any of the namespaces.
This is probably because @Kuchsn replaced /2/0
with /3/0
by himself in an effort to make them compatible.
Ok, a lot makes more sense now i think. Probably the Templates are all V1 or 2 if i understand the table correct. I'm a little bit disappointed, that things get updated so slow, wrong communication, miss understanding versioning. But thanks for your explanations. I will check out the fixed templates and if they don't work i will have to do it from scratch.. Thanks a lot @jkhsjdhjs and @s-heppner !
You're very welcome! I will close this issue now, but please let us know if you have further problems with using our SDK!
I'm a little bit disappointed, that things get updated so slow, wrong communication, miss understanding versioning.
Yeah, that annoys me, too. As you can see in #185, we get a lot of issues similar to yours. These minor changes like http://
-> https://
in the XML namespace and the removal of www.
in the OPC relationship types are just completely unnecessary and not properly highlighted in the spec, which is why a lot of SDK developers seem to miss them.
But thanks for your explanations. I will check out the fixed templates and if they don't work i will have to do it from scratch..
Sure, just keep in mind that these are for V2 and that you'll need the older basyx-python-sdk version.
Reading published AAS Submodel Templates
When trying to read published Submodel Templates from the provided aasx-files i get an error.
I tried to read them like this:
And i got the following error:
This error could be related to known issues #185 or #666, but it's also possible that it's a separate issue.