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] Validation fails for value type bamm:curie for bamm-c:UnitReference characteristic in SAMM-CLI 2.2.2 #382

Closed
bs-jokri opened this issue Jul 5, 2023 · 9 comments · Fixed by #417 or #419
Labels
acknowledged Has been viewed by one of the maintainers and is ready for further work, discussion or other steps.

Comments

@bs-jokri
Copy link
Contributor

bs-jokri commented Jul 5, 2023

Describe the bug
Trying to validate a model with the following snippet with bamm-cli-2.1.3 is correct but with SAMM-CLI 2.2.2 not.

:measurementUnit a bamm:Property;
    bamm:preferredName "Measurement Unit"@en;
    bamm:description "Unit of measurement for the quantity of serialized objects."@en;
    bamm:characteristic bamm-c:UnitReference;
    bamm:exampleValue "kW"^^bamm:curie.

which validated. With the new SAMM-CLI the following validation error appears:
https://github.com/eclipse-tractusx/sldt-semantic-models/tree/main/io.catenax.single_level_bom_as_specified/1.0.0

java -jar samm-cli-2.2.2.jar  aspect io.catenax.single_level_bom_as_specified/1.0.0/SingleLevelBomAsSpecified.ttl validate
Semantic violations were found:



> :measurementUnit :

  The datatype 'bamm:curie' of the exampleValue neither matches nor can be cast to the Property's ':measurementUnit' Characteristic's dataType.

switching to the SAMM 2.0.0 meta model resolves the problem. However, this is not possible for released models.

Where
SAMM-CLI 2.2.2

Screenshots
na

Additional context
Add any other context about the problem here.

@bs-jokri bs-jokri added the bug Something isn't working label Jul 5, 2023
@chris-volk chris-volk added acknowledged Has been viewed by one of the maintainers and is ready for further work, discussion or other steps. and removed bug Something isn't working labels Jul 10, 2023
@RaMisess
Copy link
Contributor

Validating the given model with the samm-cli built from the current "main" branch works. It looks like the bug has been fixed through some of the recent updates.

@bs-jokri
Copy link
Contributor Author

The problem seem still to exist as can be verified with model eclipse-tractusx/sldt-semantic-models#257

@ysrbo
Copy link
Contributor

ysrbo commented Aug 18, 2023

:TimeUnitEnum a samm-c:Enumeration ;
   samm:preferredName "Time Unit Enum"@en ;
   samm:description "Enumerates all time units"@en ;
   samm:dataType samm:curie ;
   samm-c:values ( "unit:secondUnitOfTime"^^samm:curie "unit:minuteUnitOfTime"^^samm:curie "unit:hour"^^samm:curie "unit:day"^^samm:curie "unit:week"^^samm:curie "unit:month"^^samm:curie "unit:year"^^samm:curie ) .

leads to

Validation failed:
Validation succeeded, but an error was found while processing the model. This indicates an error in the model validation; please consider reporting this issue including the model at https://github.com/eclipse-esmf/esmf-semantic-aspect-meta-model/issues -- Could not load Aspect model, please make sure the model is valid: Literal can not be parsed: unit:secondUnitOfTime^^urn:samm:org.eclipse.esmf.samm:meta-model:2.0.0#curie

@bs-jokri
Copy link
Contributor Author

bs-jokri commented Aug 22, 2023

A similar problem occurs also for same-cli 2.3.1 when validating model
https://github.com/eclipse-tractusx/sldt-semantic-models/pull/283/files

which results in

java -Dpolyglot.engine.WarnInterpreterOnly=false -jar samm-cli-2.3.1.jar aspect io.catenax.generic.digital_product_passport/2.0.0/DigitalProductPassport.ttl validate

Validation failed:
Validation succeeded, but an error was found while processing the model. This indicates an error in the model validation; please consider reporting this issue including the model at https://github.com/eclipse-esmf/esmf-semantic-aspect-meta-model/issues -- Could not load Aspect model, please make sure the model is valid: Literal can not be parsed: unit:day^^urn:samm:org.eclipse.esmf.samm:meta-model:2.0.0#curie

@bs-jokri
Copy link
Contributor Author

we had this issue in the past and it was fixed with
#303

probably this is a regression of this bug?

@bs-jokri
Copy link
Contributor Author

Hi @chris-volk, @RaMisess, what @ysrbo identified in his comment affects us at several models. Do you have an idea, why this happens?

@RaMisess
Copy link
Contributor

RaMisess commented Aug 24, 2023

Yes, the problem was that the literals with data type "curie", like "unit:day"^^samm:curie, were not properly migrated to the current version of the metamodel. This resulted in failure of the validation, where the model is instantiated as a last step of the process. As long as the latest version of the metamodel was 2.0.0, which matched the version of the model, there was no migration and everything was fine. With the introduction of metamodel 2.1.0 the migrator kicks in, which surfaced this problem.

@github-actions
Copy link

github-actions bot commented Sep 1, 2023

Release v2.3.2 addresses this.

ysrbo added a commit to bci-oss/esmf-sdk that referenced this issue Sep 1, 2023
ysrbo added a commit to bci-oss/esmf-sdk that referenced this issue Sep 14, 2023
@github-actions
Copy link

Release v2.4.0 addresses this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledged Has been viewed by one of the maintainers and is ready for further work, discussion or other steps.
Projects
None yet
4 participants