eclipse-thingweb / td-tools

Utility libraries for W3C Thing Descriptions and Thing Models
https://thingweb.io
Other
4 stars 3 forks source link

[AID] Handling of semantic annotations #54

Open egekorkan opened 1 month ago

egekorkan commented 1 month ago

If a TD has a semantic annotation, it is simply ignored in the conversion. This PR adds a basic support in this direction. I am not exactly satisfied since there can be many corner cases. The worst is if there is an additional context without a prefix. That would mean looking into the context for each possible unknown key. I have added a good amount of comments in the code but also adding now some in the PR review.

codecov-commenter commented 3 weeks ago

Codecov Report

Attention: Patch coverage is 75.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 65.99%. Comparing base (a6943fa) to head (7370556).

Files with missing lines Patch % Lines
node/aas-aid/src/asset-interfaces-description.ts 75.00% 7 Missing and 2 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #54 +/- ## ========================================== + Coverage 65.23% 65.99% +0.76% ========================================== Files 1 1 Lines 558 594 +36 Branches 224 231 +7 ========================================== + Hits 364 392 +28 - Misses 155 162 +7 - Partials 39 40 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

egekorkan commented 3 weeks ago

I have fixed the failing test, the assumption based code and adding the new test now

danielpeintner commented 2 weeks ago

I think the code looks much better now and I hope we can step-by-step answer some of the TODOs in the source code. Note: I think you missed to commit the test...

egekorkan commented 2 weeks ago

Note: I think you missed to commit the test...

I was still working on them :D I have added test specifically targeting the semantics conversion.

EDIT: I have no idea why the JSON Schema validation fails. So it is commented out now. Maybe @Kaz040 has an idea?

Kaz040 commented 2 weeks ago

Note: I think you missed to commit the test...

I was still working on them :D I have added test specifically targeting the semantics conversion.

EDIT: I have no idea why the JSON Schema validation fails. So it is commented out now. Maybe @Kaz040 has an idea?

I will look at it @egekorkan . Can you please send me the TD you are using for testing and the converted AID?

Kaz040 commented 2 weeks ago

Note: I think you missed to commit the test...

I was still working on them :D I have added test specifically targeting the semantics conversion.

EDIT: I have no idea why the JSON Schema validation fails. So it is commented out now. Maybe @Kaz040 has an idea?

The validation fails because of "myPrefix1_suffix4" term that was converted. The schema does not accept terms that are not defined in AID specification. The terms that are defines are mostly TD terms and protocol binding terms (HTTP,Modbus, and MQTT).

TD: image

AID: image