eclipse-esmf / esmf-aspect-model-editor

Manage Aspect Models visually — create, validate, create artefacts, persist file based
https://eclipse-esmf.github.io/ame-guide/introduction.html
Mozilla Public License 2.0
21 stars 7 forks source link

[BUG] Conversion to 2.0.0 Trait & Constraint connection #36

Closed catroest closed 1 year ago

catroest commented 1 year ago

Describe the bug The bug appears in the editor when opening a model with version 1.0.0. Multiple constraints/traits are not correctly associated with the corresponding property. So no property links to (here in the example, these two) traits.

Where The problem appears in the editor in the version: AME version: 4.2.1

BAMM version: 2.0.0

Screenshots image

Additional context Some other traits where loaded correctly. It could be connected to situation that several properties point to these traits.

chris-volk commented 1 year ago

Dear @catroest , sorry for reacting slowly. Do you have a (preferably small) example ttl file illustrating this issue? Thanks very much.

catroest commented 1 year ago

@chris-volk please look at the attached file. testfileConstraint.zip I shortened it for a better overview. The original is also on github in: https://github.com/eclipse-tractusx/sldt-semantic-models/tree/main/io.catenax.pcf

michelu89 commented 1 year ago

Dear @catroest,

after examining your example and reviewing the original file on https://github.com/eclipse-tractusx/sldt-semantic-models/tree/main/io.catenax.pcf, I observed that the two traits have missing properties.

:NonEmptyStringConstraint a samm-c:LengthConstraint ;
   samm:preferredName "Non Empty String Constraint"@en ;
   samm:description "Constraint for ensuring that a string has at least one character."@en ;
   samm-c:minValue "1"^^xsd:nonNegativeInteger .

:NonEmptyStringTrait a samm-c:Trait ;
   samm-c:baseCharacteristic :NonEmptyString ;
   samm-c:constraint :NonEmptyStringConstraint .

It is possible that something went wrong during the export in version v4.2.1, which resulted in the properties not being included.

Regrettably, I was unable to replicate this issue in both v4.2.1 and the latest release, v4.3.0.

I would recommend trying out the newest version and reinserting the properties.

Please be aware that v4.3.0 currently has a bug regarding the validation and export of custom units, but this will be addressed in the upcoming versions.

To resolve this, you will need to manually modify the following for the unit after exporting it with v4.3.0. (Unfortunately, this can only be validated with the samm-cli

:Emission a samm:Unit ;
   samm:preferredName "Emission"@en ;
   samm:symbol "kgCO2e/kg" .
catroest commented 1 year ago

After a little deeper research, it was noticed that the original file also does not have the connection between Property and Trait. It looks like one of our modelers made a mistake here. This is the error and what it should look like: image

But then the problem here is that this is not shown as an error. Unless there is a legitimate case that a trait may be described without being called by a property, I would suggest that this be flagged as an error by the cli. I know its not really an "error" if something is described but not used, but mayce a warning can be implemented, that there is something just "flying around without a connection".

I'm sorry if there was any major extra work here for this error on our end.

catroest commented 1 year ago

For the unit error: After changing to samm and saving the change in the turtle file, it will be reverted again after opening the file with the editor. Is this intended?

michelu89 commented 1 year ago

As mentioned earlier, the handling of the specific task you encountered is currently a manual step and can only be validated using the SAMM CLI. Unfortunately, the Aspect Model Editor in version 4.3.0 is unable to handle this task correctly. However, I would like to inform you that this issue has already been addressed and resolved.

You can find the resolution in the following GitHub pull request: GitHub Pull Request #48. The necessary changes have been implemented and verified, ensuring correct handling of the task in question.

The fix will be made available in the upcoming release of the Aspect Model Editor, which is scheduled to be released soon. Once the new version is released, you will be able to utilize the updated Aspect Model Editor to perform the task accurately and seamlessly.

catroest commented 1 year ago

Thank you for the information!

michelu89 commented 1 year ago

Should be fixed on v4.4.0