w3c / data-shapes

RDF Data Shapes WG repo
87 stars 33 forks source link

SHACL Shapes to Validate Shapes Graphs #121

Open griddigit opened 4 years ago

griddigit commented 4 years ago

Hello

Appendix C here https://www.w3.org/TR/shacl/#shacl-shacl provides a link (http://www.w3.org/ns/shacl-shacl ) to a shapes graph to validate shapes.

I see that this is dated from 04-04-2017 and could not find more recent version. My first question is if this is relally the case and this is the reference. if yes, I am getting 2 types of validation errors. I made a test with a few shapes the results and the test shapes are attached. Could you help me judge what is write and what wrong?

result.txt

testValidation.zip

best regards Chavdar

griddigit commented 4 years ago

Just to add that if I try to validate Person example file which is here: https://github.com/w3c/data-shapes/blob/gh-pages/data-shapes-test-suite/tests/core/complex/personexample.ttl I am getting the same kind of validation errors

I am using thsi validation engine: Resource reportResource = ValidationUtil.validateModel((shapesModelToValidate, shaclShaclModelreference, true); RDFDataMgr.write(System.out, reportResource.getModel(), RDFFormat.TURTLE);

HolgerKnublauch commented 4 years ago

Right, this file seems to have the problem that it doesn't recognize sh:paths that are IRIs, but only covers the blank node cases. I am attaching a slight modification that addresses this problem - using sh:or instead of sh:node in shsh:PropertyShapeShape. (the xone error is a follow-up problem).

I don't have much memory about the origins of this file other than that it was created in a last-minute rush to satisfy a reviewer right before SHACL was approved. A future revision should replace that file, so I am leaving this ticket open.

shacl-shacl.ttl.txt

griddigit commented 4 years ago

Thank you Holger. The changes you did fixed the issue. It will be good that official file to be updated as you said.

griddigit commented 4 years ago

Another question appeared. Is it correct to state that sh:name and sh:description are only applicable for sh:PropertyShape? It looks like this from the vocabulary. If Yes, the shacl-shacl.ttl may need to be updated on this.

Regards

HolgerKnublauch commented 4 years ago

Yes these two only make sense to use with property shapes. I don't see why this would affect shacl-shacl because even node shapes or any other resource may potentially have values for these properties, given that RDF resources are in an open world and the sh:NodeShape shape is not "closed". So there wouldn't really be anything to validate.

griddigit commented 4 years ago

Hello, I am having the following shapes and I think it might be a potential problem in SHACL Shapes to validate Shapes Graph. Is it a problem with shacl-shacl.ttl.txt or the sh:path should be done differently? I am getting the right response of the validation of data graph with this Sequence path as list

Shapes ...................................... exsh:Test a sh:NodeShape ; sh:property exsh:pathTest; sh:targetClass ex:testClass.

exsh:pathTest a sh:PropertyShape ; sh:class ex:MyCompound ; sh:message "Compound datatype violation." ; sh:path (ex:testClass.attr1 cim:CompClass.status) ; sh:nodeKind sh:BlankNode ; sh:severity sh:Violation .

................................. The errors are Source: shsh:ShapeShape Constraint Component: sh:XoneConstraintComponent, sh:OrConstraintComponent Path: sh:path Message: 1) Value has 2 shapes out of 2 in the sh:xone enumeration 2)Value has none of the shapes in the sh:or enumeration

Best regards Chavdar

HolgerKnublauch commented 4 years ago

Speculating... is it possible that you have used the TopBraid SHACL API 1.3.x to run this? Some versions had a bug related to sh:xone, which is fixed in version 1.3.2. I have tried TBC 6.3.1 and can reproduce that errors are showing up, while the current update shows no errors.

griddigit commented 4 years ago

Hello Yes, I am using version 1.3.1. I just say that there is version 1.3.2. I will try it. If the errors are real errors and not due the shacl-shacl, could you tell me what should be the right way of specifing sh:path so that I have sequence paths and can validate nested structure?

Edit: ops I think i misread I message. Sorry. So if the 1.3.2 fixes this issue already then all is fine :)

Best regards Chavdar

griddigit commented 4 years ago

Hello, I can confirm that the API 1.3.2 is OK and the thing I reported on 26 March is solved. Thinket remains open due to Holger's comment on 4 Jan

Best regards Chavdar