you can try it out here -> http://shacl.org/playground/
Last active
April 18, 2019 04:36
-
-
Save simonstey/e3add7ff0740dd95a4c80d26840ca3e3 to your computer and use it in GitHub Desktop.
Question on value based constraints
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 ex: <http://example.org/ns#> . | |
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | |
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | |
@prefix schema: <http://schema.org/> . | |
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | |
ex:Alice | |
a ex:Person ; | |
ex:hasAddress "Street xzy plz 12345 ..." ; | |
ex:addressType "simpleAddress". | |
ex:Bob | |
a ex:Person ; | |
ex:hasAddress ex:BobsAddress ; | |
ex:addressType "complexAddress" . | |
ex:BobsAddress | |
a ex:complexAddress ; | |
schema:streetAddress "1600 Amphitheatre Pkway" ; | |
schema:postalCode 9404 . | |
ex:Tom | |
a ex:Person ; | |
ex:hasAddress "Street xzy plz 12345 ..." ; | |
ex:addressType "complexAddress". | |
ex:Claire | |
a ex:Person ; | |
ex:hasAddress ex:ClairesAddress ; | |
ex:addressType "simpleAddress" . | |
ex:ClairesAddress | |
a ex:complexAddress ; | |
schema:streetAddress "1600 Amphitheatre Pkway" ; | |
schema:postalCode 9404 . |
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 dash: <http://datashapes.org/dash#> . | |
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | |
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | |
@prefix schema: <http://schema.org/> . | |
@prefix sh: <http://www.w3.org/ns/shacl#> . | |
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | |
@prefix ex: <http://example.org/ns#> . | |
ex:PersonShape | |
a sh:NodeShape ; | |
sh:targetClass ex:Person ; | |
sh:xone ( | |
[ | |
sh:property [ | |
sh:path ex:hasAddress ; | |
sh:datatype xsd:string ; | |
] ; | |
sh:property [ | |
sh:path ex:addressType ; | |
sh:hasValue "simpleAddress" ; | |
] | |
] | |
[ | |
sh:property [ | |
sh:path ex:hasAddress ; | |
sh:class ex:complexAddress ; | |
] ; | |
sh:property [ | |
sh:path ex:addressType ; | |
sh:hasValue "complexAddress" ; | |
] | |
] | |
) . |
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
[ | |
a sh:ValidationResult ; | |
sh:resultSeverity sh:Violation ; | |
sh:sourceConstraintComponent sh:XoneConstraintComponent ; | |
sh:sourceShape ex:PersonShape ; | |
sh:focusNode ex:Tom ; | |
sh:value ex:Tom ; | |
] . | |
[ | |
a sh:ValidationResult ; | |
sh:resultSeverity sh:Violation ; | |
sh:sourceConstraintComponent sh:XoneConstraintComponent ; | |
sh:sourceShape ex:PersonShape ; | |
sh:focusNode ex:Claire ; | |
sh:value ex:Claire ; | |
] . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment