Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] SubmodelService: Exception Is Thrown When Resolving The Value-Only Representation Of A Submodel ( with Operation Elements not on toplevel + Capability elements) #460

Open
geso02 opened this issue Sep 17, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@geso02
Copy link
Contributor

geso02 commented Sep 17, 2024

Describe the bug

There is no ValueOnly representation for Operations and Capabilities. According to the IDTA definitions Page 98 these element should be ommited:

Operations and Capabilities are excluded from the output modifier’s scope since only data
containing elements are in the centre of focus. Consequently, in the serialization they are
omitted.

But an exception is thrown:
org.eclipse.digitaltwin.basyx.submodelservice.value.exception.ValueMapperNotFoundException: Value mapper not found for this submodel element TestOperation

To Reproduce
Steps to reproduce the behavior:

  1. Set up a Submodel Service instance with an operation (in my case TestOperation) that is not on toplevel
  2. GET /submodel/$value
    => {
    "timestamp": 1726560551837,
    "status": 500,
    "error": "Internal Server Error",
    "path": "/submodel/$value"
    }

In addition, I get the same error when calling
GET /submodel/submodel-elements/BaseOperations.TestOperation/$value

Expected behavior

The submodel should be returned in the value-only representation without operations or capabilities.

Perhaps, for a GET-Operation on /submodel/submodel-elements/BaseOperations.TestOperation/$value, we should rather return a 404, because there is no value-only representation of an operation.

BaSyx (please complete the following information):

  • BaSyx Version [v2.0]
  • BaSyx SDK [Java]
  • AAS Version [DotAAS V3]

System (please complete the following information):

  • OS: [Docker on Windows]
  • CPU architecture: [x86, ]
@geso02 geso02 added the bug Something isn't working label Sep 17, 2024
@geso02
Copy link
Contributor Author

geso02 commented Sep 17, 2024

At this code position Operations are filtered correctly. Only Capabilities are perhaps missing are missing. I will check thy also Operations are not filtered in my setup.

@geso02
Copy link
Contributor Author

geso02 commented Sep 17, 2024

The problem occurs if the Operation is not on toplevel. The filter just handles the toplevel elements.

submodelElements.stream().filter(SubmodelValueOnly::hasValueOnlyDefined).map(ValueMapperUtil::toValueOnly).collect(Collectors.toMap(ValueOnly::getIdShort, ValueOnly::getSubmodelElementValue));

We need to adjust ValueMapperUtil.toValueOnly. hasValueOnlyDefined only handles the toplevel elements. And in addition add a Capabilities filter in ValueMapperUtil.

The toValueOnly function should only include values of a SubmodelElementCollection/List that are not of type Capability or Operation.

I updated the issue text

@geso02 geso02 changed the title [BUG] SubmodelService: Exception Is Thrown When Resolving The Value-Only Representation Of A Submodel ( with Operation Elements ) [BUG] SubmodelService: Exception Is Thrown When Resolving The Value-Only Representation Of A Submodel ( with Operation Elements not on toplevel + Capability elements) ) Sep 17, 2024
@geso02 geso02 changed the title [BUG] SubmodelService: Exception Is Thrown When Resolving The Value-Only Representation Of A Submodel ( with Operation Elements not on toplevel + Capability elements) ) [BUG] SubmodelService: Exception Is Thrown When Resolving The Value-Only Representation Of A Submodel ( with Operation Elements not on toplevel + Capability elements) Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Ready
Development

No branches or pull requests

1 participant