Dear Francesco,
currently, there is no example for excplicitely writing the JSON serialization of the AAS to a file in the Java SDK. The entry in the database is generated by the SQLDirectoryProvider and only contains the Descriptor
of the AAS for the registry without the actual AAS and submodels.
You can get the content of the serialization from the log, still. Moreover, it is possible to “manually” serialize a created or received
model using the GSONTools. In the following, you can see a short snippet that can be used to write the serialized submodel to a file by modifying the Test snippet at
basyx.examples/src/test/java - org.eclipse.basyx.examples.snippets.aas.submodels.ConnectToAASSubModelVAB::accessSubModel():
Map<String, Object>
submodel = (Map<String, Object>)
connSubModel1.getModelPropertyValue("/");
GSONTools
serializer =
new GSONTools(new
DefaultTypeFactory());
String
serializedSubmodel =
serializer.serialize(submodel);
System.out.println("----------------");
System.out.println("Serialized:
" +
serializedSubmodel);
System.out.println("----------------");
FileWriter
fw =
new FileWriter("submodelExample.json");
fw.write(serializedSubmodel);
fw.close();
The same snippet can be used for other examples, e.g. by serializing a local AAS created in the Test snippet at
basyx.examples/src/test/java - org.eclipse.basyx.examples.snippets.aas.CreateAAS::createAAS():
String
serializedAAS =
serializer.serialize(aas);
Note, that these examples do not include a full AAS or submodel, because they are meant to demonstrate how the SDK works and not to show the structure of the standardized models. Also, the SDK is still work in
progress, so the interfaces and the serialization will change.
You can find more information about this in the standard document for the AAS:
https://www.zvei.org/en/press-media/publications/details-of-the-asset-administration-shell/
Best regards,
Daniel Espen
--
Espen, Daniel
Engineer Embedded Software Engineering
Fraunhofer IESE
Fraunhofer-Platz 1 | 67663 Kaiserslautern
Tel: +49 631 / 6800-2131 | Fax: +49 631 / 6800-9 2131
www.iese.fraunhofer.de
Mail: Daniel.Espen@xxxxxxxxxxxxxxxxxx
Hi to all basyx development team,
My name is Francesco Lo Piccolo and I work FOR Engineering Ingegneria Informatica R&D department.
I'm currently trying to integrate the Basyx component THAT I'VE JUST compiled according to the info provided at
https://wiki.eclipse.org/BaSyx:BaSyx.Documentation.SDK.Java.Build .
Now, I'm trying to run the various examples in the Sdk, Examples, and Component components but unfortunately I haven't been able so far to produce an AAS file with data.
For example, I used the RunAASDevice example (basyx.examples component), which writes an AAS file to the postgres database. This AAS file has 3 submodels, but they are empty AND I haven't found any example data.
Maybe I'm wrong to use the RunAASDevice example (basyx.examples components) or other examples. Could you suggest me an Example with which to be able to produce an AAS file HAVING at least one submodel and some data ?
I attach the empty AAS file obtained
Looking forward to your feedback.
Best Regards
Francesco Lo Piccolo
Research & Development Lab
Research & Innovation Division
francesco.lopiccolo@xxxxxx
Engineering Ingegneria Informatica spa
Viale Regione Siciliana, 7275 - 90146 Palermo
Tel. 091 - 7511873
Cell. 3297405169
Skype: f_lopic
www.eng.it