-
Notifications
You must be signed in to change notification settings - Fork 3
/
metamodel-alternative.ttl
224 lines (178 loc) · 9.56 KB
/
metamodel-alternative.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
## SHACL metamodel for my proposed syntax, including validation shapes
## Shape graphs can be validated as data against this metamodel,
## provided that all RDFS consequences are included in the shape graph.
## This version uses property object scopes in component shapes,
## resulting in simpler shapes but uninformative error messages.
## This metamodel does not have recent changes that have been made to the other one.
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
@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 shmm: <http://www.w3.org/ns/shaclmm#> .
## PART 1: SHACL core
sh:Shape a rdfs:Class .
sh:name a rdf:Property ; rdfs:range rdf:langString .
sh:description a rdf:Property ; rdfs:range rdf:langString .
sh:message a rdf:Property ; rdfs:range rdf:LangString.
sh:order a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range xs:decimal .
sh:defaultValue a rdf:Property ; rdfs:domain sh:Shape .
sh:severity a rdf:Property .
sh:inverse a rdf:Property ; rdfs:range rdf:Property .
# Validation results
sh:ValidationResult a rdfs:Class .
sh:focusNode a rdf:Property ; rdfs:domain sh:ValidationResult .
sh:subject a rdf:Property ; rdfs:domain sh:ValidationResult .
sh:predicate a rdf:Property ; rdfs:domain sh:ValidationResult ; rdfs:range rdf:Property .
sh:object a rdf:Property ; rdfs:domain sh:ValidationResult .
sh:sourceComponent a rdf:Property ; rdfs:domain sh:ValidationResult .
sh:sourceShape a rdf:Property ; rdfs:domain sh:ValidationResult ; rdfs:range sh:Shape .
sh:sourceTemplate a rdf:Property ; rdfs:domain sh:ValidationResult ; rdfs:range sh:ComponentTemplate .
sh:detail a rdf:Property ; rdfs:domain sh:ValidationResult .
sh:message a rdf:Property ; rdfs:domain sh:ValidationResult ; rdfs:range rdf:LangString .
shmm:ValidationResultSyntax a sh:Shape ; sh:scopeClass sh:ValidationResult ;
sh:propValues ( sh:focusNode [ sh:maxCount 1 ] ) ;
sh:propValues ( sh:subject [ sh:maxCount 1 ] ) ;
sh:propValues ( sh:predicate [ sh:maxCount 1 ] ) ;
sh:propValues ( sh:object [ sh:maxCount 1 ] ) ;
sh:propValues ( sh:sourceConstraint [ sh:maxCount 1 ] ) ;
sh:propValues ( sh:sourceShape [ sh:maxCount 1 ] ) ;
sh:propValues ( sh:sourceTemplate [ sh:maxCount 1 ] ) ;
sh:propValues ( sh:message [ sh:datatype rdf:LangString ] ) ;
sh:propValues ( sh:severity [ sh:in ( sh:Info sh:Warning sh:Violation ) ] ) .
## PART 2: Description of built-in components, for validation
# RDFS domains and ranges for the properties
sh:scopeClass a rdf:Property; rdfs:domain sh:Shape; rdfs:range rdfs:Class .
sh:scopeNode a rdf:Property; rdfs:domain sh:Shape .
sh:scopePropertyObject a rdf:Property; rdfs:domain sh:Shape; rdfs:range rdf:Property.
sh:scopePropertySubject a rdf:Property; rdfs:domain sh:Shape; rdfs:range rdf:Property.
sh:scopeAllObjects a rdf:Property; rdfs:domain sh:Shape; rdfs:range xs:boolean .
sh:scopeAllSubjects a rdf:Property; rdfs:domain sh:Shape; rdfs:range xs:boolean .
sh:scopeSPARQL a rdf:Property; rdfs:domain sh:Shape; rdfs:range xs:string .
sh:filter a rdf:Property; rdfs:domain sh:Shape; rdfs:range sh:Shape .
shmm:notBlank a sh:Shape ;
sh:or ( [ sh:nodeKind sh:IRI ] [ sh:nodeKind sh:Literal ] ) .
shmm:scopeShape a sh:Shape ; sh:scopeClass sh:Shape ;
sh:propValues ( sh:scopeClass [ sh:nodeKind sh:IRI ] ) ;
sh:propValues ( sh:scopeNode shmm:notBlank ) ;
sh:propValues ( sh:scopePropertyObject shmm:notBlank ) ;
sh:propValues ( sh:scopePropertySubject shmm:notBlank ) ;
sh:propValues ( sh:scopeAllObjects [ sh:in ( true ) ] ) ;
sh:propValues ( sh:scopeAllSubjects [ sh:in ( true ) ] ) ;
sh:propValues ( sh:scopeSPARQL [ sh:datatype xs:string ] ) ;
sh:propValues ( sh:filter [ sh:class sh:Shape ] ) .
# Shapes for paths
shmm:pathShape a sh:Shape ;
sh:or ( shmm:pathPartShape
[ sh:list shmm:pathPartShape ] ) .
shmm:pathPartShape a sh:Shape ;
sh:or ( shmm:inverseShape # inverse of a property
[ sh:nodeKind sh:IRI ] ) . # property
shmm:inverseShape a sh:Shape ;
sh:propValues ( sh:inverse [ sh:minCount 1 ; sh:maxCount 1 ;
sh:nodeKind sh:IRI ] ) .
sh:Component a rdfs:Class ; rdfs:subClassOf rdf:Property ; rdfs:subClassOf sh:Shape .
sh:in a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range rdf:List ;
sh:scopePropertyObject sh:in ;
sh:list sh:notBlank .
sh:class a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range rdfs:Class ;
sh:scopePropertyObject sh:class ;
sh:nodeKind sh:IRI .
sh:classIn a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range rdf:List ;
sh:scopePropertyObject sh:classIn ;
sh:list [ sh:nodeKind sh:IRI ] .
sh:datatype a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range rdfs:Datatype ;
sh:scopePropertyObject sh:datatype ;
sh:nodeKind sh:IRI .
sh:datatypeIn a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range rdf:List ;
sh:scopePropertyObject sh:datatypeIn ;
sh:list [ sh:nodeKind sh:IRI ] .
sh:datatypeInShape a sh:Shape ; sh:scopePropertyObject sh:X ;
sh:propValues ( sh:datatypeIn sh:datatypeIn ) .
sh:directType a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range rdfs:Class ;
sh:scopePropertyObject sh:directType ;
sh:nodeKind sh:IRI .
sh:minLength a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range xs:integer ;
sh:scopePropertyObject sh:minLength ;
sh:datatype xs:integer ;
sh:minInclusive 0 .
sh:maxLength a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range xs:integer ;
sh:scopePropertyObject sh:maxLength ;
sh:datatype xs:integer ;
sh:minInclusive 0 .
sh:minInclusive a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range rdfs:Literal ;
sh:scopePropertyObject sh:minInclusive ;
sh:nodeKind sh:Literal .
sh:minExclusive a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range rdfs:Literal ;
sh:scopePropertyObject sh:minExclusive ;
sh:nodeKind sh:Literal .
sh:maxInclusive a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range rdfs:Literal ;
sh:scopePropertyObject sh:maxInclusive ;
sh:nodeKind sh:Literal .
sh:maxExclusive a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range rdfs:Literal ;
sh:scopePropertyObject sh:maxExclusive ;
sh:nodeKind sh:Literal .
sh:nodeKind a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ;
sh:scopePropertyObject sh:nodeKind ;
sh:in ( sh:BlankNode sh:IRI sh:Literal ) .
sh:pattern a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ;
sh:scopePropertyObject sh:pattern ;
sh:or ( [ sh:list xs:string ;
sh:propValues ( ( rdf:rest rdf:rest ) [ sh:hasValue rdf:nil ] ) ]
[ sh:datatype xs:string ] ) .
sh:equals a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range rdf:List ;
sh:scopePropertyObject sh:equals ;
sh:list shmm:pathShape ;
sh:propValues ((rdf:rest rdf:rest) [ sh:hasValue rdf:nil ] ) .
sh:disjoint a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range rdf:List ;
sh:scopePropertyObject sh:disjoint ;
sh:list shmm:pathShape ;
sh:propValues ((rdf:rest rdf:rest) [ sh:hasValue rdf:nil ] ) .
sh:lessThan a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range rdf:List ;
sh:scopePropertyObject sh:lessThan ;
sh:propValues ((rdf:rest rdf:rest) [ sh:hasValue rdf:nil ] ) ;
sh:list shmm:pathShape .
sh:lessThanOrEquals a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range rdf:List ;
sh:scopePropertyObject sh:lessThanOrEquals ;
sh:list shmm:pathShape ;
sh:propValues ((rdf:rest rdf:rest) [ sh:hasValue rdf:nil ] ) .
sh:list a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range sh:Shape ;
sh:scopePropertyObject sh:list ;
sh:class sh:Shape .
sh:hasValue a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ;
sh:scopePropertyObject sh:hasValue ;
sh:shape shmm:notBlank .
sh:uniqueLang a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ;
sh:scopePropertyObject sh:uniqueLang ;
sh:in ( true ) .
sh:minCount a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range xs:integer ;
sh:scopePropertyObject sh:minCount ;
sh:datatype xs:integer ;
sh:minInclusive 0 .
sh:maxCount a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range xs:integer ;
sh:scopePropertyObject sh:maxCount ;
sh:datatype xs:integer ;
sh:minInclusive 0 .
sh:shape a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range sh:Shape ;
sh:scopePropertyObject sh:shape ;
sh:class sh:Shape .
sh:not a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range sh:Shape ;
sh:scopePropertyObject sh:not ;
sh:class sh:Shape .
sh:and a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range rdf:List ;
sh:scopePropertyObject sh:and ;
sh:list [ sh:class sh:Shape ] .
sh:or a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range rdf:List ;
sh:scopePropertyObject sh:or ;
sh:list [ sh:class sh:Shape ] .
sh:propValues a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range rdf:List ;
sh:scopePropertyObject sh:propValues ;
sh:list [ ] ;
sh:propValues ( ( rdf:rest rdf:rest ) [ sh:hasValue rdf:nil ] ) ;
sh:propValues ( rdf:first shmm:pathShape ) ;
sh:propValues ( ( rdf:rest rdf:first ) [ sh:class sh:Shape ] ) .
sh:partition a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range rdf:List ;
sh:scopePropertyObject sh:partition ;
sh:list [ sh:class sh:Shape ] .
sh:closed a sh:Component ; a sh:Shape ; rdfs:domain sh:Shape ; rdfs:range rdf:List ;
sh:scopePropertyObject sh:closed ;
sh:list [ sh:or ( [ sh:nodeKind sh:IRI ] shmm:inverseShape ) ] .