-
Notifications
You must be signed in to change notification settings - Fork 9
/
ShExR.shex
222 lines (188 loc) · 5.52 KB
/
ShExR.shex
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
PREFIX sx: <http://www.w3.org/ns/shex#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
BASE <http://www.w3.org/ns/shex>
start=@<#Schema>
<#Schema> CLOSED {
a [sx:Schema] ;
sx:imports @<#IriList1Plus> ? ;
sx:startActs @<#SemActList1Plus> ? ;
sx:start @<#shapeDeclOrExpr> ? ;
sx:shapes @<#ShapeDeclList1Plus> ?
}
<#shapeDeclOrExpr> @<#ShapeDecl> OR @<#shapeExpr>
<#ShapeDecl> CLOSED {
a [sx:ShapeDecl] ;
sx:abstract [true false] ? ;
sx:shapeExpr @<#shapeExpr>
}
<#shapeExpr> @<#ShapeOr> OR @<#ShapeAnd> OR @<#ShapeNot> OR @<#NodeConstraint> OR @<#Shape> OR @<#ShapeExternal>
<#ShapeOr> CLOSED {
a [sx:ShapeOr] ;
sx:shapeExprs @<#shapeDeclOrExprList2Plus>
}
<#ShapeAnd> CLOSED {
a [sx:ShapeAnd] ;
sx:shapeExprs @<#shapeDeclOrExprList2Plus>
}
<#ShapeNot> CLOSED {
a [sx:ShapeNot] ;
sx:shapeExpr @<#shapeDeclOrExpr>
}
<#NodeConstraint> CLOSED {
a [sx:NodeConstraint] ;
sx:nodeKind [sx:iri sx:bnode sx:literal sx:nonliteral] ? ;
sx:datatype IRI ? ;
&<#xsFacets> ;
sx:values @<#valueSetValueList1Plus> ? ;
sx:semActs @<#SemActList1Plus> ? ;
sx:annotation @<#AnnotationList1Plus> ?
}
<#Shape> CLOSED {
a [sx:Shape] ;
sx:extends @<#shapeDeclOrExprList1Plus>? ;
sx:closed [true false] ? ;
sx:extra IRI * ;
sx:expression @<#tripleExpression> ? ;
sx:semActs @<#SemActList1Plus> ? ;
sx:annotation @<#AnnotationList1Plus> ?
}
<#ShapeExternal> CLOSED {
a [sx:ShapeExternal]
}
<#SemAct> CLOSED {
a [sx:SemAct] ;
sx:name IRI ;
sx:code xsd:string ?
}
<#Annotation> CLOSED {
a [sx:Annotation] ;
sx:predicate IRI ;
sx:object @<#objectValue>
}
<#facet_holder> { # hold labeled productions
$<#xsFacets> ( &<#stringFacet> | &<#numericFacet> ) * ;
$<#stringFacet> (
sx:length xsd:integer
| sx:minlength xsd:integer
| sx:maxlength xsd:integer
| sx:pattern xsd:string ; sx:flags xsd:string ?
) ;
$<#numericFacet> (
sx:mininclusive @<#numericLiteral>
| sx:minexclusive @<#numericLiteral>
| sx:maxinclusive @<#numericLiteral>
| sx:maxexclusive @<#numericLiteral>
| sx:totaldigits xsd:integer
| sx:fractiondigits xsd:integer
)
}
<#numericLiteral> xsd:integer OR xsd:decimal OR xsd:double
<#valueSetValue> @<#objectValue> OR @<#IriStem> OR @<#IriStemRange>
OR @<#LiteralStem> OR @<#LiteralStemRange>
OR @<#Language> OR @<#LanguageStem> OR @<#LanguageStemRange>
<#objectValue> IRI OR LITERAL
<#IriStem> CLOSED { a [sx:IriStem] ; sx:stem xsd:string }
<#IriStemRange> CLOSED {
a [sx:IriStemRange] ;
sx:stem xsd:string OR @<#Wildcard> ;
sx:exclusion @<#IriStemExclusionList1Plus>
}
<#LiteralStem> CLOSED { a [sx:LiteralStem] ; sx:stem xsd:string }
<#LiteralStemRange> CLOSED {
a [sx:LiteralStemRange] ;
sx:stem xsd:string OR @<#Wildcard> ;
sx:exclusion @<#LiteralStemExclusionList1Plus>
}
<#Language> CLOSED { a [sx:Language] ; sx:languageTag xsd:string }
<#LanguageStem> CLOSED { a [sx:LanguageStem] ; sx:stem xsd:string }
<#LanguageStemRange> CLOSED {
a [sx:LanguageStemRange] ;
sx:stem xsd:string OR @<#Wildcard> ;
sx:exclusion @<#LanguageStemExclusionList1Plus>
}
<#Wildcard> BNODE CLOSED {
a [sx:Wildcard]
}
<#tripleExpression>
@<#NotYetResolvedInclusion>
OR @<#TripleConstraint>
OR @<#OneOf>
OR @<#EachOf>
<#NotYetResolvedInclusion> CLOSED {} # will have 1 incoming, 0 outgoing arcs
<#OneOf> CLOSED {
a [sx:OneOf] ;
sx:min xsd:integer ? ;
sx:max xsd:integer ? ;
sx:expressions @<#tripleExpressionList2Plus> ;
sx:semActs @<#SemActList1Plus> ? ;
sx:annotation @<#AnnotationList1Plus> ?
}
<#EachOf> CLOSED {
a [sx:EachOf] ;
sx:min xsd:integer ? ;
sx:max xsd:integer ? ;
sx:expressions @<#tripleExpressionList2Plus> ;
sx:semActs @<#SemActList1Plus> ? ;
sx:annotation @<#AnnotationList1Plus> ?
}
<#TripleConstraint> CLOSED {
a [sx:TripleConstraint] ;
sx:inverse [true false] ? ;
sx:negated [true false] ? ;
sx:min xsd:integer ? ;
sx:max xsd:integer ? ;
sx:predicate IRI ;
sx:valueExpr @<#shapeDeclOrExpr> ? ;
sx:semActs @<#SemActList1Plus> ? ;
sx:annotation @<#AnnotationList1Plus> ?
}
# RDF Lists
<#tripleExpressionList2Plus> CLOSED {
rdf:first @<#tripleExpression> ;
rdf:rest @<#tripleExpressionList1Plus>
}
<#tripleExpressionList1Plus> CLOSED {
rdf:first @<#tripleExpression> ;
rdf:rest [rdf:nil] OR @<#tripleExpressionList1Plus>
}
<#IriList1Plus> CLOSED {
rdf:first IRI ;
rdf:rest [rdf:nil] OR @<#IriList1Plus>
}
<#SemActList1Plus> CLOSED {
rdf:first @<#SemAct> ;
rdf:rest [rdf:nil] OR @<#SemActList1Plus>
}
<#ShapeDeclList1Plus> CLOSED {
rdf:first @<#ShapeDecl> ;
rdf:rest [rdf:nil] OR @<#ShapeDeclList1Plus>
}
<#shapeDeclOrExprList2Plus> CLOSED {
rdf:first @<#shapeDeclOrExpr> ;
rdf:rest @<#shapeDeclOrExprList1Plus>
}
<#shapeDeclOrExprList1Plus> CLOSED {
rdf:first @<#shapeDeclOrExpr> ;
rdf:rest [rdf:nil] OR @<#shapeDeclOrExprList1Plus>
}
<#valueSetValueList1Plus> CLOSED {
rdf:first @<#valueSetValue> ;
rdf:rest [rdf:nil] OR @<#valueSetValueList1Plus>
}
<#AnnotationList1Plus> CLOSED {
rdf:first @<#Annotation> ;
rdf:rest [rdf:nil] OR @<#AnnotationList1Plus>
}
<#IriStemExclusionList1Plus> CLOSED {
rdf:first IRI OR @<#IriStem> ;
rdf:rest [rdf:nil] OR @<#IriStemExclusionList1Plus>
}
<#LiteralStemExclusionList1Plus> CLOSED {
rdf:first xsd:string OR @<#LiteralStem> ;
rdf:rest [rdf:nil] OR @<#LiteralStemExclusionList1Plus>
}
<#LanguageStemExclusionList1Plus> CLOSED {
rdf:first xsd:string OR @<#LanguageStem> ;
rdf:rest [rdf:nil] OR @<#LanguageStemExclusionList1Plus>
}