eclipse-basyx / basyx-java-sdk

java-sdk
MIT License
25 stars 32 forks source link

Qualifiable.getQualifiers() always returns an empty LinkedHashSet #326

Closed ghost closed 1 year ago

ghost commented 1 year ago

How to reproduce

  1. Create a AASX file using the AASX Package Explorer with an Operation in a Submodel
  2. Add a Quailfier "invocationDelegation" to the Operation
  3. Export the Submodel to JSON
  4. Put the Submodel in form of a JSON inside a AAS hosted in BaSyx
  5. Try to invoke the Operation

The error

When trying to invoke the function you will get an answer, that it is not possible for that path, because Qualifiable.getQualifiers always returns an empty LinkedHashSet

Proposed solution

The BaSyx backend checks, if the operation is a delegated one (undelegated operations are not yet supported AFAIK). To check that, the OperationProvider.invokeOperation calls DelegatedInvocationManager.isDelegatingOperation. Here it gets all qualifiers from the operation and tries to find one that has the above mentioned qualifier in it. Problem is, that when calling operation.getQualifiers it tries to retrieve the field with the name "qualifiers" (Qualifiable.QUALIFIERS). But when looking at the json (and thus the internal representation), there is no field "qualifiers" as it is called "constraints"

image image image

A quick fix would be to set Qualifiable.QUALIFIERS to "constraints" and possibly renaming Qualifiable.QUALIFIERS to Qualifiable.CONSTRAINTS

image

Additional remarks

It could also be an error coming from the AASX Package Explorer, if so I will post my issue there.

FrankSchnicke commented 1 year ago

This seems to be a bug in the AASX Package Explorer. If you take a look at DotAAS Part 1 V2.0.1 p. 233 following, this is stated:

"Qualifiable": {
    "type": "object", 
    "properties": { 
        "qualifiers": { 
            "type": "array", 
            "items": { "$ref": "#/definitions/Constraint" } 
        } 
    } 
}
ghost commented 1 year ago

Thank you for the reply, I will repost my issue there :)

FrankSchnicke commented 1 year ago

Closed as not related to BaSyx.