Last active
June 19, 2018 10:01
-
-
Save jaw111/59ff3a852dcea246c498715d7a2b1b9e to your computer and use it in GitHub Desktop.
SHACL example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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 ex: <http://example.com/ns#> . | |
ex:Shape a sh:NodeShape ; | |
sh:targetClass ex:MyClass ; | |
sh:property [ | |
# list of allowed values and meaning for ex:prop1 | |
sh:path ex:prop1 ; | |
sh:in ( "A" "B" "C" ) ; | |
] ; | |
sh:property [ | |
# list of allowed values and meaning for ex:prop2 | |
sh:path ex:prop2 ; | |
sh:in ( "A" "B" "C" ) ; | |
] ; | |
sh:property [ | |
# list of allowed values and meaning for ex:prop3 | |
sh:path ex:prop3 ; | |
sh:in ( "A" "B" "C" ) ; | |
] . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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 skos: <http://www.w3.org/2004/02/skos/core#> . | |
@prefix ex: <http://example.com/ns#> . | |
ex:Shape a sh:NodeShape ; | |
sh:targetClass ex:MyClass ; | |
sh:property [ | |
# list of allowed values and meaning for ex:prop1 | |
sh:path ex:prop1 ; | |
sh:in ( "A" "B" "C" ) ; | |
rdfs:isDefinedBy [ | |
a skos:Collection ; | |
skos:prefLabel "Mammals by species" ; | |
skos:member | |
[ skos:notation "A" ; skos:prefLabel "Aardvark" ] , | |
[ skos:notation "B" ; skos:prefLabel "Badger" ] , | |
[ skos:notation "C" ; skos:prefLabel "Cat" ] | |
] | |
] ; | |
sh:property [ | |
# list of allowed values and meaning for ex:prop2 | |
sh:path ex:prop2 ; | |
sh:in ( "A" "B" "C" ) ; | |
rdfs:isDefinedBy [ | |
a skos:OrderedCollection ; | |
skos:prefLabel "Trees by species" ; | |
skos:memberList ( | |
[ skos:notation "A" ; skos:prefLabel "Acorn" ] | |
[ skos:notation "B" ; skos:prefLabel "Beech" ] | |
[ skos:notation "C" ; skos:prefLabel "Cedar" ] | |
) | |
] | |
] ; | |
sh:property [ | |
# list of allowed values and meaning for ex:prop3 | |
sh:path ex:prop3 ; | |
sh:in ( "A" "B" "C" ) ; | |
rdfs:isDefinedBy [ | |
a skos:ConceptScheme ; | |
skos:prefLabel "Programming languages" ; | |
skos:hasTopConcept | |
[ skos:notation "A" ; skos:prefLabel "Ada 95" ] , | |
[ skos:notation "B" ; skos:prefLabel "BASIC" ] , | |
[ skos:notation "C" ; skos:prefLabel "C++" ] | |
] | |
] . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment