@traqula/rules-sparql-1-1 0.0.1-alpha.148 → 0.0.1-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/README.md +5 -3
  2. package/lib/RoundTripTypes.d.ts +379 -0
  3. package/lib/RoundTripTypes.js +2 -0
  4. package/lib/RoundTripTypes.js.map +1 -0
  5. package/lib/Sparql11types.d.ts +32 -241
  6. package/lib/Sparql11types.js.map +1 -1
  7. package/lib/SparqlParser.d.ts +14 -5
  8. package/lib/SparqlParser.js +7 -4
  9. package/lib/SparqlParser.js.map +1 -1
  10. package/lib/expressionHelpers.d.ts +8 -17
  11. package/lib/expressionHelpers.js +42 -105
  12. package/lib/expressionHelpers.js.map +1 -1
  13. package/lib/factory.d.ts +446 -0
  14. package/lib/factory.js +105 -0
  15. package/lib/factory.js.map +1 -0
  16. package/lib/factoryMixins/ContextFactory.d.ts +38 -0
  17. package/lib/factoryMixins/ContextFactory.js +30 -0
  18. package/lib/factoryMixins/ContextFactory.js.map +1 -0
  19. package/lib/factoryMixins/ExpressionFactory.d.ts +59 -0
  20. package/lib/factoryMixins/ExpressionFactory.js +83 -0
  21. package/lib/factoryMixins/ExpressionFactory.js.map +1 -0
  22. package/lib/factoryMixins/GraphRefFactory.d.ts +43 -0
  23. package/lib/factoryMixins/GraphRefFactory.js +51 -0
  24. package/lib/factoryMixins/GraphRefFactory.js.map +1 -0
  25. package/lib/factoryMixins/PathFactory.d.ts +51 -0
  26. package/lib/factoryMixins/PathFactory.js +68 -0
  27. package/lib/factoryMixins/PathFactory.js.map +1 -0
  28. package/lib/factoryMixins/Patternfactory.d.ts +55 -0
  29. package/lib/factoryMixins/Patternfactory.js +98 -0
  30. package/lib/factoryMixins/Patternfactory.js.map +1 -0
  31. package/lib/factoryMixins/QueryFactory.d.ts +41 -0
  32. package/lib/factoryMixins/QueryFactory.js +43 -0
  33. package/lib/factoryMixins/QueryFactory.js.map +1 -0
  34. package/lib/factoryMixins/SolutionModifiersFactory.d.ts +43 -0
  35. package/lib/factoryMixins/SolutionModifiersFactory.js +55 -0
  36. package/lib/factoryMixins/SolutionModifiersFactory.js.map +1 -0
  37. package/lib/factoryMixins/TermFactory.d.ts +76 -0
  38. package/lib/factoryMixins/TermFactory.js +84 -0
  39. package/lib/factoryMixins/TermFactory.js.map +1 -0
  40. package/lib/factoryMixins/UpdateOperationFactory.d.ts +68 -0
  41. package/lib/factoryMixins/UpdateOperationFactory.js +126 -0
  42. package/lib/factoryMixins/UpdateOperationFactory.js.map +1 -0
  43. package/lib/factoryMixins/mixins.d.ts +14 -0
  44. package/lib/factoryMixins/mixins.js +20 -0
  45. package/lib/factoryMixins/mixins.js.map +1 -0
  46. package/lib/grammar/builtIn.d.ts +60 -60
  47. package/lib/grammar/builtIn.js +58 -46
  48. package/lib/grammar/builtIn.js.map +1 -1
  49. package/lib/grammar/dataSetClause.d.ts +22 -9
  50. package/lib/grammar/dataSetClause.js +57 -13
  51. package/lib/grammar/dataSetClause.js.map +1 -1
  52. package/lib/grammar/expression.d.ts +20 -24
  53. package/lib/grammar/expression.js +239 -253
  54. package/lib/grammar/expression.js.map +1 -1
  55. package/lib/grammar/general.d.ts +10 -14
  56. package/lib/grammar/general.js +68 -95
  57. package/lib/grammar/general.js.map +1 -1
  58. package/lib/grammar/literals.d.ts +16 -13
  59. package/lib/grammar/literals.js +164 -112
  60. package/lib/grammar/literals.js.map +1 -1
  61. package/lib/grammar/propertyPaths.d.ts +16 -12
  62. package/lib/grammar/propertyPaths.js +103 -114
  63. package/lib/grammar/propertyPaths.js.map +1 -1
  64. package/lib/grammar/queryUnit/queryUnit.d.ts +15 -19
  65. package/lib/grammar/queryUnit/queryUnit.js +209 -247
  66. package/lib/grammar/queryUnit/queryUnit.js.map +1 -1
  67. package/lib/grammar/solutionModifier.d.ts +13 -12
  68. package/lib/grammar/solutionModifier.js +128 -78
  69. package/lib/grammar/solutionModifier.js.map +1 -1
  70. package/lib/grammar/tripleBlock.d.ts +27 -32
  71. package/lib/grammar/tripleBlock.js +197 -123
  72. package/lib/grammar/tripleBlock.js.map +1 -1
  73. package/lib/grammar/updateUnit/updateUnit.d.ts +32 -37
  74. package/lib/grammar/updateUnit/updateUnit.js +315 -264
  75. package/lib/grammar/updateUnit/updateUnit.js.map +1 -1
  76. package/lib/grammar/whereClause.d.ts +22 -21
  77. package/lib/grammar/whereClause.js +249 -191
  78. package/lib/grammar/whereClause.js.map +1 -1
  79. package/lib/grammar-helpers/utils.d.ts +12 -0
  80. package/lib/grammar-helpers/utils.js +16 -0
  81. package/lib/grammar-helpers/utils.js.map +1 -0
  82. package/lib/index.cjs +3281 -2126
  83. package/lib/index.d.ts +5 -1
  84. package/lib/index.js +5 -1
  85. package/lib/index.js.map +1 -1
  86. package/lib/lexer/BuildinCalls.d.ts +62 -184
  87. package/lib/lexer/BuildinCalls.js +1 -2
  88. package/lib/lexer/BuildinCalls.js.map +1 -1
  89. package/lib/lexer/graph.d.ts +5 -13
  90. package/lib/lexer/graph.js +1 -2
  91. package/lib/lexer/graph.js.map +1 -1
  92. package/lib/lexer/lexer.d.ts +50 -143
  93. package/lib/lexer/lexer.js +12 -9
  94. package/lib/lexer/lexer.js.map +1 -1
  95. package/lib/lexer/symbols.d.ts +27 -79
  96. package/lib/lexer/symbols.js +1 -2
  97. package/lib/lexer/symbols.js.map +1 -1
  98. package/lib/lexer/terminals.d.ts +25 -107
  99. package/lib/lexer/terminals.js +36 -49
  100. package/lib/lexer/terminals.js.map +1 -1
  101. package/lib/utils.d.ts +5 -3
  102. package/lib/utils.js +22 -5
  103. package/lib/utils.js.map +1 -1
  104. package/lib/validation/validators.d.ts +14 -0
  105. package/lib/validation/validators.js +235 -0
  106. package/lib/validation/validators.js.map +1 -0
  107. package/package.json +12 -14
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
- # TRAQULA Rules SPARQL 1.1
1
+ # Traqula Rules SPARQL 1.1
2
2
 
3
- TRAQULA rules SPARQL 1.1 contains rules required for creating a parser for SPARQL 1.1.
3
+ **WARNING:** V2 will come shortly and will have lots of breaking changes.
4
+
5
+ Traqula rules SPARQL 1.1 contains rules required for creating a parser for SPARQL 1.1.
4
6
 
5
7
  ## Installation
6
8
 
@@ -12,4 +14,4 @@ or
12
14
 
13
15
  ```bash
14
16
  yarn add @traqula/rules-sparql-1-1
15
- ```
17
+ ```
@@ -0,0 +1,379 @@
1
+ import type { Localized, Node } from '@traqula/core';
2
+ export type Sparql11Nodes = GraphRef | UpdateOperation | Update | Query | DatasetClauses | TripleCollection | TripleNesting | Pattern | SolutionModifier | Expression | Path | ContextDefinition | Wildcard | Term;
3
+ export type GraphRefBase = Node & {
4
+ type: 'graphRef';
5
+ subType: string;
6
+ };
7
+ export type GraphRefDefault = GraphRefBase & {
8
+ subType: 'default';
9
+ };
10
+ export type GraphRefNamed = GraphRefBase & {
11
+ subType: 'named';
12
+ };
13
+ export type GraphRefAll = GraphRefBase & {
14
+ subType: 'all';
15
+ };
16
+ export type GraphRefSpecific = GraphRefBase & {
17
+ subType: 'specific';
18
+ graph: TermIri;
19
+ };
20
+ export type GraphRef = GraphRefDefault | GraphRefNamed | GraphRefAll | GraphRefSpecific;
21
+ export type Quads = PatternBgp | GraphQuads;
22
+ export type GraphQuads = Node & {
23
+ type: 'graph';
24
+ graph: TermIri | TermVariable;
25
+ triples: PatternBgp;
26
+ };
27
+ export type UpdateOperationBase = Node & {
28
+ type: 'updateOperation';
29
+ subType: string;
30
+ };
31
+ export type UpdateOperationLoad = UpdateOperationBase & {
32
+ subType: 'load';
33
+ silent: boolean;
34
+ source: TermIri;
35
+ destination?: GraphRefSpecific;
36
+ };
37
+ type UpdateOperationClearDropCreateBase = UpdateOperationBase & {
38
+ subType: 'clear' | 'drop' | 'create';
39
+ silent: boolean;
40
+ destination: GraphRef;
41
+ };
42
+ export type UpdateOperationClear = UpdateOperationClearDropCreateBase & {
43
+ subType: 'clear';
44
+ };
45
+ export type UpdateOperationDrop = UpdateOperationClearDropCreateBase & {
46
+ subType: 'drop';
47
+ };
48
+ export type UpdateOperationCreate = UpdateOperationClearDropCreateBase & {
49
+ subType: 'create';
50
+ destination: GraphRefSpecific;
51
+ };
52
+ type UpdateOperationAddMoveCopy = UpdateOperationBase & {
53
+ subType: 'add' | 'move' | 'copy';
54
+ silent: boolean;
55
+ source: GraphRefDefault | GraphRefSpecific;
56
+ destination: GraphRefDefault | GraphRefSpecific;
57
+ };
58
+ export type UpdateOperationAdd = UpdateOperationAddMoveCopy & {
59
+ subType: 'add';
60
+ };
61
+ export type UpdateOperationMove = UpdateOperationAddMoveCopy & {
62
+ subType: 'move';
63
+ };
64
+ export type UpdateOperationCopy = UpdateOperationAddMoveCopy & {
65
+ subType: 'copy';
66
+ };
67
+ type UpdateOperationInsertDeleteDelWhere = UpdateOperationBase & {
68
+ subType: 'insertdata' | 'deletedata' | 'deletewhere';
69
+ data: Quads[];
70
+ };
71
+ export type UpdateOperationInsertData = UpdateOperationInsertDeleteDelWhere & {
72
+ subType: 'insertdata';
73
+ };
74
+ export type UpdateOperationDeleteData = UpdateOperationInsertDeleteDelWhere & {
75
+ subType: 'deletedata';
76
+ };
77
+ export type UpdateOperationDeleteWhere = UpdateOperationInsertDeleteDelWhere & {
78
+ subType: 'deletewhere';
79
+ };
80
+ export type UpdateOperationModify = UpdateOperationBase & {
81
+ subType: 'modify';
82
+ graph: TermIri | undefined;
83
+ insert: Quads[];
84
+ delete: Quads[];
85
+ from: DatasetClauses;
86
+ where: PatternGroup;
87
+ };
88
+ export type UpdateOperation = UpdateOperationLoad | UpdateOperationClear | UpdateOperationDrop | UpdateOperationCreate | UpdateOperationAdd | UpdateOperationMove | UpdateOperationCopy | UpdateOperationInsertData | UpdateOperationDeleteData | UpdateOperationDeleteWhere | UpdateOperationModify;
89
+ export type Update = Node & {
90
+ type: 'update';
91
+ updates: {
92
+ operation?: UpdateOperation;
93
+ context: ContextDefinition[];
94
+ }[];
95
+ };
96
+ export type QueryBase = Node & {
97
+ type: 'query';
98
+ subType: string;
99
+ context: ContextDefinition[];
100
+ values?: PatternValues;
101
+ solutionModifiers: SolutionModifiers;
102
+ datasets: DatasetClauses;
103
+ where?: PatternGroup;
104
+ };
105
+ export type QuerySelect = QueryBase & {
106
+ subType: 'select';
107
+ variables: (TermVariable | PatternBind)[] | [Wildcard];
108
+ distinct?: true;
109
+ reduced?: true;
110
+ where: PatternGroup;
111
+ };
112
+ export type QueryConstruct = QueryBase & {
113
+ subType: 'construct';
114
+ template: PatternBgp;
115
+ where: PatternGroup;
116
+ };
117
+ export type QueryDescribe = QueryBase & {
118
+ subType: 'describe';
119
+ variables: (TermVariable | TermIri)[] | [Wildcard];
120
+ };
121
+ export type QueryAsk = QueryBase & {
122
+ subType: 'ask';
123
+ where: PatternGroup;
124
+ };
125
+ export type Query = QuerySelect | QueryConstruct | QueryDescribe | QueryAsk;
126
+ export type SparqlQuery = Query | Update;
127
+ export type DatasetClauses = Node & {
128
+ type: 'datasetClauses';
129
+ clauses: {
130
+ clauseType: 'default' | 'named';
131
+ value: TermIri;
132
+ }[];
133
+ };
134
+ export type TripleCollectionBase = Node & {
135
+ type: 'tripleCollection';
136
+ subType: string;
137
+ triples: TripleNesting[];
138
+ identifier: Term;
139
+ };
140
+ /**
141
+ * The subject of the triples does not have a string manifestation.
142
+ */
143
+ export type TripleCollectionList = TripleCollectionBase & {
144
+ subType: 'list';
145
+ identifier: TermBlank;
146
+ };
147
+ /**
148
+ * Bot subject and predicate of the triples do not have a string manifestation.
149
+ */
150
+ export type TripleCollectionBlankNodeProperties = TripleCollectionBase & {
151
+ subType: 'blankNodeProperties';
152
+ identifier: TermBlank;
153
+ };
154
+ export type TripleCollection = TripleCollectionList | TripleCollectionBlankNodeProperties;
155
+ export type GraphNode = Term | TripleCollection;
156
+ export type TripleNesting = Node & {
157
+ type: 'triple';
158
+ subject: GraphNode;
159
+ predicate: TermIri | TermVariable | Path;
160
+ object: GraphNode;
161
+ };
162
+ export type PatternBase = Node & {
163
+ type: 'pattern';
164
+ subType: string;
165
+ };
166
+ export type PatternFilter = PatternBase & {
167
+ subType: 'filter';
168
+ expression: Expression;
169
+ };
170
+ export type PatternMinus = PatternBase & {
171
+ subType: 'minus';
172
+ patterns: Pattern[];
173
+ };
174
+ export type PatternGroup = PatternBase & {
175
+ subType: 'group';
176
+ patterns: Pattern[];
177
+ };
178
+ export type PatternOptional = PatternBase & {
179
+ subType: 'optional';
180
+ patterns: Pattern[];
181
+ };
182
+ export type PatternGraph = PatternBase & {
183
+ subType: 'graph';
184
+ name: TermIri | TermVariable;
185
+ patterns: Pattern[];
186
+ };
187
+ export type PatternUnion = PatternBase & {
188
+ subType: 'union';
189
+ patterns: PatternGroup[];
190
+ };
191
+ export type BasicGraphPattern = (TripleNesting | TripleCollection)[];
192
+ export type PatternBgp = PatternBase & {
193
+ subType: 'bgp';
194
+ /**
195
+ * Only the first appearance of a subject and predicate have a string manifestation
196
+ */
197
+ triples: BasicGraphPattern;
198
+ };
199
+ export type PatternBind = PatternBase & {
200
+ subType: 'bind';
201
+ expression: Expression;
202
+ variable: TermVariable;
203
+ };
204
+ export type PatternService = PatternBase & {
205
+ subType: 'service';
206
+ name: TermIri | TermVariable;
207
+ silent: boolean;
208
+ patterns: Pattern[];
209
+ };
210
+ /**
211
+ * A single list of assignments maps the variable identifier to the value
212
+ */
213
+ export type ValuePatternRow = Record<string, TermIri | TermLiteral | undefined>;
214
+ export type PatternValues = PatternBase & {
215
+ subType: 'values';
216
+ values: ValuePatternRow[];
217
+ };
218
+ export type SubSelect = QuerySelect;
219
+ export type Pattern = PatternBgp | PatternGroup | PatternUnion | PatternOptional | PatternMinus | PatternGraph | PatternService | PatternFilter | PatternBind | PatternValues | SubSelect;
220
+ export type SolutionModifiers = {
221
+ group?: SolutionModifierGroup;
222
+ having?: SolutionModifierHaving;
223
+ order?: SolutionModifierOrder;
224
+ limitOffset?: SolutionModifierLimitOffset;
225
+ };
226
+ export type SolutionModifierBase = Node & {
227
+ type: 'solutionModifier';
228
+ subType: string;
229
+ };
230
+ export type SolutionModifierGroupBind = Localized & {
231
+ variable: TermVariable;
232
+ value: Expression;
233
+ };
234
+ export type SolutionModifierGroup = SolutionModifierBase & {
235
+ subType: 'group';
236
+ groupings: (Expression | SolutionModifierGroupBind)[];
237
+ };
238
+ export type SolutionModifierHaving = SolutionModifierBase & {
239
+ subType: 'having';
240
+ having: Expression[];
241
+ };
242
+ export type Ordering = Localized & {
243
+ descending: boolean;
244
+ expression: Expression;
245
+ };
246
+ export type SolutionModifierOrder = SolutionModifierBase & {
247
+ subType: 'order';
248
+ orderDefs: Ordering[];
249
+ };
250
+ export type SolutionModifierLimitOffset = SolutionModifierBase & {
251
+ subType: 'limitOffset';
252
+ limit: number | undefined;
253
+ offset: number | undefined;
254
+ };
255
+ export type SolutionModifier = SolutionModifierGroup | SolutionModifierHaving | SolutionModifierOrder | SolutionModifierLimitOffset;
256
+ export type ExpressionBase = Node & {
257
+ type: 'expression';
258
+ subType: string;
259
+ };
260
+ type ExpressionAggregateBase = ExpressionBase & {
261
+ subType: 'aggregate';
262
+ distinct: boolean;
263
+ expression: [Expression | Wildcard];
264
+ };
265
+ export type ExpressionAggregateDefault = ExpressionAggregateBase & {
266
+ expression: [Expression];
267
+ aggregation: string;
268
+ };
269
+ export type ExpressionAggregateOnWildcard = ExpressionAggregateBase & {
270
+ expression: [Wildcard];
271
+ aggregation: string;
272
+ };
273
+ export type ExpressionAggregateSeparator = ExpressionAggregateBase & {
274
+ expression: [Expression];
275
+ aggregation: string;
276
+ separator: string;
277
+ };
278
+ export type ExpressionAggregate = ExpressionAggregateDefault | ExpressionAggregateOnWildcard | ExpressionAggregateSeparator;
279
+ export type ExpressionOperation = ExpressionBase & {
280
+ subType: 'operation';
281
+ operator: string;
282
+ args: Expression[];
283
+ };
284
+ export type ExpressionPatternOperation = ExpressionBase & {
285
+ subType: 'patternOperation';
286
+ operator: string;
287
+ args: PatternGroup;
288
+ };
289
+ export type ExpressionFunctionCall = ExpressionBase & {
290
+ subType: 'functionCall';
291
+ function: TermIri;
292
+ distinct: boolean;
293
+ args: Expression[];
294
+ };
295
+ export type Expression = ExpressionOperation | ExpressionPatternOperation | ExpressionFunctionCall | ExpressionAggregate | TermIri | TermVariable | TermLiteral;
296
+ export type PropertyPathBase = Node & {
297
+ type: 'path';
298
+ subType: string;
299
+ };
300
+ export type PropertyPathChain = PropertyPathBase & {
301
+ subType: '|' | '/';
302
+ items: Path[];
303
+ };
304
+ export type PathModified = PropertyPathBase & {
305
+ subType: '?' | '*' | '+' | '^';
306
+ items: [Path];
307
+ };
308
+ export type PathNegatedElt = PropertyPathBase & {
309
+ subType: '^';
310
+ items: [TermIri];
311
+ };
312
+ export type PathAlternativeLimited = PropertyPathBase & {
313
+ subType: '|';
314
+ items: (TermIri | PathNegatedElt)[];
315
+ };
316
+ export type PathNegated = PropertyPathBase & {
317
+ subType: '!';
318
+ items: [TermIri | PathNegatedElt | PathAlternativeLimited];
319
+ };
320
+ export type Path = TermIri | PropertyPathChain | PathModified | PathNegated;
321
+ export type PathPure = PropertyPathChain | PathModified | PathNegated;
322
+ export type ContextDefinitionBase_ = Node & {
323
+ type: 'contextDef';
324
+ subType: string;
325
+ };
326
+ export type ContextDefinitionPrefix = ContextDefinitionBase_ & {
327
+ subType: 'prefix';
328
+ key: string;
329
+ value: TermIriFull;
330
+ };
331
+ export type ContextDefinitionBase = ContextDefinitionBase_ & {
332
+ subType: 'base';
333
+ value: TermIriFull;
334
+ };
335
+ export type ContextDefinition = ContextDefinitionPrefix | ContextDefinitionBase;
336
+ export type Wildcard = Node & {
337
+ type: 'wildcard';
338
+ };
339
+ export type TermBase = Node & {
340
+ type: 'term';
341
+ subType: string;
342
+ };
343
+ export type TermLiteralBase = TermBase & {
344
+ subType: 'literal';
345
+ value: string;
346
+ };
347
+ export type TermLiteralStr = TermLiteralBase & {
348
+ langOrIri: undefined;
349
+ };
350
+ export type TermLiteralLangStr = TermLiteralBase & {
351
+ langOrIri: string;
352
+ };
353
+ export type TermLiteralTyped = TermLiteralBase & {
354
+ langOrIri: TermIri;
355
+ };
356
+ export type TermLiteral = TermLiteralStr | TermLiteralLangStr | TermLiteralTyped;
357
+ export type TermVariable = TermBase & {
358
+ subType: 'variable';
359
+ value: string;
360
+ };
361
+ export type TermIriBase = TermBase & {
362
+ subType: 'namedNode';
363
+ };
364
+ export type TermIriFull = TermIriBase & {
365
+ value: string;
366
+ };
367
+ export type TermIriPrefixed = TermIriBase & {
368
+ value: string;
369
+ prefix: string;
370
+ };
371
+ export type TermIri = TermIriFull | TermIriPrefixed;
372
+ export type TermBlank = TermBase & {
373
+ subType: 'blankNode';
374
+ } & {
375
+ label: string;
376
+ };
377
+ export type GraphTerm = TermIri | TermBlank | TermLiteral;
378
+ export type Term = GraphTerm | TermVariable;
379
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=RoundTripTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RoundTripTypes.js","sourceRoot":"","sources":["RoundTripTypes.ts"],"names":[],"mappings":"","sourcesContent":["import type { Localized, Node } from '@traqula/core';\n\nexport type Sparql11Nodes =\n | GraphRef\n | UpdateOperation\n | Update\n | Query\n | DatasetClauses\n | TripleCollection\n | TripleNesting\n | Pattern\n | SolutionModifier\n | Expression\n | Path\n | ContextDefinition\n | Wildcard\n | Term;\n\nexport type GraphRefBase = Node & {\n type: 'graphRef';\n subType: string;\n};\nexport type GraphRefDefault = GraphRefBase & {\n subType: 'default';\n};\nexport type GraphRefNamed = GraphRefBase & {\n subType: 'named';\n};\nexport type GraphRefAll = GraphRefBase & {\n subType: 'all';\n};\nexport type GraphRefSpecific = GraphRefBase & {\n subType: 'specific';\n graph: TermIri;\n};\nexport type GraphRef =\n | GraphRefDefault\n | GraphRefNamed\n | GraphRefAll\n | GraphRefSpecific;\n\nexport type Quads = PatternBgp | GraphQuads;\n\nexport type GraphQuads = Node & {\n type: 'graph';\n graph: TermIri | TermVariable;\n triples: PatternBgp;\n};\n\n// https://www.w3.org/TR/sparql11-query/#rUpdate1\nexport type UpdateOperationBase = Node & { type: 'updateOperation'; subType: string };\nexport type UpdateOperationLoad = UpdateOperationBase & {\n subType: 'load';\n silent: boolean;\n source: TermIri;\n destination?: GraphRefSpecific;\n};\ntype UpdateOperationClearDropCreateBase = UpdateOperationBase & {\n subType: 'clear' | 'drop' | 'create';\n silent: boolean;\n destination: GraphRef;\n};\nexport type UpdateOperationClear = UpdateOperationClearDropCreateBase & { subType: 'clear' };\nexport type UpdateOperationDrop = UpdateOperationClearDropCreateBase & { subType: 'drop' };\nexport type UpdateOperationCreate = UpdateOperationClearDropCreateBase & {\n subType: 'create';\n destination: GraphRefSpecific;\n};\ntype UpdateOperationAddMoveCopy = UpdateOperationBase & {\n subType: 'add' | 'move' | 'copy';\n silent: boolean;\n source: GraphRefDefault | GraphRefSpecific;\n destination: GraphRefDefault | GraphRefSpecific;\n};\nexport type UpdateOperationAdd = UpdateOperationAddMoveCopy & { subType: 'add' };\nexport type UpdateOperationMove = UpdateOperationAddMoveCopy & { subType: 'move' };\nexport type UpdateOperationCopy = UpdateOperationAddMoveCopy & { subType: 'copy' };\ntype UpdateOperationInsertDeleteDelWhere = UpdateOperationBase & {\n subType: 'insertdata' | 'deletedata' | 'deletewhere';\n data: Quads[];\n};\nexport type UpdateOperationInsertData = UpdateOperationInsertDeleteDelWhere & { subType: 'insertdata' };\nexport type UpdateOperationDeleteData = UpdateOperationInsertDeleteDelWhere & { subType: 'deletedata' };\nexport type UpdateOperationDeleteWhere = UpdateOperationInsertDeleteDelWhere & { subType: 'deletewhere' };\nexport type UpdateOperationModify = UpdateOperationBase & {\n subType: 'modify';\n graph: TermIri | undefined;\n insert: Quads[];\n delete: Quads[];\n from: DatasetClauses;\n where: PatternGroup;\n};\nexport type UpdateOperation =\n | UpdateOperationLoad\n | UpdateOperationClear\n | UpdateOperationDrop\n | UpdateOperationCreate\n | UpdateOperationAdd\n | UpdateOperationMove\n | UpdateOperationCopy\n | UpdateOperationInsertData\n | UpdateOperationDeleteData\n | UpdateOperationDeleteWhere\n | UpdateOperationModify;\n\n// https://www.w3.org/TR/sparql11-query/#rUpdate\nexport type Update = Node & {\n type: 'update';\n updates: {\n operation?: UpdateOperation;\n context: ContextDefinition[];\n }[];\n};\n\n// https://www.w3.org/TR/sparql11-query/#rQueryUnit\nexport type QueryBase = Node & {\n type: 'query';\n subType: string;\n\n context: ContextDefinition[];\n values?: PatternValues;\n solutionModifiers: SolutionModifiers;\n datasets: DatasetClauses;\n where?: PatternGroup;\n};\nexport type QuerySelect = QueryBase & {\n subType: 'select';\n variables: (TermVariable | PatternBind)[] | [Wildcard];\n distinct?: true;\n reduced?: true;\n where: PatternGroup;\n};\nexport type QueryConstruct = QueryBase & {\n subType: 'construct';\n template: PatternBgp;\n where: PatternGroup;\n};\nexport type QueryDescribe = QueryBase & {\n subType: 'describe';\n variables: (TermVariable | TermIri)[] | [Wildcard];\n};\nexport type QueryAsk = QueryBase & {\n subType: 'ask';\n where: PatternGroup;\n};\nexport type Query =\n | QuerySelect\n | QueryConstruct\n | QueryDescribe\n | QueryAsk;\n\nexport type SparqlQuery = Query | Update;\n\n// https://www.w3.org/TR/sparql11-query/#rDatasetClause\nexport type DatasetClauses = Node & {\n type: 'datasetClauses';\n clauses: { clauseType: 'default' | 'named'; value: TermIri }[];\n};\n\n// https://www.w3.org/TR/sparql11-query/#rGraphNode\nexport type TripleCollectionBase = Node & {\n type: 'tripleCollection';\n subType: string;\n triples: TripleNesting[];\n identifier: Term;\n};\n/**\n * The subject of the triples does not have a string manifestation.\n */\nexport type TripleCollectionList = TripleCollectionBase & {\n subType: 'list';\n identifier: TermBlank;\n};\n/**\n * Bot subject and predicate of the triples do not have a string manifestation.\n */\nexport type TripleCollectionBlankNodeProperties = TripleCollectionBase & {\n subType: 'blankNodeProperties';\n identifier: TermBlank;\n};\nexport type TripleCollection =\n | TripleCollectionList\n | TripleCollectionBlankNodeProperties;\n\n// https://www.w3.org/TR/sparql11-query/#rGraphNode\nexport type GraphNode = Term | TripleCollection;\n\n// https://www.w3.org/TR/sparql11-query/#rTriplesBlock\nexport type TripleNesting = Node & {\n type: 'triple';\n subject: GraphNode;\n predicate: TermIri | TermVariable | Path;\n object: GraphNode;\n};\n\nexport type PatternBase = Node & { type: 'pattern'; subType: string };\nexport type PatternFilter = PatternBase & {\n subType: 'filter';\n expression: Expression;\n};\nexport type PatternMinus = PatternBase & {\n subType: 'minus';\n patterns: Pattern[];\n};\n\nexport type PatternGroup = PatternBase & {\n subType: 'group';\n patterns: Pattern[];\n};\nexport type PatternOptional = PatternBase & {\n subType: 'optional';\n patterns: Pattern[];\n};\nexport type PatternGraph = PatternBase & {\n subType: 'graph';\n name: TermIri | TermVariable;\n patterns: Pattern[];\n};\nexport type PatternUnion = PatternBase & {\n subType: 'union';\n patterns: PatternGroup[];\n};\nexport type BasicGraphPattern = (TripleNesting | TripleCollection)[];\nexport type PatternBgp = PatternBase & {\n subType: 'bgp';\n /**\n * Only the first appearance of a subject and predicate have a string manifestation\n */\n triples: BasicGraphPattern;\n};\nexport type PatternBind = PatternBase & {\n subType: 'bind';\n expression: Expression;\n variable: TermVariable;\n};\nexport type PatternService = PatternBase & {\n subType: 'service';\n name: TermIri | TermVariable;\n silent: boolean;\n patterns: Pattern[];\n};\n/**\n * A single list of assignments maps the variable identifier to the value\n */\nexport type ValuePatternRow = Record<string, TermIri | TermLiteral | undefined>;\nexport type PatternValues = PatternBase & {\n subType: 'values';\n values: ValuePatternRow[];\n};\nexport type SubSelect = QuerySelect;\n\nexport type Pattern =\n | PatternBgp\n | PatternGroup\n | PatternUnion\n | PatternOptional\n | PatternMinus\n | PatternGraph\n | PatternService\n | PatternFilter\n | PatternBind\n | PatternValues\n | SubSelect;\n\nexport type SolutionModifiers = {\n group?: SolutionModifierGroup;\n having?: SolutionModifierHaving;\n order?: SolutionModifierOrder;\n limitOffset?: SolutionModifierLimitOffset;\n};\nexport type SolutionModifierBase = Node & { type: 'solutionModifier'; subType: string };\nexport type SolutionModifierGroupBind = Localized & {\n variable: TermVariable;\n value: Expression;\n};\nexport type SolutionModifierGroup = SolutionModifierBase & {\n subType: 'group';\n groupings: (Expression | SolutionModifierGroupBind)[];\n};\nexport type SolutionModifierHaving = SolutionModifierBase & {\n subType: 'having';\n having: Expression[];\n};\nexport type Ordering = Localized & {\n descending: boolean;\n expression: Expression;\n};\nexport type SolutionModifierOrder = SolutionModifierBase & {\n subType: 'order';\n orderDefs: Ordering[];\n};\nexport type SolutionModifierLimitOffset = SolutionModifierBase\n & { subType: 'limitOffset'; limit: number | undefined; offset: number | undefined };\n\nexport type SolutionModifier =\n | SolutionModifierGroup\n | SolutionModifierHaving\n | SolutionModifierOrder\n | SolutionModifierLimitOffset;\n\nexport type ExpressionBase = Node & { type: 'expression'; subType: string };\n\ntype ExpressionAggregateBase = ExpressionBase & {\n subType: 'aggregate';\n distinct: boolean;\n expression: [Expression | Wildcard];\n};\nexport type ExpressionAggregateDefault = ExpressionAggregateBase & {\n expression: [Expression];\n aggregation: string;\n};\nexport type ExpressionAggregateOnWildcard = ExpressionAggregateBase & {\n expression: [Wildcard];\n aggregation: string;\n};\nexport type ExpressionAggregateSeparator = ExpressionAggregateBase & {\n expression: [Expression];\n aggregation: string;\n separator: string;\n};\nexport type ExpressionAggregate =\n | ExpressionAggregateDefault\n | ExpressionAggregateOnWildcard\n | ExpressionAggregateSeparator;\n\nexport type ExpressionOperation = ExpressionBase & {\n subType: 'operation';\n operator: string;\n args: Expression[];\n};\n\nexport type ExpressionPatternOperation = ExpressionBase & {\n subType: 'patternOperation';\n operator: string;\n // Can be a pattern in case of exists and not exists\n args: PatternGroup;\n};\n\nexport type ExpressionFunctionCall = ExpressionBase & {\n subType: 'functionCall';\n function: TermIri;\n distinct: boolean;\n args: Expression[];\n};\n\nexport type Expression =\n | ExpressionOperation\n | ExpressionPatternOperation\n | ExpressionFunctionCall\n | ExpressionAggregate\n | TermIri\n | TermVariable\n | TermLiteral;\n\nexport type PropertyPathBase = Node & { type: 'path'; subType: string };\nexport type PropertyPathChain = PropertyPathBase & {\n subType: '|' | '/';\n items: Path[];\n};\n\nexport type PathModified = PropertyPathBase & {\n subType: '?' | '*' | '+' | '^';\n items: [Path];\n};\n\nexport type PathNegatedElt = PropertyPathBase & {\n subType: '^';\n items: [TermIri];\n};\n\nexport type PathAlternativeLimited = PropertyPathBase & {\n subType: '|';\n items: (TermIri | PathNegatedElt)[];\n};\n\nexport type PathNegated = PropertyPathBase & {\n subType: '!';\n items: [TermIri | PathNegatedElt | PathAlternativeLimited];\n};\n\n// [[88]](https://www.w3.org/TR/sparql11-query/#rPath)\nexport type Path =\n | TermIri\n | PropertyPathChain\n | PathModified\n | PathNegated;\nexport type PathPure = PropertyPathChain | PathModified | PathNegated;\n\nexport type ContextDefinitionBase_ = Node & { type: 'contextDef'; subType: string };\nexport type ContextDefinitionPrefix = ContextDefinitionBase_ & {\n subType: 'prefix';\n key: string;\n value: TermIriFull;\n};\nexport type ContextDefinitionBase = ContextDefinitionBase_ & {\n subType: 'base';\n value: TermIriFull;\n};\nexport type ContextDefinition = ContextDefinitionPrefix | ContextDefinitionBase;\n\nexport type Wildcard = Node & {\n type: 'wildcard';\n};\n\nexport type TermBase = Node & { type: 'term'; subType: string };\nexport type TermLiteralBase = TermBase & {\n subType: 'literal';\n value: string;\n};\nexport type TermLiteralStr = TermLiteralBase & { langOrIri: undefined };\nexport type TermLiteralLangStr = TermLiteralBase & { langOrIri: string };\nexport type TermLiteralTyped = TermLiteralBase & { langOrIri: TermIri };\nexport type TermLiteral = TermLiteralStr | TermLiteralLangStr | TermLiteralTyped;\n\nexport type TermVariable = TermBase & {\n subType: 'variable';\n value: string;\n};\n\nexport type TermIriBase = TermBase & { subType: 'namedNode' };\nexport type TermIriFull = TermIriBase & { value: string };\nexport type TermIriPrefixed = TermIriBase & {\n value: string;\n prefix: string;\n};\nexport type TermIri = TermIriFull | TermIriPrefixed;\n\nexport type TermBlank = TermBase & { subType: 'blankNode' } & { label: string };\n\nexport type GraphTerm = TermIri | TermBlank | TermLiteral;\nexport type Term = GraphTerm | TermVariable;\n"]}