Reputation: 11
I am trying to validate an RDF file against a SHACL graph. I could not post the files here because they are huge-in-size, but I pasted down sample parts.
RDF:
ex:GUID_5ACC3D0F-28A1-4E83-A0F1-930748BCB013_9_4 a sf:Polygon, citygml:WallSurfaceType ; geo:asWKT "POLYGON Z ((78864.787 457866.289 10.244, 78866.931 457863.129 10.244, 78865.859 457864.71 12.256, 78864.787 457866.289 10.244))"^^geo:wktLiteral ; citygml:parent ex:GUID_5ACC3D0F-28A1-4E83-A0F1-930748BCB013_9 ; brep:directionNormalX -8.275105e-01 ; brep:directionNormalY -5.614502e-01 ; brep:directionNormalZ 2.790508e-04 ; valid:consecutiveSamePoints false ; valid:hasDuplicatedRings false ; valid:hasHoleOutside false ; valid:hasInnerNestedRings false ; valid:hasInteriorDisconnected false ; valid:hasIntersectedRings false ; valid:isCcwise true ; valid:isClosed false ; valid:isCollapsedtoLine false ; valid:isCoplanar false ; valid:isNormalsDeviated false ; valid:noSelfIntersection true ; valid:tooFewPoints false ; valid:wallSurfaceNormals true
SHACL:
<http://www.opengis.net/ont/sf#Polygon-isNormalsDeviated> a sh:PropertyShape ; sh:hasValue false ; sh:path <http://www.semanticweb.org/alper/ontologies/2024/3/8/untitled-ontology-32#isNormalsDeviated>
The question: on the RDF size, the relevant node has a value as "valid:isNormalsDeviated false ;", also the SHACL has "sh:hasValue false" constraint, but pyshacl engine could not match them, raises the error below:
Validation Report:
Constraint Violation in HasValueConstraintComponent (http://www.w3.org/ns/shacl#HasValueConstraintComponent): Severity: sh:Violation Source Shape: <http://www.opengis.net/ont/sf#Polygon-isNormalsDeviated> Focus Node: ex:GUID_5ACC3D0F-28A1-4E83-A0F1-930748BCB013_9_4 Result Path: <http://www.semanticweb.org/alper/ontologies/2024/3/8/untitled-ontology-32#isNormalsDeviated> Message: Node ex:GUID_5ACC3D0F-28A1-4E83-A0F1-930748BCB013_9_4-><http://www.semanticweb.org/alper/ontologies/2024/3/8/untitled-ontology-32#isNormalsDeviated> does not contain a value in the set: ['Literal("false" = False, datatype=xsd:boolean)']
What is the part I am missing? Thanks for the helps.
I have also tried to convert the Python booleans as "str(True).lower(), datatype=XSD.boolean" in my RDF converter but nothing has changed.
Upvotes: 0
Views: 76
Reputation: 11
I have solved the issue. The problem is coming from mismatching between RDF and SHACL paths. The entire RDF and SHACL data could be found in links below:
RDF data: RDF Data,
SHACL: SHACL Graph,
validation code: validation script.
I have changed the "valid" path in the RDF as same as in the SHACL, and the issue is resolved now.
Upvotes: 1