/
recursive-003.ttl
84 lines (68 loc) · 1.75 KB
/
recursive-003.ttl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# baseURI: http://www.w3.org/ns/shacl/test/features/core/recursive-003
@prefix ex: <http://example.org/> .
@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#> .
<>
a sh:Graph ;
sh:shapesGraph <http://www.w3.org/ns/shacl> ;
rdfs:comment "Based on an example suggested by Simon in https://lists.w3.org/Archives/Public/public-data-shapes-wg/2015Jun/0083.html" ;
.
# Shapes ----------------------------------------------------------------------
ex:recursionShapeExample
a sh:Shape ;
sh:property [
sh:predicate ex:someProperty ;
sh:valueShape ex:hasAShape ;
] .
ex:hasAShape
a sh:Shape ;
sh:constraint [
a sh:AndConstraint ;
sh:shapes (ex:ValueTypeAShape ex:notBShape)
] .
ex:hasBShape
a sh:Shape ;
sh:constraint [
a sh:AndConstraint ;
sh:shapes (ex:ValueTypeBShape ex:notAShape)
] .
ex:notAShape
a sh:Shape ;
sh:constraint [
a sh:NotConstraint ;
sh:shape ex:hasAShape ;
] .
ex:notBShape
a sh:Shape ;
sh:constraint [
a sh:NotConstraint ;
sh:shape ex:hasBShape;
] .
ex:ValueTypeAShape
a sh:Shape ;
sh:property [
sh:predicate ex:property ;
sh:valueType ex:ClassA ;
] .
ex:ValueTypeBShape
a sh:Shape ;
sh:property [
sh:predicate ex:property ;
sh:valueType ex:ClassB ;
] .
# Instances -------------------------------------------------------------------
ex:InstanceOfA
a ex:ClassA ;
.
ex:InstanceOfB
a ex:ClassB ;
.
ex:Instance1
sh:nodeShape ex:recursionShapeExample ;
ex:someProperty ex:Instance2 ;
.
ex:Instance2
ex:property ex:InstanceOfA ;
.