FraunhoferIOSB / FAAAST-Service

FA³ST - Fraunhofer Advanced Asset Administration Shell Tools (for Digital Twins)
Other
60 stars 12 forks source link

Set Multiple AAS Environment Files as Input #172

Open mehtanin opened 2 years ago

mehtanin commented 2 years ago

Description Does FAAAST supports multiple aas environment files as input while starting the service? If so, what is the procedure?

To Reproduce Steps to reproduce the behavior:

  1. To start the service 'java -jar starter-{version}.jar -m {path/to/your/AASEnvironment}'
  2. Here, how can we set multiple files in the aas environment path as the input of FAAAST service?

Expected behavior Multiple aas environment files will be given as input when starting the FAAAST service.

Output The HTTP endpoint will return results from multiple aas environment files based on the query.

mjacoby commented 2 years ago

This feature is not supported. We are aware that some users would like to have this feature but currently we cannot provide any details on if/when it will be available in the future. This is also because merging multiple environments becomes quite complex once there are collisions/overlaps in the different files.

As a quick work-around you could use the FA³ST Package Explorer Converter; a tool intended to convert JSON files exported from the AASX Package Explorer to be FA³ST-compliant. However, it also has a (rather primitive) merge feature. You'll have to manually merge your files into one with this and then load the merged file into FA³ST.

tsaihsing3 commented 5 months ago

Is multiple aas as input while starting the service supported in latest version now, using FileStorageSystem?

mjacoby commented 5 months ago

No, it is still not supported. The FileStorageFileSystem you are referring to is an implementation of the FileStorage interface which is responsible for reading/writing complementary files, e.g. files like pictures or PDFs or such that are linked to the model via the submodel element File or AssetInformation.thumbnail.

The reason it is not yet supported to load multiple model files is that it would require rather changes to the FilePersistence for storing updates, i.e. when choosing to update the original files, that are not trivial.

Could you maybe provide some insight in your use case and how you would like to operate FA³ST using multiple models? Are you using in-memory or file-based persistence? Do you maybe only need to create a read-only instance, i.e. users should not be able to modify the model via API once FA³ST is started?

tsaihsing3 commented 5 months ago

Thanks for your detailed explanation! I understand it now. I was only reading the documentation and do not have use cases in mind.

sirchnik-xitaso commented 2 weeks ago

With the recently 😄 merged proprietary '/import'-Feature (similar to basyx '/upload') uploading multiple aasx is easier possible now, but merging is still primitive right?

cat $e | curl -H "Content-Type: application/asset-administration-shell-package+xml" -X POST --data-binary @- http://localhost:8080/api/v3.0/import
PS I guess '/reset' should not use GET (CSRF). ``` ❯ : curl -X 'POST' http://localhost:8080/api/v3.0/reset { "messages" : [ { "messageType" : "Error", "text" : "method 'POST' not allowed for URL 'reset' (allowed methods: GET)", "timestamp" : "2024-11-13T08:35:24.838+00:00" } ] } ```
mjacoby commented 2 weeks ago

Correct. The new /import feature does not do any merging. In fact, it will only import elements (AAS, submodel, concept description, files) that are not present in the server. As a response you will get a JSON object listing all errors that occurred looking like this

{
    "fileErrors": {
        "[filename]": "[error message]",
        ...
    },
    "modelErrors": {
        "[serialized reference to element that caused the error]": "[error message]",
        ...
    }
}

In the future, this might be extended to provide more options about how to handle conflicts but right now, no merging algorithm exists in FA³ST.

/reset is currently using GET as it does not require any input, i.e., POST is not required. The idea was to make it easy to call /reset e.g. via Browser. However, I can see the argument that POST should be used as it is not reading but manipulating data. We might change this in the future as both features are very new and not yet released in any official release besides the latest SNAPSHOT.