Write complete `ObjectStore` to AASX
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.
Is this not already possible using AASXWriter.write_aas?
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.
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?
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?