shacl-engine
Version:
A fast RDF/JS SHACL engine
241 lines (230 loc) • 9.48 kB
text/turtle
@prefix ex: <http://example.org/>.
@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix sh: <http://www.w3.org/ns/shacl#>.
@prefix shn: <https://schemas.link/shacl-next#>.
@prefix sht: <http://www.w3.org/ns/shacl-test#>.
<> a mf:Manifest;
mf:entries (<or-multi-list>).
ex:InvalidRectangle1 a ex:RectangleWithArea;
ex:height 3.
ex:InvalidRectangle2 a ex:RectangleWithArea;
.
ex:RectangleWithArea a rdfs:Class, sh:NodeShape;
rdfs:subClassOf rdfs:Resource;
sh:or(ex:RectangleWithAreaHeightWidth),(ex:RectangleWithAreaArea).
ex:RectangleWithAreaArea
sh:property [
sh:minCount 1;
sh:path ex:area
].
ex:RectangleWithAreaHeightWidth
sh:property [
sh:minCount 1;
sh:path ex:height
], [
sh:minCount 1;
sh:path ex:width
].
ex:ValidRectangle1 a ex:RectangleWithArea;
ex:height 3;
ex:width 2.
ex:ValidRectangle2 a ex:RectangleWithArea;
ex:area 6;
ex:height 3;
ex:width 2.
ex:ValidRectangle3 a ex:RectangleWithArea;
ex:area 6;
ex:height 3.
<or-multi-list> a sht:Validate;
rdfs:label "Test of sh:or with multiple lists";
mf:action [
sht:dataGraph <>;
sht:shapesGraph <>
];
mf:result [ a sh:ValidationReport;
sh:conforms false;
sh:result [ a sh:ValidationResult;
sh:detail [ a sh:ValidationResult;
sh:focusNode ex:InvalidRectangle1;
sh:resultPath ex:width;
sh:resultSeverity sh:Violation;
sh:sourceConstraintComponent sh:MinCountConstraintComponent;
sh:sourceShape _:b1
], [ a sh:ValidationResult;
sh:focusNode ex:InvalidRectangle1;
sh:resultPath ex:area;
sh:resultSeverity sh:Violation;
sh:sourceConstraintComponent sh:MinCountConstraintComponent;
sh:sourceShape _:b2
], [ a sh:ValidationResult;
sh:focusNode ex:InvalidRectangle1;
sh:resultPath ex:height;
sh:resultSeverity shn:Trace;
sh:sourceConstraintComponent shn:TraversalConstraintComponent;
sh:sourceShape _:b3;
sh:value 3
], [ a sh:ValidationResult;
sh:focusNode ex:InvalidRectangle1;
sh:resultPath ex:height;
sh:resultSeverity shn:Debug;
sh:sourceConstraintComponent sh:MinCountConstraintComponent;
sh:sourceShape _:b3
];
sh:focusNode ex:InvalidRectangle1;
sh:resultSeverity sh:Violation;
sh:sourceConstraintComponent sh:OrConstraintComponent;
sh:sourceShape ex:RectangleWithArea;
sh:value ex:InvalidRectangle1
], [ a sh:ValidationResult;
sh:detail [ a sh:ValidationResult;
sh:focusNode ex:ValidRectangle1;
sh:resultPath ex:height;
sh:resultSeverity shn:Debug;
sh:sourceConstraintComponent sh:MinCountConstraintComponent;
sh:sourceShape _:b3
], [ a sh:ValidationResult;
sh:focusNode ex:ValidRectangle1;
sh:resultPath ex:width;
sh:resultSeverity shn:Debug;
sh:sourceConstraintComponent sh:MinCountConstraintComponent;
sh:sourceShape _:b1
], [ a sh:ValidationResult;
sh:focusNode ex:ValidRectangle1;
sh:resultPath ex:width;
sh:resultSeverity shn:Trace;
sh:sourceConstraintComponent shn:TraversalConstraintComponent;
sh:sourceShape _:b1;
sh:value 2
], [ a sh:ValidationResult;
sh:focusNode ex:ValidRectangle1;
sh:resultPath ex:area;
sh:resultSeverity sh:Violation;
sh:sourceConstraintComponent sh:MinCountConstraintComponent;
sh:sourceShape _:b2
], [ a sh:ValidationResult;
sh:focusNode ex:ValidRectangle1;
sh:resultPath ex:height;
sh:resultSeverity shn:Trace;
sh:sourceConstraintComponent shn:TraversalConstraintComponent;
sh:sourceShape _:b3;
sh:value 3
];
sh:focusNode ex:ValidRectangle1;
sh:resultSeverity shn:Debug;
sh:sourceConstraintComponent sh:OrConstraintComponent;
sh:sourceShape ex:RectangleWithArea;
sh:value ex:ValidRectangle1
], [ a sh:ValidationResult;
sh:detail [ a sh:ValidationResult;
sh:focusNode ex:InvalidRectangle2;
sh:resultPath ex:area;
sh:resultSeverity sh:Violation;
sh:sourceConstraintComponent sh:MinCountConstraintComponent;
sh:sourceShape _:b2
], [ a sh:ValidationResult;
sh:focusNode ex:InvalidRectangle2;
sh:resultPath ex:height;
sh:resultSeverity sh:Violation;
sh:sourceConstraintComponent sh:MinCountConstraintComponent;
sh:sourceShape _:b3
], [ a sh:ValidationResult;
sh:focusNode ex:InvalidRectangle2;
sh:resultPath ex:width;
sh:resultSeverity sh:Violation;
sh:sourceConstraintComponent sh:MinCountConstraintComponent;
sh:sourceShape _:b1
];
sh:focusNode ex:InvalidRectangle2;
sh:resultSeverity sh:Violation;
sh:sourceConstraintComponent sh:OrConstraintComponent;
sh:sourceShape ex:RectangleWithArea;
sh:value ex:InvalidRectangle2
], [ a sh:ValidationResult;
sh:detail [ a sh:ValidationResult;
sh:focusNode ex:ValidRectangle2;
sh:resultPath ex:area;
sh:resultSeverity shn:Trace;
sh:sourceConstraintComponent shn:TraversalConstraintComponent;
sh:sourceShape _:b2;
sh:value 6
], [ a sh:ValidationResult;
sh:focusNode ex:ValidRectangle2;
sh:resultPath ex:height;
sh:resultSeverity shn:Trace;
sh:sourceConstraintComponent shn:TraversalConstraintComponent;
sh:sourceShape _:b3;
sh:value 3
], [ a sh:ValidationResult;
sh:focusNode ex:ValidRectangle2;
sh:resultPath ex:width;
sh:resultSeverity shn:Trace;
sh:sourceConstraintComponent shn:TraversalConstraintComponent;
sh:sourceShape _:b1;
sh:value 2
], [ a sh:ValidationResult;
sh:focusNode ex:ValidRectangle2;
sh:resultPath ex:width;
sh:resultSeverity shn:Debug;
sh:sourceConstraintComponent sh:MinCountConstraintComponent;
sh:sourceShape _:b1
], [ a sh:ValidationResult;
sh:focusNode ex:ValidRectangle2;
sh:resultPath ex:area;
sh:resultSeverity shn:Debug;
sh:sourceConstraintComponent sh:MinCountConstraintComponent;
sh:sourceShape _:b2
], [ a sh:ValidationResult;
sh:focusNode ex:ValidRectangle2;
sh:resultPath ex:height;
sh:resultSeverity shn:Debug;
sh:sourceConstraintComponent sh:MinCountConstraintComponent;
sh:sourceShape _:b3
];
sh:focusNode ex:ValidRectangle2;
sh:resultSeverity shn:Debug;
sh:sourceConstraintComponent sh:OrConstraintComponent;
sh:sourceShape ex:RectangleWithArea;
sh:value ex:ValidRectangle2
], [ a sh:ValidationResult;
sh:detail [ a sh:ValidationResult;
sh:focusNode ex:ValidRectangle3;
sh:resultPath ex:height;
sh:resultSeverity shn:Debug;
sh:sourceConstraintComponent sh:MinCountConstraintComponent;
sh:sourceShape _:b3
], [ a sh:ValidationResult;
sh:focusNode ex:ValidRectangle3;
sh:resultPath ex:area;
sh:resultSeverity shn:Trace;
sh:sourceConstraintComponent shn:TraversalConstraintComponent;
sh:sourceShape _:b2;
sh:value 6
], [ a sh:ValidationResult;
sh:focusNode ex:ValidRectangle3;
sh:resultPath ex:width;
sh:resultSeverity sh:Violation;
sh:sourceConstraintComponent sh:MinCountConstraintComponent;
sh:sourceShape _:b1
], [ a sh:ValidationResult;
sh:focusNode ex:ValidRectangle3;
sh:resultPath ex:height;
sh:resultSeverity shn:Trace;
sh:sourceConstraintComponent shn:TraversalConstraintComponent;
sh:sourceShape _:b3;
sh:value 3
], [ a sh:ValidationResult;
sh:focusNode ex:ValidRectangle3;
sh:resultPath ex:area;
sh:resultSeverity shn:Debug;
sh:sourceConstraintComponent sh:MinCountConstraintComponent;
sh:sourceShape _:b2
];
sh:focusNode ex:ValidRectangle3;
sh:resultSeverity shn:Debug;
sh:sourceConstraintComponent sh:OrConstraintComponent;
sh:sourceShape ex:RectangleWithArea;
sh:value ex:ValidRectangle3
]
].