@traqula/test-utils 1.1.0 → 1.1.2

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 (53) hide show
  1. package/README.md +33 -3
  2. package/dist/cjs/lib/Sparql11NotesTest.js +6 -0
  3. package/dist/cjs/lib/Sparql11NotesTest.js.map +1 -1
  4. package/dist/cjs/lib/fileUtils.js +10 -0
  5. package/dist/cjs/lib/fileUtils.js.map +1 -1
  6. package/dist/cjs/lib/generators/algebraGenerators.js +10 -0
  7. package/dist/cjs/lib/generators/algebraGenerators.js.map +1 -1
  8. package/dist/cjs/lib/generators/generators.js +13 -0
  9. package/dist/cjs/lib/generators/generators.js.map +1 -1
  10. package/dist/cjs/lib/generators/utils.js +5 -0
  11. package/dist/cjs/lib/generators/utils.js.map +1 -1
  12. package/dist/esm/lib/Sparql11NotesTest.d.ts +6 -0
  13. package/dist/esm/lib/Sparql11NotesTest.js +6 -0
  14. package/dist/esm/lib/Sparql11NotesTest.js.map +1 -1
  15. package/dist/esm/lib/fileUtils.d.ts +10 -0
  16. package/dist/esm/lib/fileUtils.js +10 -0
  17. package/dist/esm/lib/fileUtils.js.map +1 -1
  18. package/dist/esm/lib/generators/algebraGenerators.d.ts +19 -2
  19. package/dist/esm/lib/generators/algebraGenerators.js +10 -0
  20. package/dist/esm/lib/generators/algebraGenerators.js.map +1 -1
  21. package/dist/esm/lib/generators/generators.d.ts +13 -0
  22. package/dist/esm/lib/generators/generators.js +13 -0
  23. package/dist/esm/lib/generators/generators.js.map +1 -1
  24. package/dist/esm/lib/generators/utils.d.ts +5 -0
  25. package/dist/esm/lib/generators/utils.js +5 -0
  26. package/dist/esm/lib/generators/utils.js.map +1 -1
  27. package/package.json +2 -2
  28. package/statics/algebra/algebra/sparql12/select-variable-reuse.json +137 -0
  29. package/statics/algebra/algebra-blank-to-var/sparql12/select-variable-reuse.json +137 -0
  30. package/statics/algebra/canonical-sparql/base/sparql-1.1/values/values-many-once.sparql +1 -1
  31. package/statics/algebra/canonical-sparql/base/sparql12/select-variable-reuse.sparql +8 -0
  32. package/statics/algebra/canonical-sparql/blank-to-var/sparql-1.1/values/values-many-once.sparql +1 -1
  33. package/statics/algebra/canonical-sparql/blank-to-var/sparql12/select-variable-reuse.sparql +8 -0
  34. package/statics/algebra/sparql/sparql12/select-variable-reuse.sparql +3 -0
  35. package/statics/ast/ast-source-tracked/sparql-1-1/note-as-var-not-in-term-subquery.json +166 -0
  36. package/statics/ast/ast-source-tracked/sparql-1-1/note-as-var-not-in-wildcard-subquery.json +164 -0
  37. package/statics/ast/ast-source-tracked/sparql-1-1/note-expression-grouped-var.json +169 -0
  38. package/statics/ast/ast-source-tracked/sparql-1-2/select-variable-reuse.json +243 -0
  39. package/statics/ast/sparql/sparql-1-1/note-as-var-not-in-term-subquery.sparql +1 -0
  40. package/statics/ast/sparql/sparql-1-1/note-as-var-not-in-wildcard-subquery.sparql +1 -0
  41. package/statics/ast/sparql/sparql-1-1/note-expression-grouped-var.sparql +1 -0
  42. package/statics/ast/sparql/sparql-1-1-invalid/count-with-ungrouped-expression-variable.sparql +1 -0
  43. package/statics/ast/sparql/sparql-1-1-invalid/select-star-with-group-by.sparql +1 -0
  44. package/statics/ast/sparql/sparql-1-1-invalid/ungrouped-variable-in-expression-projection.sparql +1 -0
  45. package/statics/ast/sparql/sparql-1-2/select-variable-reuse.sparql +3 -0
  46. package/statics/ast/sparql-generated/sparql-1-1/note-as-var-not-in-term-subquery.sparql +5 -0
  47. package/statics/ast/sparql-generated/sparql-1-1/note-as-var-not-in-wildcard-subquery.sparql +5 -0
  48. package/statics/ast/sparql-generated/sparql-1-1/note-expression-grouped-var.sparql +4 -0
  49. package/statics/ast/sparql-generated/sparql-1-2/select-variable-reuse.sparql +8 -0
  50. package/statics/ast/sparql-generated-compact/sparql-1-1/note-as-var-not-in-term-subquery.sparql +1 -0
  51. package/statics/ast/sparql-generated-compact/sparql-1-1/note-as-var-not-in-wildcard-subquery.sparql +1 -0
  52. package/statics/ast/sparql-generated-compact/sparql-1-1/note-expression-grouped-var.sparql +1 -0
  53. package/statics/ast/sparql-generated-compact/sparql-1-2/select-variable-reuse.sparql +1 -0
@@ -0,0 +1,164 @@
1
+ {
2
+ "context": [],
3
+ "subType": "select",
4
+ "where": {
5
+ "type": "pattern",
6
+ "subType": "group",
7
+ "patterns": [
8
+ {
9
+ "type": "query",
10
+ "subType": "select",
11
+ "where": {
12
+ "type": "pattern",
13
+ "subType": "group",
14
+ "patterns": [
15
+ {
16
+ "type": "pattern",
17
+ "subType": "bgp",
18
+ "triples": [
19
+ {
20
+ "type": "triple",
21
+ "subject": {
22
+ "type": "term",
23
+ "subType": "variable",
24
+ "value": "s",
25
+ "loc": {
26
+ "sourceLocationType": "source",
27
+ "start": 42,
28
+ "end": 44
29
+ }
30
+ },
31
+ "predicate": {
32
+ "type": "term",
33
+ "subType": "variable",
34
+ "value": "p",
35
+ "loc": {
36
+ "sourceLocationType": "source",
37
+ "start": 45,
38
+ "end": 47
39
+ }
40
+ },
41
+ "object": {
42
+ "type": "term",
43
+ "subType": "variable",
44
+ "value": "o",
45
+ "loc": {
46
+ "sourceLocationType": "source",
47
+ "start": 48,
48
+ "end": 50
49
+ }
50
+ },
51
+ "loc": {
52
+ "sourceLocationType": "source",
53
+ "start": 42,
54
+ "end": 50
55
+ }
56
+ }
57
+ ],
58
+ "loc": {
59
+ "sourceLocationType": "source",
60
+ "start": 42,
61
+ "end": 50
62
+ }
63
+ }
64
+ ],
65
+ "loc": {
66
+ "sourceLocationType": "source",
67
+ "start": 40,
68
+ "end": 52
69
+ }
70
+ },
71
+ "datasets": {
72
+ "type": "datasetClauses",
73
+ "clauses": [],
74
+ "loc": {
75
+ "sourceLocationType": "noMaterialize"
76
+ }
77
+ },
78
+ "context": [],
79
+ "solutionModifiers": {},
80
+ "variables": [
81
+ {
82
+ "type": "wildcard",
83
+ "loc": {
84
+ "sourceLocationType": "source",
85
+ "start": 32,
86
+ "end": 33
87
+ }
88
+ }
89
+ ],
90
+ "loc": {
91
+ "sourceLocationType": "source",
92
+ "start": 25,
93
+ "end": 52
94
+ }
95
+ }
96
+ ],
97
+ "loc": {
98
+ "sourceLocationType": "source",
99
+ "start": 23,
100
+ "end": 54
101
+ }
102
+ },
103
+ "solutionModifiers": {},
104
+ "datasets": {
105
+ "type": "datasetClauses",
106
+ "clauses": [],
107
+ "loc": {
108
+ "sourceLocationType": "noMaterialize"
109
+ }
110
+ },
111
+ "variables": [
112
+ {
113
+ "type": "pattern",
114
+ "subType": "bind",
115
+ "expression": {
116
+ "type": "term",
117
+ "subType": "literal",
118
+ "value": "1",
119
+ "langOrIri": {
120
+ "type": "term",
121
+ "subType": "namedNode",
122
+ "value": "http://www.w3.org/2001/XMLSchema#integer",
123
+ "loc": {
124
+ "sourceLocationType": "noMaterialize"
125
+ }
126
+ },
127
+ "loc": {
128
+ "sourceLocationType": "source",
129
+ "start": 8,
130
+ "end": 9
131
+ }
132
+ },
133
+ "variable": {
134
+ "type": "term",
135
+ "subType": "variable",
136
+ "value": "x",
137
+ "loc": {
138
+ "sourceLocationType": "source",
139
+ "start": 13,
140
+ "end": 15
141
+ }
142
+ },
143
+ "loc": {
144
+ "sourceLocationType": "source",
145
+ "start": 7,
146
+ "end": 16
147
+ }
148
+ }
149
+ ],
150
+ "loc": {
151
+ "sourceLocationType": "inlinedSource",
152
+ "newSource": "SELECT (1 AS ?x) WHERE { SELECT * WHERE { ?s ?p ?o } }\n",
153
+ "start": 0,
154
+ "end": 9007199254740991,
155
+ "loc": {
156
+ "sourceLocationType": "source",
157
+ "start": 0,
158
+ "end": 54
159
+ },
160
+ "startOnNew": 0,
161
+ "endOnNew": 54
162
+ },
163
+ "type": "query"
164
+ }
@@ -0,0 +1,169 @@
1
+ {
2
+ "context": [],
3
+ "subType": "select",
4
+ "where": {
5
+ "type": "pattern",
6
+ "subType": "group",
7
+ "patterns": [
8
+ {
9
+ "type": "pattern",
10
+ "subType": "bgp",
11
+ "triples": [
12
+ {
13
+ "type": "triple",
14
+ "subject": {
15
+ "type": "term",
16
+ "subType": "variable",
17
+ "value": "s",
18
+ "loc": {
19
+ "sourceLocationType": "source",
20
+ "start": 35,
21
+ "end": 37
22
+ }
23
+ },
24
+ "predicate": {
25
+ "type": "term",
26
+ "subType": "variable",
27
+ "value": "p",
28
+ "loc": {
29
+ "sourceLocationType": "source",
30
+ "start": 38,
31
+ "end": 40
32
+ }
33
+ },
34
+ "object": {
35
+ "type": "term",
36
+ "subType": "variable",
37
+ "value": "x",
38
+ "loc": {
39
+ "sourceLocationType": "source",
40
+ "start": 41,
41
+ "end": 43
42
+ }
43
+ },
44
+ "loc": {
45
+ "sourceLocationType": "source",
46
+ "start": 35,
47
+ "end": 43
48
+ }
49
+ }
50
+ ],
51
+ "loc": {
52
+ "sourceLocationType": "source",
53
+ "start": 35,
54
+ "end": 43
55
+ }
56
+ }
57
+ ],
58
+ "loc": {
59
+ "sourceLocationType": "source",
60
+ "start": 33,
61
+ "end": 45
62
+ }
63
+ },
64
+ "solutionModifiers": {
65
+ "group": {
66
+ "type": "solutionModifier",
67
+ "subType": "group",
68
+ "groupings": [
69
+ {
70
+ "type": "term",
71
+ "subType": "variable",
72
+ "value": "x",
73
+ "loc": {
74
+ "sourceLocationType": "source",
75
+ "start": 55,
76
+ "end": 57
77
+ }
78
+ }
79
+ ],
80
+ "loc": {
81
+ "sourceLocationType": "source",
82
+ "start": 46,
83
+ "end": 57
84
+ }
85
+ }
86
+ },
87
+ "datasets": {
88
+ "type": "datasetClauses",
89
+ "clauses": [],
90
+ "loc": {
91
+ "sourceLocationType": "noMaterialize"
92
+ }
93
+ },
94
+ "variables": [
95
+ {
96
+ "type": "pattern",
97
+ "subType": "bind",
98
+ "expression": {
99
+ "type": "expression",
100
+ "subType": "operation",
101
+ "operator": "+",
102
+ "args": [
103
+ {
104
+ "type": "term",
105
+ "subType": "variable",
106
+ "value": "x",
107
+ "loc": {
108
+ "sourceLocationType": "source",
109
+ "start": 8,
110
+ "end": 10
111
+ }
112
+ },
113
+ {
114
+ "type": "term",
115
+ "subType": "literal",
116
+ "value": "1",
117
+ "langOrIri": {
118
+ "type": "term",
119
+ "subType": "namedNode",
120
+ "value": "http://www.w3.org/2001/XMLSchema#integer",
121
+ "loc": {
122
+ "sourceLocationType": "noMaterialize"
123
+ }
124
+ },
125
+ "loc": {
126
+ "sourceLocationType": "source",
127
+ "start": 13,
128
+ "end": 14
129
+ }
130
+ }
131
+ ],
132
+ "loc": {
133
+ "sourceLocationType": "source",
134
+ "start": 8,
135
+ "end": 14
136
+ }
137
+ },
138
+ "variable": {
139
+ "type": "term",
140
+ "subType": "variable",
141
+ "value": "result",
142
+ "loc": {
143
+ "sourceLocationType": "source",
144
+ "start": 18,
145
+ "end": 25
146
+ }
147
+ },
148
+ "loc": {
149
+ "sourceLocationType": "source",
150
+ "start": 7,
151
+ "end": 26
152
+ }
153
+ }
154
+ ],
155
+ "loc": {
156
+ "sourceLocationType": "inlinedSource",
157
+ "newSource": "SELECT (?x + 1 AS ?result) WHERE { ?s ?p ?x } GROUP BY ?x\n",
158
+ "start": 0,
159
+ "end": 9007199254740991,
160
+ "loc": {
161
+ "sourceLocationType": "source",
162
+ "start": 0,
163
+ "end": 57
164
+ },
165
+ "startOnNew": 0,
166
+ "endOnNew": 57
167
+ },
168
+ "type": "query"
169
+ }
@@ -0,0 +1,243 @@
1
+ {
2
+ "context": [],
3
+ "subType": "select",
4
+ "where": {
5
+ "type": "pattern",
6
+ "subType": "group",
7
+ "patterns": [
8
+ {
9
+ "type": "pattern",
10
+ "subType": "values",
11
+ "variables": [
12
+ {
13
+ "type": "term",
14
+ "subType": "variable",
15
+ "value": "v",
16
+ "loc": {
17
+ "sourceLocationType": "source",
18
+ "start": 76,
19
+ "end": 78
20
+ }
21
+ }
22
+ ],
23
+ "values": [
24
+ {
25
+ "v": {
26
+ "type": "term",
27
+ "subType": "literal",
28
+ "value": "0",
29
+ "langOrIri": {
30
+ "type": "term",
31
+ "subType": "namedNode",
32
+ "value": "http://www.w3.org/2001/XMLSchema#integer",
33
+ "loc": {
34
+ "sourceLocationType": "noMaterialize"
35
+ }
36
+ },
37
+ "loc": {
38
+ "sourceLocationType": "source",
39
+ "start": 81,
40
+ "end": 82
41
+ }
42
+ }
43
+ },
44
+ {
45
+ "v": {
46
+ "type": "term",
47
+ "subType": "literal",
48
+ "value": "1",
49
+ "langOrIri": {
50
+ "type": "term",
51
+ "subType": "namedNode",
52
+ "value": "http://www.w3.org/2001/XMLSchema#integer",
53
+ "loc": {
54
+ "sourceLocationType": "noMaterialize"
55
+ }
56
+ },
57
+ "loc": {
58
+ "sourceLocationType": "source",
59
+ "start": 83,
60
+ "end": 84
61
+ }
62
+ }
63
+ },
64
+ {
65
+ "v": {
66
+ "type": "term",
67
+ "subType": "literal",
68
+ "value": "2",
69
+ "langOrIri": {
70
+ "type": "term",
71
+ "subType": "namedNode",
72
+ "value": "http://www.w3.org/2001/XMLSchema#integer",
73
+ "loc": {
74
+ "sourceLocationType": "noMaterialize"
75
+ }
76
+ },
77
+ "loc": {
78
+ "sourceLocationType": "source",
79
+ "start": 85,
80
+ "end": 86
81
+ }
82
+ }
83
+ },
84
+ {
85
+ "v": {
86
+ "type": "term",
87
+ "subType": "literal",
88
+ "value": "3",
89
+ "langOrIri": {
90
+ "type": "term",
91
+ "subType": "namedNode",
92
+ "value": "http://www.w3.org/2001/XMLSchema#integer",
93
+ "loc": {
94
+ "sourceLocationType": "noMaterialize"
95
+ }
96
+ },
97
+ "loc": {
98
+ "sourceLocationType": "source",
99
+ "start": 87,
100
+ "end": 88
101
+ }
102
+ }
103
+ }
104
+ ],
105
+ "loc": {
106
+ "sourceLocationType": "source",
107
+ "start": 69,
108
+ "end": 90
109
+ }
110
+ }
111
+ ],
112
+ "loc": {
113
+ "sourceLocationType": "source",
114
+ "start": 65,
115
+ "end": 92
116
+ }
117
+ },
118
+ "solutionModifiers": {},
119
+ "datasets": {
120
+ "type": "datasetClauses",
121
+ "clauses": [],
122
+ "loc": {
123
+ "sourceLocationType": "noMaterialize"
124
+ }
125
+ },
126
+ "variables": [
127
+ {
128
+ "type": "pattern",
129
+ "subType": "bind",
130
+ "expression": {
131
+ "type": "expression",
132
+ "subType": "aggregate",
133
+ "aggregation": "count",
134
+ "distinct": false,
135
+ "loc": {
136
+ "sourceLocationType": "source",
137
+ "start": 8,
138
+ "end": 17
139
+ },
140
+ "expression": [
141
+ {
142
+ "type": "term",
143
+ "subType": "variable",
144
+ "value": "v",
145
+ "loc": {
146
+ "sourceLocationType": "source",
147
+ "start": 14,
148
+ "end": 16
149
+ }
150
+ }
151
+ ]
152
+ },
153
+ "variable": {
154
+ "type": "term",
155
+ "subType": "variable",
156
+ "value": "count",
157
+ "loc": {
158
+ "sourceLocationType": "source",
159
+ "start": 21,
160
+ "end": 27
161
+ }
162
+ },
163
+ "loc": {
164
+ "sourceLocationType": "source",
165
+ "start": 7,
166
+ "end": 28
167
+ }
168
+ },
169
+ {
170
+ "type": "pattern",
171
+ "subType": "bind",
172
+ "expression": {
173
+ "type": "expression",
174
+ "subType": "operation",
175
+ "operator": "+",
176
+ "args": [
177
+ {
178
+ "type": "term",
179
+ "subType": "variable",
180
+ "value": "count",
181
+ "loc": {
182
+ "sourceLocationType": "source",
183
+ "start": 30,
184
+ "end": 36
185
+ }
186
+ },
187
+ {
188
+ "type": "term",
189
+ "subType": "literal",
190
+ "value": "1",
191
+ "langOrIri": {
192
+ "type": "term",
193
+ "subType": "namedNode",
194
+ "value": "http://www.w3.org/2001/XMLSchema#integer",
195
+ "loc": {
196
+ "sourceLocationType": "noMaterialize"
197
+ }
198
+ },
199
+ "loc": {
200
+ "sourceLocationType": "source",
201
+ "start": 39,
202
+ "end": 40
203
+ }
204
+ }
205
+ ],
206
+ "loc": {
207
+ "sourceLocationType": "source",
208
+ "start": 30,
209
+ "end": 40
210
+ }
211
+ },
212
+ "variable": {
213
+ "type": "term",
214
+ "subType": "variable",
215
+ "value": "countPlusOne",
216
+ "loc": {
217
+ "sourceLocationType": "source",
218
+ "start": 44,
219
+ "end": 57
220
+ }
221
+ },
222
+ "loc": {
223
+ "sourceLocationType": "source",
224
+ "start": 29,
225
+ "end": 58
226
+ }
227
+ }
228
+ ],
229
+ "loc": {
230
+ "sourceLocationType": "inlinedSource",
231
+ "newSource": "SELECT (COUNT(?v) AS ?count) (?count + 1 AS ?countPlusOne) WHERE {\n VALUES ?v { 0 1 2 3 }\n}",
232
+ "start": 0,
233
+ "end": 9007199254740991,
234
+ "loc": {
235
+ "sourceLocationType": "source",
236
+ "start": 0,
237
+ "end": 92
238
+ },
239
+ "startOnNew": 0,
240
+ "endOnNew": 92
241
+ },
242
+ "type": "query"
243
+ }
@@ -0,0 +1 @@
1
+ SELECT (1 AS ?x) WHERE { SELECT ?y WHERE { ?y ?p ?o } }
@@ -0,0 +1 @@
1
+ SELECT (1 AS ?x) WHERE { SELECT * WHERE { ?s ?p ?o } }
@@ -0,0 +1 @@
1
+ SELECT (?x + 1 AS ?result) WHERE { ?s ?p ?x } GROUP BY ?x
@@ -0,0 +1 @@
1
+ SELECT (COUNT(?y) AS ?cnt) (?y + 1 AS ?result) WHERE { ?s ?p ?y }
@@ -0,0 +1 @@
1
+ SELECT * WHERE { ?s ?p ?o } GROUP BY ?s
@@ -0,0 +1 @@
1
+ SELECT (?y + 1 AS ?result) WHERE { ?s ?p ?y } GROUP BY ?s
@@ -0,0 +1,3 @@
1
+ SELECT (COUNT(?v) AS ?count) (?count + 1 AS ?countPlusOne) WHERE {
2
+ VALUES ?v { 0 1 2 3 }
3
+ }
@@ -0,0 +1,5 @@
1
+ SELECT ( "1"^^<http://www.w3.org/2001/XMLSchema#integer> AS ?x ) WHERE {
2
+ SELECT ?y WHERE {
3
+ ?y ?p ?o .
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ SELECT ( "1"^^<http://www.w3.org/2001/XMLSchema#integer> AS ?x ) WHERE {
2
+ SELECT * WHERE {
3
+ ?s ?p ?o .
4
+ }
5
+ }
@@ -0,0 +1,4 @@
1
+ SELECT ( ( ?x + "1"^^<http://www.w3.org/2001/XMLSchema#integer> ) AS ?result ) WHERE {
2
+ ?s ?p ?x .
3
+ }
4
+ GROUP BY ?x
@@ -0,0 +1,8 @@
1
+ SELECT ( COUNT( ?v ) AS ?count ) ( ( ?count + "1"^^<http://www.w3.org/2001/XMLSchema#integer> ) AS ?countPlusOne ) WHERE {
2
+ VALUES ?v {
3
+ "0"^^<http://www.w3.org/2001/XMLSchema#integer>
4
+ "1"^^<http://www.w3.org/2001/XMLSchema#integer>
5
+ "2"^^<http://www.w3.org/2001/XMLSchema#integer>
6
+ "3"^^<http://www.w3.org/2001/XMLSchema#integer>
7
+ }
8
+ }
@@ -0,0 +1 @@
1
+ SELECT ( "1"^^<http://www.w3.org/2001/XMLSchema#integer> AS ?x ) WHERE { SELECT ?y WHERE { ?y ?p ?o . } }
@@ -0,0 +1 @@
1
+ SELECT ( "1"^^<http://www.w3.org/2001/XMLSchema#integer> AS ?x ) WHERE { SELECT * WHERE { ?s ?p ?o . } }
@@ -0,0 +1 @@
1
+ SELECT ( ( ?x + "1"^^<http://www.w3.org/2001/XMLSchema#integer> ) AS ?result ) WHERE { ?s ?p ?x . } GROUP BY ?x
@@ -0,0 +1 @@
1
+ SELECT ( COUNT( ?v ) AS ?count ) ( ( ?count + "1"^^<http://www.w3.org/2001/XMLSchema#integer> ) AS ?countPlusOne ) WHERE { VALUES ?v { "0"^^<http://www.w3.org/2001/XMLSchema#integer> "1"^^<http://www.w3.org/2001/XMLSchema#integer> "2"^^<http://www.w3.org/2001/XMLSchema#integer> "3"^^<http://www.w3.org/2001/XMLSchema#integer> } }