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

SHACLC mixes up multiple PropertyShapes of the same NodeShape #2851

Closed
VladimirAlexiev opened this issue Nov 19, 2024 · 2 comments · Fixed by #2912
Closed

SHACLC mixes up multiple PropertyShapes of the same NodeShape #2851

VladimirAlexiev opened this issue Nov 19, 2024 · 2 comments · Fixed by #2912
Assignees

Comments

@VladimirAlexiev
Copy link

VladimirAlexiev commented Nov 19, 2024

Version

5.2.0

What happened?

Look at a complex shape https://github.com/Sveino/Inst4CIM-KG/blob/develop/source/CGMES/v3.0/SHACL/ttl/61970-302_Dynamics-AP-Con-Complex-SHACL_v3-0-0.ttl (CIM/CGMES is electrical data).

Search for "GovGAST3" and you find a node that refers to multiple properties:

dyu:GovGAST3  a        sh:NodeShape ;
        sh:property     dyu:GovGAST3.ty-valueRange , dyu:GovGAST3.ttc-valueRange , dyu:GovGAST3.tsi-valueRange , dyu:GovGAST3.tg-valueRange , dyu:GovGAST3.td-valueRange , dyu:GovGAST3.tc-valueRange , dyu:GovGAST3.tac-valueRange ;
        sh:targetClass  cim:GovGAST3 .

dyu:GovGAST3.ttc-valueRange
        a                sh:PropertyShape ;
        sh:description   "Time constant of thermocouple (Ttc) (>= 0).  Typical value = 2,5." ;
        sh:group         dyu:ValueConstraintsGroup ;
        sh:message       "The value is negative." ;
        sh:minInclusive  "0.0"^^xsd:float ;
        sh:name          "C:302:DY:GovGAST3.ttc:valueRange" ;
        sh:order         748 ;
        sh:path          cim:GovGAST3.ttc ;
        sh:severity      sh:Violation .
...

When converted to SHACLC, all these props are mixed together:

shacl.bat p -out=c 61970-302_Dynamics-AP-Con-Complex-SHACL_v3-0-0.ttl

shape dyu:GovGAST3 -> cim:GovGAST3 {
    message="The value is negative." .
    cim:GovGAST3.tac minInclusive="0.0"^^xsd:float .
    message="The value is negative." .
    cim:GovGAST3.tc minInclusive="0.0"^^xsd:float .
    message="The value is negative." .
    cim:GovGAST3.td minInclusive="0.0"^^xsd:float .
    message="The value is negative." .
    cim:GovGAST3.tg minInclusive="0.0"^^xsd:float .
    message="The value is negative." .
    cim:GovGAST3.tsi minInclusive="0.0"^^xsd:float .
    message="The value is negative." .
    cim:GovGAST3.ttc minInclusive="0.0"^^xsd:float .
    message="The value is negative." .
    cim:GovGAST3.ty minInclusive="0.0"^^xsd:float .
}

If the messages were different, it would lead to mixup of which message is for which constraint.

Relevant output and stacktrace

No response

Are you interested in making a pull request?

None

@afs
Copy link
Member

afs commented Nov 19, 2024

@VladimirAlexiev What should the SHACL-C look like?

@afs afs added SHACL and removed bug labels Nov 19, 2024
@VladimirAlexiev
Copy link
Author

VladimirAlexiev commented Nov 20, 2024

@afs I'm looking at https://rawgit2.com/VladimirAlexiev/shacl/shaclc-grammars/shacl-compact-syntax/grammar/shaclc-ANTLR.html#constraint:

  • nodeShape has multiple constraints, separated by .
  • each constraint can be a propertyShape
  • propertyShape consists of a path followed by multiple propertyAtoms
  • propertyAtom can be propertyValue, which includes message, minInclusive etc

So indeed PropertyShapes are expressed as a . separated sequence,
but path should come first, and there should be only one . per path.

I think the SHACLC should look like this. It would be nice to use some newlines and identations to emphasize the nesting:

shape dyu:GovGAST3 -> cim:GovGAST3 {
    cim:GovGAST3.tac
      minInclusive="0.0"^^xsd:float
      message="The value is negative." .
    cim:GovGAST3.tc
      minInclusive="0.0"^^xsd:float
      message="The value is negative." .
    cim:GovGAST3.td
      minInclusive="0.0"^^xsd:float
      message="The value is negative." .
    cim:GovGAST3.tg
      minInclusive="0.0"^^xsd:float
      message="The value is negative." .
    cim:GovGAST3.tsi
      minInclusive="0.0"^^xsd:float
      message="The value is negative." .
    cim:GovGAST3.ttc
      minInclusive="0.0"^^xsd:float
      message="The value is negative." .
    cim:GovGAST3.ty
      minInclusive="0.0"^^xsd:float
      message="The value is negative." .
}

@afs afs added the bug label Nov 21, 2024
afs added a commit to afs/jena that referenced this issue Dec 29, 2024
afs added a commit to afs/jena that referenced this issue Dec 29, 2024
@afs afs self-assigned this Dec 29, 2024
afs added a commit that referenced this issue Jan 1, 2025
@afs afs closed this as completed in #2912 Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants