Shipshape
RDF in shipshape! Useful SHACL shapes!
Table of Contents
1 http://shipshape.dyreriket.xyz/std-vocabulary-elements.ttl
This set of shapes check that the vocabulary elements that belong to
any of the following following namespaces are also found in
vocabularies published at the namespace address. In other words, they
check that the RDF data does not use terms from these vocabularies
that are not defined in them, hence avoiding typos like rdfs:type
(should be rdf:type
) and owl:UnionOf
(should be owl:unionOf
).
The shapes only check IRIs and not shapes, i.e., they do not check that the these vocabularies are use according to their specification.
- rdf
- http://www.w3.org/1999/02/22-rdf-syntax-ns#
- rdfs
- http://www.w3.org/2000/01/rdf-schema#
- owl
- http://www.w3.org/2002/07/owl#
- skos
- http://www.w3.org/2004/02/skos/core#
- sh
- http://www.w3.org/ns/shacl#
- shsh
- http://www.w3.org/ns/shacl-shacl#
- dc
- http://purl.org/dc/elements/1.1/
- foaf
- http://xmlns.com/foaf/0.1/
- pav
- http://purl.org/pav/
1.1 Examples
1.1.1 sh:conforms false
RDF data:
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix ex: <http://example.com#> . ex:a rdfs:type ex:A . ex:b rdf:type ex:B . ex:A rdfs:subclassof ex:B .
Checking with Jena (https://jena.apache.org/):
apache-jena/bin/shacl v --shapes=http://shipshape.dyreriket.xyz/std-vocabulary-elements.ttl --data=test/sve/ex1.ttl
@prefix ex: <http://example.com#> . @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 sss: <http://shipshape.dyreriket.xyz#> . @prefix sss-sve: <http://shipshape.dyreriket.xyz/std-vocabulary-elements#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . [ rdf:type sh:ValidationReport ; sh:conforms false ; sh:result [ rdf:type sh:ValidationResult ; sh:focusNode sss:ANY_NODE ; sh:resultMessage "Unrecognised RDFS vocabulary element. Check spelling." ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; sh:sourceShape sss-sve:RDFSVocabularyShape ; sh:value rdfs:subclassof ] ; sh:result [ rdf:type sh:ValidationResult ; sh:focusNode sss:ANY_NODE ; sh:resultMessage "Unrecognised RDFS vocabulary element. Check spelling." ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; sh:sourceShape sss-sve:RDFSVocabularyShape ; sh:value rdfs:type ] ] .
1.1.2 sh:conforms true
RDF data. Notice that the owl
vocabulary is not used according to
the OWL specification. However, this is not within the scope of these
shapes to check.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix ex: <http://example.com#> . owl:Class owl:unionOf owl:NamedIndividual . owl:Class owl:unionOf rdf:type . owl:unionOf ex:A ex:b .
Checking with Jena (https://jena.apache.org/):
apache-jena/bin/shacl v --shapes=http://shipshape.dyreriket.xyz/std-vocabulary-elements.ttl --data=test/sve/ex2.ttl
@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 xsd: <http://www.w3.org/2001/XMLSchema#> . [ rdf:type sh:ValidationReport ; sh:conforms true ] .