-
Notifications
You must be signed in to change notification settings - Fork 0
/
geosparql20.enbf
384 lines (315 loc) · 14.2 KB
/
geosparql20.enbf
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
/* Taken from http://www.w3.org/TR/rdf-sparql-query/#sparqlGrammar */
Query ::= Prologue
( SelectQuery | ConstructQuery | DescribeQuery | AskQuery )
Prologue ::= BaseDecl? PrefixDecl*
BaseDecl ::= 'BASE' IRI_REF
PrefixDecl ::= 'PREFIX' PNAME_NS IRI_REF
SelectQuery ::= 'SELECT' ( 'DISTINCT' | 'REDUCED' )? ( Var+ | '*' ) DatasetClause* WhereClause SolutionModifier
ConstructQuery ::= 'CONSTRUCT' ConstructTemplate DatasetClause* WhereClause SolutionModifier
DescribeQuery ::= 'DESCRIBE' ( VarOrIRIref+ | '*' ) DatasetClause* WhereClause? SolutionModifier
AskQuery ::= 'ASK' DatasetClause* WhereClause
DatasetClause ::= 'FROM' ( DefaultGraphClause | NamedGraphClause )
DefaultGraphClause ::= SourceSelector
NamedGraphClause ::= 'NAMED' SourceSelector
SourceSelector ::= IRIref
WhereClause ::= 'WHERE'? GroupGraphPattern
SolutionModifier ::= OrderClause? LimitOffsetClauses?
LimitOffsetClauses ::= ( LimitClause OffsetClause? | OffsetClause LimitClause? )
OrderClause ::= 'ORDER' 'BY' OrderCondition+
OrderCondition ::= ( ( 'ASC' | 'DESC' ) BrackettedExpression )
| ( Constraint | Var )
LimitClause ::= 'LIMIT' INTEGER
OffsetClause ::= 'OFFSET' INTEGER
GroupGraphPattern ::= '{' TriplesBlock? ( ( GraphPatternNotTriples | Filter ) '.'? TriplesBlock? )* '}'
TriplesBlock ::= TriplesSameSubject ( '.' TriplesBlock? )?
GraphPatternNotTriples ::= OptionalGraphPattern | GroupOrUnionGraphPattern | GraphGraphPattern
OptionalGraphPattern ::= 'OPTIONAL' GroupGraphPattern
GraphGraphPattern ::= 'GRAPH' VarOrIRIref GroupGraphPattern
GroupOrUnionGraphPattern ::= GroupGraphPattern ( 'UNION' GroupGraphPattern )*
Filter ::= 'FILTER' Constraint
Constraint ::= BrackettedExpression | BuiltInCall | FunctionCall
FunctionCall ::= IRIref ArgList
ArgList ::= ( NIL | '(' Expression ( ',' Expression )* ')' )
ConstructTemplate ::= '{' ConstructTriples? '}'
ConstructTriples ::= TriplesSameSubject ( '.' ConstructTriples? )?
TriplesSameSubject ::= VarOrTerm PropertyListNotEmpty | TriplesNode PropertyList
PropertyListNotEmpty ::= Verb ObjectList ( ';' ( Verb ObjectList )? )*
PropertyList ::= PropertyListNotEmpty?
ObjectList ::= Object ( ',' Object )*
Object ::= GraphNode
Verb ::= VarOrIRIref | 'a'
TriplesNode ::= Collection | BlankNodePropertyList
BlankNodePropertyList ::= '[' PropertyListNotEmpty ']'
Collection ::= '(' GraphNode+ ')'
GraphNode ::= VarOrTerm | TriplesNode
VarOrTerm ::= Var | GraphTerm
VarOrIRIref ::= Var | IRIref
Var ::= VAR1 | VAR2
GraphTerm ::= IRIref | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | NIL
Expression ::= ConditionalOrExpression
ConditionalOrExpression ::= ConditionalAndExpression ( '||' ConditionalAndExpression )*
ConditionalAndExpression ::= ValueLogical ( '&&' ValueLogical )*
ValueLogical ::= RelationalExpression
RelationalExpression ::= NumericExpression ( '::=' NumericExpression | '!::=' NumericExpression | '<' NumericExpression | '>' NumericExpression | '<::=' NumericExpression | '>::=' NumericExpression )?
NumericExpression ::= AdditiveExpression
AdditiveExpression ::= MultiplicativeExpression ( '+' MultiplicativeExpression | '-' MultiplicativeExpression | NumericLiteralPositive | NumericLiteralNegative )*
MultiplicativeExpression ::= UnaryExpression ( '*' UnaryExpression | '/' UnaryExpression )*
UnaryExpression ::= '!' PrimaryExpression
| '+' PrimaryExpression
| '-' PrimaryExpression
| PrimaryExpression
PrimaryExpression ::= BrackettedExpression | BuiltInCall | IRIrefOrFunction | RDFLiteral | NumericLiteral | BooleanLiteral | Var
BrackettedExpression ::= '(' Expression ')'
BuiltInCall ::= 'STR' '(' Expression ')'
| 'LANG' '(' Expression ')'
| 'LANGMATCHES' '(' Expression ',' Expression ')'
| 'DATATYPE' '(' Expression ')'
| 'BOUND' '(' Var ')'
| 'sameTerm' '(' Expression ',' Expression ')'
| 'isIRI' '(' Expression ')'
| 'isURI' '(' Expression ')'
| 'isBLANK' '(' Expression ')'
| 'isLITERAL' '(' Expression ')'
| RegexExpression
RegexExpression ::= 'REGEX' '(' Expression ',' Expression ( ',' Expression )? ')'
IRIrefOrFunction ::= IRIref ArgList?
RDFLiteral ::= String ( LANGTAG | ( '^^' IRIref ) )?
NumericLiteral ::= NumericLiteralUnsigned | NumericLiteralPositive | NumericLiteralNegative
NumericLiteralUnsigned ::= INTEGER | DECIMAL | DOUBLE
NumericLiteralPositive ::= INTEGER_POSITIVE | DECIMAL_POSITIVE | DOUBLE_POSITIVE
NumericLiteralNegative ::= INTEGER_NEGATIVE | DECIMAL_NEGATIVE | DOUBLE_NEGATIVE
BooleanLiteral ::= 'true' | 'false'
SpatialVectorLiteral ::= WKTLiteral | GMLLiteral | KMLLiteral | GPXLiteral | PolylineLiteral | GeoJSONLiteral | GeoHashLiteral | TopoJSONLiteral | HexWKBLiteral
WKTLiteral ::= <http://www.opengis.net/def/crs/EPSG/0/EPSGCODE> WKTDescription '^^' geo:wktLiteral
WKTDescription ::= WKT
GMLLiteral ::= GMLDescription '^^' geo:gmlLiteral
GMLDescription ::= GMLEBNF
KMLLiteral ::= KMLDescription '^^' geo:kmlLiteral
KMLDescription ::= KMLEBNF
GPXLiteral ::= GPXDescription '^^' geo:gpxLiteral
GPXDescription ::= GPXEBNF
PolylineLiteral ::= PolylineDescription '^^' geo:polylineLiteral
PolylineDescription ::= POLYLINEEBNF
GeoHashLiteral ::= GeoHashDescription '^^' geo:geohashLiteral
GeoHashDescription ::= GEOHASHEBNF
GeoJSONLiteral ::= GeoJSONDescription '^^' geo:geojsonLiteral
GeoJSONDescription ::= GEOJSONEBNF \cite{crockford2006rfc}
TopoJSONLiteral ::= TopoJSONDescription '^^' geo:topojsonLiteral
TopoJSONDescription ::= TopoJSONEBNF \cite{crockford2006rfc}
WKBLiteral ::= WKBDescription '^^' geo:wkbLiteral
WKBDescription ::= BINARY
HexWKBLiteral ::= HexWKBDescription '^^' geo:hexWKBLiteral
HexWKBDescription ::= HEXADECIMAL
GeoURILiteral ::= geo:LAT,LON '^^' geo:geoURILiteral
SVGLiteral ::= SVGDesription '^^' geo:svgLiteral
SVGDescription ::= SVGEBNF
RasterLiteral ::= GeoTIFFLiteral | GMLCOVLiteral | COVJSONLiteral | RastWKBLiteral
GeoTIFFLiteral ::= GeoTIFFDescription '^^' geo:geotiffLiteral
GeoTIFFDescription ::= BINARY
GMLCOVLiteral ::= GMLCOVDescription '^^' geo:gmlCOVLiteral
GMLCOVDescription ::= GMLEBNF
COVJSONLiteral ::= COVJSONDescription '^^' geo:covJSONLiteral
COVJSONDescription ::= COVJSONEBNF \cite{crockford2006rfc}
RastWKBLiteral ::= RastWKBDescription '^^' geo:rastWKBLiteral
RastWKBDescription ::= RastWKBEBNF
String ::= STRING_LITERAL1 | STRING_LITERAL2 | STRING_LITERAL_LONG1 | STRING_LITERAL_LONG2
IRIref ::= IRI_REF | PrefixedName
PrefixedName ::= PNAME_LN | PNAME_NS
BlankNode ::= BLANK_NODE_LABEL | ANON
IRI_REF ::= '<' ([^<>"{}|^`\]-[#x00-#x20])* '>'
PNAME_NS ::= PN_PREFIX? ':'
PNAME_LN ::= PNAME_NS PN_LOCAL
BLANK_NODE_LABEL ::= '_:' PN_LOCAL
VAR1 ::= '?' VARNAME
VAR2 ::= '$' VARNAME
RASTERVAR ::= '%' VARNAME
LANGTAG ::= '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)*
INTEGER ::= [0-9]+
DECIMAL ::= [0-9]+ '.' [0-9]* | '.' [0-9]+
DOUBLE ::= [0-9]+ '.' [0-9]* EXPONENT | '.' ([0-9])+ EXPONENT | ([0-9])+ EXPONENT
EPSGCODE ::= INTEGER
LAT ::= DOUBLE
LON ::= DOUBLE
INTEGER_POSITIVE ::= '+' INTEGER
DECIMAL_POSITIVE ::= '+' DECIMAL
DOUBLE_POSITIVE ::= '+' DOUBLE
INTEGER_NEGATIVE ::= '-' INTEGER
DECIMAL_NEGATIVE ::= '-' DECIMAL
DOUBLE_NEGATIVE ::= '-' DOUBLE
BINARY ::= [01]+
EXPONENT ::= [eE] [+-]? [0-9]+
STRING_LITERAL1 ::= "'" ( ([^#x27#x5C#xA#xD]) | ECHAR )* "'"
STRING_LITERAL2 ::= '"' ( ([^#x22#x5C#xA#xD]) | ECHAR )* '"'
STRING_LITERAL_LONG1 ::= "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR ) )* "'''"
STRING_LITERAL_LONG2 ::= '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR ) )* '"""'
ECHAR ::= '\' [tbnrf\"']
NIL ::= '(' WS* ')'
WS ::= #x20 | #x9 | #xD | #xA
ANON ::= '[' WS* ']'
PN_CHARS_BASE ::= [A-Z] | [a-z] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x02FF] | [#x0370-#x037D] | [#x037F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
PN_CHARS_U ::= PN_CHARS_BASE | '_'
VARNAME ::= ( PN_CHARS_U | [0-9] ) ( PN_CHARS_U | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] )*
PN_CHARS ::= PN_CHARS_U | '-' | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040]
PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS|'.')* PN_CHARS)?
PN_LOCAL ::= ( PN_CHARS_U | [0-9] ) ((PN_CHARS|'.')* PN_CHARS)?
WKT ::=
point_text_representation |
curve_text_representation |
surface_text_representation |
collection_text_representation;
point_text_representation ::= "POINT" [ z_m_t ] point_text;
curve_text_representation ::=
linestring_text_representation |
circularstring_text_representation |
compoundcurve_text_representation;
linestring_text_representation ::=
"LINESTRING" [ z_m_t ] linestring_text_body;
circularstring_text_representation ::=
"CIRCULARSTRING" [ z_m_t ] circularstring_text;
compoundcurve_text_representation ::=
"COMPOUNDCURVE" [ z_m_t ] compoundcurve_text;
surface_text_representation ::=
curvepolygon_text_representation;
curvepolygon_text_representation ::=
"CURVEPOLYGON" [ z_m_t ] curvepolygon_text_body |
polygon_text_representation |
triangle_text_representation;
polygon_text_representation ::=
"POLYGON" [ z_m_t ] polygon_text_body;
triangle_text_representation ::=
"TRIANGLE" [ z_m_t ] triangle_text_body;
collection_text_representation ::=
multipoint_text_representation |
multicurve_text_representation |
multisurface_text_representation |
geometrycollection_text_representation;
multipoint_text_representation ::=
"MULTIPOINT" [ z_m_t ] multipoint_text;
multicurve_text_representation ::=
"MULTICURVE" [ z_m_t ] multicurve_text |
multilinestring_text_representation;
multilinestring_text_representation ::=
"MULTILINESTRING" [ z_m_t ] multilinestring_text;
multisurface_text_representation ::=
"MULTISURFACE" [ z_m_t ] multisurface_text |
multipolygon_text_representation |
polyhedralsurface_text_representation |
tin_text_representation;
multipolygon_text_representation ::=
"MULTIPOLYGON" [ z_m_t ] multipolygon_text;
polyhedralsurface_text_representation ::=
"POLYHEDRALSURFACE" [ z_m_t ] polyhedralsurface_text;
tin_text_representation ::=
"TIN" [ z_m_t ] tin_text;
geometrycollection_text_representation ::=
"GEOMETRYCOLLECTION" [ z_m_t ] geometrycollection_text;
linestring_text_body ::=
linestring_text;
curvepolygon_text_body ::=
curvepolygon_text;
polygon_text_body ::=
polygon_text;
triangle_text_body ::=
triangle_text;
point_text ::=
empty_set |
left_paren point right_paren;
point ::= x y [ z ] [ m ] [ t ];
x ::= number;
y ::= number;
z ::= number;
m ::= number;
t::= date
linestring_text ::=
empty_set |
left_paren point { comma point } right_paren;
circularstring_text ::=
empty_set |
left_paren point { comma point } right_paren;
compoundcurve_text ::=
empty_set |
left_paren single_curve_text { comma single_curve_text } right_paren;
single_curve_text ::=
linestring_text_body |
circularstring_text_representation;
curve_text ::=
linestring_text_body |
circularstring_text_representation |
compoundcurve_text_representation;
ring_text ::=
linestring_text_body |
circularstring_text_representation |
compoundcurve_text_representation;
surface_text ::=
"CURVEPOLYGON" curvepolygon_text_body |
polygon_text_body;
curvepolygon_text ::=
empty_set |
left_paren ring_text { comma ring_text } right_paren;
polygon_text ::=
empty_set |
left_paren linestring_text { comma linestring_text } right_paren;
triangle_text ::=
empty_set |
left_paren linestring_text right_paren;
multipoint_text ::=
empty_set |
left_paren point_text { comma point_text } right_paren;
multicurve_text ::=
empty_set |
left_paren curve_text { comma curve_text } right_paren;
multilinestring_text ::=
empty_set |
left_paren linestring_text_body { comma linestring_text_body } right_paren;
multisurface_text ::=
empty_set |
left_paren surface_text { comma surface_text } right_paren;
multipolygon_text ::=
empty_set |
left_paren polygon_text_body { comma polygon_text_body } right_paren;
polyhedralsurface_text ::=
empty_set |
left_paren polygon_text_body { comma polygon_text_body } right_paren;
tin_text ::=
empty_set |
left_paren triangle_text_body { comma triangle_text_body } right_paren;
geometrycollection_text ::=
empty_set |
left_paren well_known_text_representation { comma well_known_text_representation } right_paren;
empty_set ::= "EMPTY";
z_m ::= "ZM" | "Z" | "M" | "T" | "ZMT" | "ZT";
left_paren ::= "(";
right_paren ::= ")";
number ::= ?/[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?/? ;
comma ::=',';
{Unescaped} = {All Valid} - {&1 .. &19} - ["\]
{Hex} = {Digit} + [ABCDEFabcdef]
{Digit9} = {Digit} - [0]
! ------------------------------------------------- Terminals
Number = '-'?('0'|{Digit9}{Digit}*)('.'{Digit}+)?([Ee][+-]?{Digit}+)?
String = '"'({Unescaped}|'\'(["\/bfnrt]|'u'{Hex}{Hex}{Hex}{Hex}))*'"'
! ------------------------------------------------- Rules
GEOJSON ::= GEOJSONGEOMETRY
GEOJSONGEOMETRY ::= '{ type:GEOMETRYTYPE ',' coordinates: '}'
GEOMETRYTYPE ::= 'Point' | 'LineString' | 'Polygon' | 'MultiLineString' | 'MultiPolygon' | 'MultiPoint'
POINT ::= '"type":"Point", "coordinates":'COORDINATE
LINESTRING ::= '"type":"LineString", "coordinates":' COORDINATE
COORDINATE: '['LAT,LON']'
COORDINATES ::= text
OBJECT ::= '{' '}'
| '{' MEMBERS '}'
MEMBERS ::= PAIR
| PAIR ',' MEMBERS
PAIR ::= String ':' VALUE
ARRAY ::= '[' ']'
| '[' ELEMENTS ']'
ELEMENTS ::= VALUE
| VALUE ',' ELEMENTS
VALUE ::= String
| Number
| OBJECT
| ARRAY
| true
| false
| null
/* Note that SPARQL local names allow leading digits while XML local names do not. */