shacl-engine
Version:
A fast RDF/JS SHACL engine
71 lines (69 loc) • 2.18 kB
text/turtle
@prefix dash: <http://datashapes.org/dash#> .
@prefix ex: <http://datashapes.org/sh/tests/sparql/node/sparql-003.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/node/sparql-003.test>
sh:declare [
rdf:type sh:PrefixDeclaration ;
sh:namespace "http://datashapes.org/sh/tests/sparql/node/sparql-003.test#"^^xsd:anyURI ;
sh:prefix "ex" ;
] ;
.
ex:InvalidCountry
rdf:type ex:Country ;
ex:germanLabel "Spain"@en ;
.
ex:LanguageExampleShape
rdf:type sh:NodeShape ;
rdf:type sh:SPARQLConstraint ;
sh:message "Values are literals with German language tag." ;
sh:prefixes <http://datashapes.org/sh/tests/sparql/node/sparql-003.test> ;
sh:select """
SELECT $this (ex:germanLabel AS ?path)
WHERE {
$this ex:germanLabel ?value .
FILTER (!isLiteral(?value) || !langMatches(lang(?value), \"de\"))
}
""" ;
sh:severity sh:Warning ;
sh:sparql ex:LanguageExampleShape ;
sh:targetClass ex:Country ;
.
ex:ValidCountry
rdf:type ex:Country ;
ex:germanLabel "Spanien"@de ;
.
<>
rdf:type mf:Manifest ;
mf:entries (
<sparql-003>
) ;
.
<sparql-003>
rdf:type sht:Validate ;
rdfs:label "Test of sh:sparql at node shape 003" ;
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 ex:InvalidCountry ;
sh:resultPath ex:germanLabel ;
sh:resultSeverity sh:Warning ;
sh:sourceConstraint ex:LanguageExampleShape ;
sh:sourceConstraintComponent sh:SPARQLConstraintComponent ;
sh:sourceShape ex:LanguageExampleShape ;
sh:value ex:InvalidCountry ;
] ;
] ;
mf:status sht:approved ;
.