Open JS-Aibel opened 1 month ago
+1
It seems like the sdk serialization starts with a key ‘submodels’, which is an array of submodels. While the Package Explorer is serializing as a submodel key/value pair, except for it missing the attribute modelType, it looks like an element in the submodels array from the serialization.
Export Submodel from JSON
made the deserialization with the basyx-python-sdk work.I guess the question is whether the SDK or the Package Explorer needs to be changed to improve their interoperability?
Hi @JS-Aibel,
Could you please share the JSON file that can be used to reproduce this issue at AASPE end?
Thank you for the reply, @juileetikekar.
JSON form basyx-python-sdk
{
"submodels": [
{
"modelType": "Submodel",
"id": "https://acplt.org/Simple_Submodel"
}
]
}
By removing the submodels
array, leaving only the single element, Package Explorer is able to import the submodel. Could it be possible that when Package Explorer encounters a "submodels" array, it should import each element within that array?
Modified Version of JSON with ‘Submodels’ Array Removed
{
"modelType": "Submodel",
"id": "https://acplt.org/Simple_Submodel"
}
Describe the bug When using the methods in the basyx-python-sdk to serialize a submodel to a JSON file, the file can not be imported in the Package Explorer with the use of Import Submodel from JSON.
To Reproduce By using the basyx-python-sdk do the following.
identifier = 'https://acplt.org/Simple_Submodel' submodel = model.Submodel(id_=identifier)
obj_store: model.DictObjectStore[model.Identifiable] = model.DictObjectStore() obj_store.add(submodel)
with open('data.json', "w") as file: basyx.aas.adapter.json.write_aas_json_file(file, obj_store)