basyx-python-sdk icon indicating copy to clipboard operation
basyx-python-sdk copied to clipboard

Write complete `ObjectStore` to AASX

Open s-heppner opened this issue 2 years ago • 4 comments

Currently, only the data referenced by AssetAdministrationShells specified by their Identifier when calling aasx.write() is written to AASX. We should implement a convinience function that makes sure that all data inside an ObjectStore is written to an AASX file, if wished.

s-heppner avatar Jan 04 '24 09:01 s-heppner

Is this not already possible using AASXWriter.write_aas?

Frosty2500 avatar Apr 18 '25 14:04 Frosty2500

No, AASXWriter.write_aas only writes the given AssetAdministrationShell-object together with all the other objects that this AAS references and that are inside the given ObjectStore. If the ObjectStore would contain a Submodel that is not referenced by the AAS, it would not be written.

A feature request, I've been getting several times is to basically dump the whole content of the ObjectStore into an AASX.

s-heppner avatar Apr 22 '25 07:04 s-heppner

And AASXWriter.write_all_aas_objects? It seems to just dump the whole content of the given ObjectStore into an AASX. Or am I misunderstanding it?

Frosty2500 avatar Apr 22 '25 11:04 Frosty2500

That's the method that gets called from AASXWriter.write_aas:

https://github.com/eclipse-basyx/basyx-python-sdk/blob/288ea49162cf89b1f5c3fdfa0ca2b55fc5950082/sdk/basyx/aas/adapter/aasx.py#L485-L518

Specifically, note the docstring: https://github.com/eclipse-basyx/basyx-python-sdk/blob/288ea49162cf89b1f5c3fdfa0ca2b55fc5950082/sdk/basyx/aas/adapter/aasx.py#L509-L510

You are correct, in the implementation, we take a complete ObjectStore in the argument objects as the objects to write.

Now there are two options: Either the implementation does not write all objects and then the docstring is correct:

 :param objects: The objects to be written to the AASX package. Only these Identifiable objects (and included
            Referable objects) are written to the package.

Or the implementation does write all objects, but then the docstring is confusing.

Could you actually try it out: Create an ObjectStore with AAS, Submodel that is referenced by the AAS and a Submodel that is not referenced by the AAS, write it to AASX and see if the latter Submodel is contained or not?

s-heppner avatar May 31 '25 10:05 s-heppner