shacl-engine
Version:
A fast RDF/JS SHACL engine
114 lines (112 loc) • 3.41 kB
text/turtle
@prefix dash: <http://datashapes.org/dash#> .
@prefix ex: <http://datashapes.org/sh/tests/sparql/component/optional-001.test#> .
@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@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 sht: <http://www.w3.org/ns/shacl-test#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://datashapes.org/sh/tests/sparql/component/optional-001.test>
sh:declare [
rdf:type sh:PrefixDeclaration ;
sh:namespace "http://datashapes.org/sh/tests/sparql/component/optional-001.test#"^^xsd:anyURI ;
sh:prefix "ex" ;
] ;
.
ex:IncompleteShape
rdf:type sh:NodeShape ;
ex:optionalParam "Some" ;
rdfs:label "Incomplete shape" ;
sh:targetNode "One" ;
sh:targetNode "Three" ;
sh:targetNode "Two" ;
.
ex:TestConstraintComponent
rdf:type sh:ConstraintComponent ;
rdfs:label "Test constraint component" ;
sh:parameter [
sh:path ex:optionalParam ;
sh:name "optional param" ;
sh:optional "true"^^xsd:boolean ;
] ;
sh:parameter [
sh:path ex:requiredParam ;
sh:name "required param" ;
] ;
sh:validator [
rdf:type sh:SPARQLAskValidator ;
sh:ask """ASK {
FILTER ($value != $requiredParam && $value != COALESCE(?optionalParam, \"Three\")) .
}""" ;
sh:prefixes <http://datashapes.org/sh/tests/sparql/component/optional-001.test> ;
] ;
.
ex:TestShape1
rdf:type sh:NodeShape ;
ex:requiredParam "One" ;
rdfs:label "Test shape 1" ;
sh:targetNode "One" ;
sh:targetNode "Three" ;
sh:targetNode "Two" ;
.
ex:TestShape2
rdf:type sh:NodeShape ;
ex:optionalParam "Two" ;
ex:requiredParam "One" ;
rdfs:label "Test shape 1" ;
sh:targetNode "One" ;
sh:targetNode "Three" ;
sh:targetNode "Two" ;
.
<>
rdf:type mf:Manifest ;
mf:entries (
<optional-001>
) ;
.
<optional-001>
rdf:type sht:Validate ;
rdfs:label "Test of sh:optional 001" ;
mf:action [
sht:dataGraph <> ;
sht:shapesGraph <> ;
] ;
mf:result [
rdf:type sh:ValidationReport ;
sh:conforms "false"^^xsd:boolean ;
sh:result [
rdf:type sh:ValidationResult ;
sh:focusNode "One" ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent ex:TestConstraintComponent ;
sh:sourceShape ex:TestShape1 ;
sh:value "One" ;
] ;
sh:result [
rdf:type sh:ValidationResult ;
sh:focusNode "One" ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent ex:TestConstraintComponent ;
sh:sourceShape ex:TestShape2 ;
sh:value "One" ;
] ;
sh:result [
rdf:type sh:ValidationResult ;
sh:focusNode "Three" ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent ex:TestConstraintComponent ;
sh:sourceShape ex:TestShape1 ;
sh:value "Three" ;
] ;
sh:result [
rdf:type sh:ValidationResult ;
sh:focusNode "Two" ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent ex:TestConstraintComponent ;
sh:sourceShape ex:TestShape2 ;
sh:value "Two" ;
] ;
] ;
mf:status sht:approved ;
.