@traqula/generator-sparql-1-2 0.0.4 → 0.0.5
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.
- package/README.md +2 -0
- package/lib/index.cjs +491 -428
- package/lib/index.d.ts +221 -2
- package/lib/index.js +7 -18
- package/lib/index.js.map +1 -1
- package/package.json +9 -9
package/lib/index.cjs
CHANGED
|
@@ -155,92 +155,8 @@ var CoreFactory = class {
|
|
|
155
155
|
var DynamicGenerator = class {
|
|
156
156
|
constructor(rules) {
|
|
157
157
|
this.rules = rules;
|
|
158
|
-
this.factory = new CoreFactory();
|
|
159
|
-
this.__context = void 0;
|
|
160
|
-
this.origSource = "";
|
|
161
|
-
this.generatedUntil = 0;
|
|
162
|
-
this.stringBuilder = [];
|
|
163
|
-
this.subrule = (cstDef, ast, ...arg) => {
|
|
164
|
-
const def = this.rules[cstDef.name];
|
|
165
|
-
if (!def) {
|
|
166
|
-
throw new Error(`Rule ${cstDef.name} not found`);
|
|
167
|
-
}
|
|
168
|
-
const generate = () => def.gImpl({
|
|
169
|
-
SUBRULE: this.subrule,
|
|
170
|
-
PRINT: this.print,
|
|
171
|
-
PRINT_SPACE_LEFT: this.printSpaceLeft,
|
|
172
|
-
PRINT_WORD: this.printWord,
|
|
173
|
-
PRINT_WORDS: this.printWords,
|
|
174
|
-
CATCHUP: this.catchup,
|
|
175
|
-
HANDLE_LOC: this.handleLoc
|
|
176
|
-
})(ast, this.getSafeContext(), ...arg);
|
|
177
|
-
if (this.factory.isLocalized(ast)) {
|
|
178
|
-
this.handleLoc(ast, generate);
|
|
179
|
-
} else {
|
|
180
|
-
generate();
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
this.handleLoc = (localized, handle) => {
|
|
184
|
-
if (this.factory.isSourceLocationNoMaterialize(localized.loc)) {
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
if (this.factory.isSourceLocationStringReplace(localized.loc)) {
|
|
188
|
-
this.catchup(localized.loc.start);
|
|
189
|
-
this.print(localized.loc.newSource);
|
|
190
|
-
this.generatedUntil = localized.loc.end;
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
if (this.factory.isSourceLocationNodeReplace(localized.loc)) {
|
|
194
|
-
this.catchup(localized.loc.start);
|
|
195
|
-
this.generatedUntil = localized.loc.end;
|
|
196
|
-
}
|
|
197
|
-
if (this.factory.isSourceLocationSource(localized.loc)) {
|
|
198
|
-
this.catchup(localized.loc.start);
|
|
199
|
-
}
|
|
200
|
-
const ret = handle();
|
|
201
|
-
if (this.factory.isSourceLocationSource(localized.loc)) {
|
|
202
|
-
this.catchup(localized.loc.end);
|
|
203
|
-
}
|
|
204
|
-
return ret;
|
|
205
|
-
};
|
|
206
|
-
this.catchup = (until) => {
|
|
207
|
-
const start = this.generatedUntil;
|
|
208
|
-
if (start < until) {
|
|
209
|
-
this.print(this.origSource.slice(start, until));
|
|
210
|
-
}
|
|
211
|
-
this.generatedUntil = Math.max(this.generatedUntil, until);
|
|
212
|
-
};
|
|
213
|
-
this.print = (...args) => {
|
|
214
|
-
const pureArgs = args.filter((x) => x.length > 0);
|
|
215
|
-
if (pureArgs.length > 0) {
|
|
216
|
-
const [head2, ...tail] = pureArgs;
|
|
217
|
-
if (this.expectsSpace) {
|
|
218
|
-
this.expectsSpace = false;
|
|
219
|
-
const blanks = /* @__PURE__ */ new Set(["\n", " ", " "]);
|
|
220
|
-
if (this.stringBuilder.length > 0 && !(blanks.has(head2[0]) || blanks.has(this.stringBuilder.at(-1).at(-1)))) {
|
|
221
|
-
this.stringBuilder.push(" ");
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
this.stringBuilder.push(head2);
|
|
225
|
-
this.stringBuilder.push(...tail);
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
this.printWord = (...args) => {
|
|
229
|
-
this.expectsSpace = true;
|
|
230
|
-
this.print(...args);
|
|
231
|
-
this.expectsSpace = true;
|
|
232
|
-
};
|
|
233
|
-
this.printSpaceLeft = (...args) => {
|
|
234
|
-
this.expectsSpace = true;
|
|
235
|
-
this.print(...args);
|
|
236
|
-
};
|
|
237
|
-
this.printWords = (...args) => {
|
|
238
|
-
for (const arg of args) {
|
|
239
|
-
this.printWord(arg);
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
158
|
for (const rule of Object.values(rules)) {
|
|
243
|
-
this[rule.name] = (input, context, args) => {
|
|
159
|
+
this[rule.name] = ((input, context, args) => {
|
|
244
160
|
this.expectsSpace = false;
|
|
245
161
|
this.stringBuilder.length = 0;
|
|
246
162
|
this.origSource = context.origSource;
|
|
@@ -249,15 +165,100 @@ var DynamicGenerator = class {
|
|
|
249
165
|
this.subrule(rule, input, args);
|
|
250
166
|
this.catchup(this.origSource.length);
|
|
251
167
|
return this.stringBuilder.join("");
|
|
252
|
-
};
|
|
168
|
+
});
|
|
253
169
|
}
|
|
254
170
|
}
|
|
171
|
+
factory = new CoreFactory();
|
|
172
|
+
__context = void 0;
|
|
173
|
+
origSource = "";
|
|
174
|
+
generatedUntil = 0;
|
|
175
|
+
expectsSpace;
|
|
176
|
+
stringBuilder = [];
|
|
255
177
|
setContext(context) {
|
|
256
178
|
this.__context = context;
|
|
257
179
|
}
|
|
258
180
|
getSafeContext() {
|
|
259
181
|
return this.__context;
|
|
260
182
|
}
|
|
183
|
+
subrule = (cstDef, ast, ...arg) => {
|
|
184
|
+
const def = this.rules[cstDef.name];
|
|
185
|
+
if (!def) {
|
|
186
|
+
throw new Error(`Rule ${cstDef.name} not found`);
|
|
187
|
+
}
|
|
188
|
+
const generate = () => def.gImpl({
|
|
189
|
+
SUBRULE: this.subrule,
|
|
190
|
+
PRINT: this.print,
|
|
191
|
+
PRINT_SPACE_LEFT: this.printSpaceLeft,
|
|
192
|
+
PRINT_WORD: this.printWord,
|
|
193
|
+
PRINT_WORDS: this.printWords,
|
|
194
|
+
CATCHUP: this.catchup,
|
|
195
|
+
HANDLE_LOC: this.handleLoc
|
|
196
|
+
})(ast, this.getSafeContext(), ...arg);
|
|
197
|
+
if (this.factory.isLocalized(ast)) {
|
|
198
|
+
this.handleLoc(ast, generate);
|
|
199
|
+
} else {
|
|
200
|
+
generate();
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
handleLoc = (localized, handle) => {
|
|
204
|
+
if (this.factory.isSourceLocationNoMaterialize(localized.loc)) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (this.factory.isSourceLocationStringReplace(localized.loc)) {
|
|
208
|
+
this.catchup(localized.loc.start);
|
|
209
|
+
this.print(localized.loc.newSource);
|
|
210
|
+
this.generatedUntil = localized.loc.end;
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (this.factory.isSourceLocationNodeReplace(localized.loc)) {
|
|
214
|
+
this.catchup(localized.loc.start);
|
|
215
|
+
this.generatedUntil = localized.loc.end;
|
|
216
|
+
}
|
|
217
|
+
if (this.factory.isSourceLocationSource(localized.loc)) {
|
|
218
|
+
this.catchup(localized.loc.start);
|
|
219
|
+
}
|
|
220
|
+
const ret = handle();
|
|
221
|
+
if (this.factory.isSourceLocationSource(localized.loc)) {
|
|
222
|
+
this.catchup(localized.loc.end);
|
|
223
|
+
}
|
|
224
|
+
return ret;
|
|
225
|
+
};
|
|
226
|
+
catchup = (until) => {
|
|
227
|
+
const start = this.generatedUntil;
|
|
228
|
+
if (start < until) {
|
|
229
|
+
this.print(this.origSource.slice(start, until));
|
|
230
|
+
}
|
|
231
|
+
this.generatedUntil = Math.max(this.generatedUntil, until);
|
|
232
|
+
};
|
|
233
|
+
print = (...args) => {
|
|
234
|
+
const pureArgs = args.filter((x) => x.length > 0);
|
|
235
|
+
if (pureArgs.length > 0) {
|
|
236
|
+
const [head2, ...tail] = pureArgs;
|
|
237
|
+
if (this.expectsSpace) {
|
|
238
|
+
this.expectsSpace = false;
|
|
239
|
+
const blanks = /* @__PURE__ */ new Set(["\n", " ", " "]);
|
|
240
|
+
if (this.stringBuilder.length > 0 && !(blanks.has(head2[0]) || blanks.has(this.stringBuilder.at(-1).at(-1)))) {
|
|
241
|
+
this.stringBuilder.push(" ");
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
this.stringBuilder.push(head2);
|
|
245
|
+
this.stringBuilder.push(...tail);
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
printWord = (...args) => {
|
|
249
|
+
this.expectsSpace = true;
|
|
250
|
+
this.print(...args);
|
|
251
|
+
this.expectsSpace = true;
|
|
252
|
+
};
|
|
253
|
+
printSpaceLeft = (...args) => {
|
|
254
|
+
this.expectsSpace = true;
|
|
255
|
+
this.print(...args);
|
|
256
|
+
};
|
|
257
|
+
printWords = (...args) => {
|
|
258
|
+
for (const arg of args) {
|
|
259
|
+
this.printWord(arg);
|
|
260
|
+
}
|
|
261
|
+
};
|
|
261
262
|
};
|
|
262
263
|
|
|
263
264
|
// ../../packages/core/lib/generator-builder/generatorBuilder.ts
|
|
@@ -275,6 +276,7 @@ var GeneratorBuilder = class _GeneratorBuilder {
|
|
|
275
276
|
}
|
|
276
277
|
return new _GeneratorBuilder(listToRuleDefMap(start));
|
|
277
278
|
}
|
|
279
|
+
rules;
|
|
278
280
|
constructor(startRules) {
|
|
279
281
|
this.rules = startRules;
|
|
280
282
|
}
|
|
@@ -557,10 +559,10 @@ var coreJsData = root_default["__core-js_shared__"];
|
|
|
557
559
|
var coreJsData_default = coreJsData;
|
|
558
560
|
|
|
559
561
|
// ../../node_modules/lodash-es/_isMasked.js
|
|
560
|
-
var maskSrcKey = function() {
|
|
562
|
+
var maskSrcKey = (function() {
|
|
561
563
|
var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || "");
|
|
562
564
|
return uid ? "Symbol(src)_1." + uid : "";
|
|
563
|
-
}();
|
|
565
|
+
})();
|
|
564
566
|
function isMasked(func) {
|
|
565
567
|
return !!maskSrcKey && maskSrcKey in func;
|
|
566
568
|
}
|
|
@@ -622,7 +624,7 @@ var WeakMap_default = WeakMap;
|
|
|
622
624
|
|
|
623
625
|
// ../../node_modules/lodash-es/_baseCreate.js
|
|
624
626
|
var objectCreate = Object.create;
|
|
625
|
-
var baseCreate = /* @__PURE__ */ function() {
|
|
627
|
+
var baseCreate = /* @__PURE__ */ (function() {
|
|
626
628
|
function object3() {
|
|
627
629
|
}
|
|
628
630
|
return function(proto) {
|
|
@@ -637,7 +639,7 @@ var baseCreate = /* @__PURE__ */ function() {
|
|
|
637
639
|
object3.prototype = void 0;
|
|
638
640
|
return result;
|
|
639
641
|
};
|
|
640
|
-
}();
|
|
642
|
+
})();
|
|
641
643
|
var baseCreate_default = baseCreate;
|
|
642
644
|
|
|
643
645
|
// ../../node_modules/lodash-es/_apply.js
|
|
@@ -702,14 +704,14 @@ function constant(value) {
|
|
|
702
704
|
var constant_default = constant;
|
|
703
705
|
|
|
704
706
|
// ../../node_modules/lodash-es/_defineProperty.js
|
|
705
|
-
var defineProperty = function() {
|
|
707
|
+
var defineProperty = (function() {
|
|
706
708
|
try {
|
|
707
709
|
var func = getNative_default(Object, "defineProperty");
|
|
708
710
|
func({}, "", {});
|
|
709
711
|
return func;
|
|
710
712
|
} catch (e) {
|
|
711
713
|
}
|
|
712
|
-
}();
|
|
714
|
+
})();
|
|
713
715
|
var defineProperty_default = defineProperty;
|
|
714
716
|
|
|
715
717
|
// ../../node_modules/lodash-es/_baseSetToString.js
|
|
@@ -947,9 +949,9 @@ var baseIsArguments_default = baseIsArguments;
|
|
|
947
949
|
var objectProto6 = Object.prototype;
|
|
948
950
|
var hasOwnProperty4 = objectProto6.hasOwnProperty;
|
|
949
951
|
var propertyIsEnumerable = objectProto6.propertyIsEnumerable;
|
|
950
|
-
var isArguments = baseIsArguments_default(/* @__PURE__ */ function() {
|
|
952
|
+
var isArguments = baseIsArguments_default(/* @__PURE__ */ (function() {
|
|
951
953
|
return arguments;
|
|
952
|
-
}()) ? baseIsArguments_default : function(value) {
|
|
954
|
+
})()) ? baseIsArguments_default : function(value) {
|
|
953
955
|
return isObjectLike_default(value) && hasOwnProperty4.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
|
|
954
956
|
};
|
|
955
957
|
var isArguments_default = isArguments;
|
|
@@ -1015,7 +1017,7 @@ var freeExports2 = typeof exports == "object" && exports && !exports.nodeType &&
|
|
|
1015
1017
|
var freeModule2 = freeExports2 && typeof module == "object" && module && !module.nodeType && module;
|
|
1016
1018
|
var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
|
|
1017
1019
|
var freeProcess = moduleExports2 && freeGlobal_default.process;
|
|
1018
|
-
var nodeUtil = function() {
|
|
1020
|
+
var nodeUtil = (function() {
|
|
1019
1021
|
try {
|
|
1020
1022
|
var types = freeModule2 && freeModule2.require && freeModule2.require("util").types;
|
|
1021
1023
|
if (types) {
|
|
@@ -1024,7 +1026,7 @@ var nodeUtil = function() {
|
|
|
1024
1026
|
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
1025
1027
|
} catch (e) {
|
|
1026
1028
|
}
|
|
1027
|
-
}();
|
|
1029
|
+
})();
|
|
1028
1030
|
var nodeUtil_default = nodeUtil;
|
|
1029
1031
|
|
|
1030
1032
|
// ../../node_modules/lodash-es/isTypedArray.js
|
|
@@ -9569,6 +9571,7 @@ applyMixins(Parser, [
|
|
|
9569
9571
|
|
|
9570
9572
|
// ../../packages/core/lib/lexer-builder/LexerBuilder.ts
|
|
9571
9573
|
var LexerBuilder = class _LexerBuilder {
|
|
9574
|
+
tokens;
|
|
9572
9575
|
static create(starter) {
|
|
9573
9576
|
return new _LexerBuilder(starter);
|
|
9574
9577
|
}
|
|
@@ -9909,6 +9912,7 @@ __export(grammar_exports, {
|
|
|
9909
9912
|
quads: () => quads,
|
|
9910
9913
|
quadsNotTriples: () => quadsNotTriples,
|
|
9911
9914
|
query: () => query,
|
|
9915
|
+
queryOrUpdate: () => queryOrUpdate,
|
|
9912
9916
|
queryUnit: () => queryUnit,
|
|
9913
9917
|
rdfLiteral: () => rdfLiteral,
|
|
9914
9918
|
regexExpression: () => regexExpression,
|
|
@@ -9957,7 +9961,7 @@ __export(lexer_exports, {
|
|
|
9957
9961
|
ask: () => ask,
|
|
9958
9962
|
baseDecl: () => baseDecl,
|
|
9959
9963
|
bind: () => bind,
|
|
9960
|
-
builtIn: () =>
|
|
9964
|
+
builtIn: () => BuiltInCalls_exports,
|
|
9961
9965
|
by: () => by,
|
|
9962
9966
|
clear: () => clear,
|
|
9963
9967
|
construct: () => construct,
|
|
@@ -9994,7 +9998,7 @@ __export(lexer_exports, {
|
|
|
9994
9998
|
separator: () => separator,
|
|
9995
9999
|
service: () => service,
|
|
9996
10000
|
silent: () => silent,
|
|
9997
|
-
|
|
10001
|
+
sparql11LexerBuilder: () => sparql11LexerBuilder,
|
|
9998
10002
|
symbols: () => symbols_exports,
|
|
9999
10003
|
terminals: () => terminals_exports,
|
|
10000
10004
|
to: () => to,
|
|
@@ -10006,10 +10010,10 @@ __export(lexer_exports, {
|
|
|
10006
10010
|
where: () => where
|
|
10007
10011
|
});
|
|
10008
10012
|
|
|
10009
|
-
// ../../packages/rules-sparql-1-1/lib/lexer/
|
|
10010
|
-
var
|
|
10011
|
-
__export(
|
|
10012
|
-
|
|
10013
|
+
// ../../packages/rules-sparql-1-1/lib/lexer/BuiltInCalls.ts
|
|
10014
|
+
var BuiltInCalls_exports = {};
|
|
10015
|
+
__export(BuiltInCalls_exports, {
|
|
10016
|
+
BuiltInCalls: () => BuiltInCalls,
|
|
10013
10017
|
abs: () => abs,
|
|
10014
10018
|
allBuiltInCalls: () => allBuiltInCalls,
|
|
10015
10019
|
avg: () => avg,
|
|
@@ -10073,70 +10077,70 @@ __export(BuildinCalls_exports, {
|
|
|
10073
10077
|
uuid: () => uuid,
|
|
10074
10078
|
year: () => year
|
|
10075
10079
|
});
|
|
10076
|
-
var
|
|
10077
|
-
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
|
|
10083
|
-
|
|
10084
|
-
|
|
10085
|
-
|
|
10086
|
-
|
|
10087
|
-
|
|
10088
|
-
|
|
10089
|
-
|
|
10090
|
-
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
10098
|
-
|
|
10099
|
-
|
|
10100
|
-
|
|
10101
|
-
|
|
10102
|
-
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
|
|
10106
|
-
|
|
10107
|
-
|
|
10108
|
-
|
|
10109
|
-
|
|
10110
|
-
|
|
10111
|
-
|
|
10112
|
-
|
|
10113
|
-
|
|
10114
|
-
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
|
|
10122
|
-
|
|
10123
|
-
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
|
|
10131
|
-
|
|
10132
|
-
|
|
10133
|
-
|
|
10134
|
-
|
|
10135
|
-
|
|
10136
|
-
|
|
10137
|
-
|
|
10138
|
-
return
|
|
10139
|
-
})(
|
|
10080
|
+
var BuiltInCalls = /* @__PURE__ */ ((BuiltInCalls2) => {
|
|
10081
|
+
BuiltInCalls2["Str"] = "builtInStr";
|
|
10082
|
+
BuiltInCalls2["Lang"] = "builtInLang";
|
|
10083
|
+
BuiltInCalls2["Langmatches"] = "builtInLangmatches";
|
|
10084
|
+
BuiltInCalls2["Datatype"] = "builtInDatatype";
|
|
10085
|
+
BuiltInCalls2["Bound"] = "builtInBound";
|
|
10086
|
+
BuiltInCalls2["Iri"] = "builtInIri";
|
|
10087
|
+
BuiltInCalls2["Uri"] = "builtInUri";
|
|
10088
|
+
BuiltInCalls2["Bnode"] = "builtInBnode";
|
|
10089
|
+
BuiltInCalls2["Rand"] = "builtInRand";
|
|
10090
|
+
BuiltInCalls2["Abs"] = "builtInAbs";
|
|
10091
|
+
BuiltInCalls2["Ceil"] = "builtInCeil";
|
|
10092
|
+
BuiltInCalls2["Floor"] = "builtInFloor";
|
|
10093
|
+
BuiltInCalls2["Round"] = "builtInRound";
|
|
10094
|
+
BuiltInCalls2["Concat"] = "builtInConcat";
|
|
10095
|
+
BuiltInCalls2["Strlen"] = "builtInStrlen";
|
|
10096
|
+
BuiltInCalls2["Ucase"] = "builtInUcase";
|
|
10097
|
+
BuiltInCalls2["Lcase"] = "builtInLcase";
|
|
10098
|
+
BuiltInCalls2["Encode_for_uri"] = "builtInEncode_for_uri";
|
|
10099
|
+
BuiltInCalls2["Contains"] = "builtInContains";
|
|
10100
|
+
BuiltInCalls2["Strstarts"] = "builtInStrstarts";
|
|
10101
|
+
BuiltInCalls2["Strends"] = "builtInStrends";
|
|
10102
|
+
BuiltInCalls2["Strbefore"] = "builtInStrbefore";
|
|
10103
|
+
BuiltInCalls2["Strafter"] = "builtInStrafter";
|
|
10104
|
+
BuiltInCalls2["Year"] = "builtInYear";
|
|
10105
|
+
BuiltInCalls2["Month"] = "builtInMonth";
|
|
10106
|
+
BuiltInCalls2["Day"] = "builtInDay";
|
|
10107
|
+
BuiltInCalls2["Hours"] = "builtInHours";
|
|
10108
|
+
BuiltInCalls2["Minutes"] = "builtInMinutes";
|
|
10109
|
+
BuiltInCalls2["Seconds"] = "builtInSeconds";
|
|
10110
|
+
BuiltInCalls2["Timezone"] = "builtInTimezone";
|
|
10111
|
+
BuiltInCalls2["Tz"] = "builtInTz";
|
|
10112
|
+
BuiltInCalls2["Now"] = "builtInNow";
|
|
10113
|
+
BuiltInCalls2["Uuid"] = "builtInUuid";
|
|
10114
|
+
BuiltInCalls2["Struuid"] = "builtInStruuid";
|
|
10115
|
+
BuiltInCalls2["Md5"] = "builtInMd5";
|
|
10116
|
+
BuiltInCalls2["Sha1"] = "builtInSha1";
|
|
10117
|
+
BuiltInCalls2["Sha256"] = "builtInSha256";
|
|
10118
|
+
BuiltInCalls2["Sha384"] = "builtInSha384";
|
|
10119
|
+
BuiltInCalls2["Sha512"] = "builtInSha512";
|
|
10120
|
+
BuiltInCalls2["Coalesce"] = "builtInCoalesce";
|
|
10121
|
+
BuiltInCalls2["If"] = "builtInIf";
|
|
10122
|
+
BuiltInCalls2["Strlang"] = "builtInStrlang";
|
|
10123
|
+
BuiltInCalls2["Strdt"] = "builtInStrdt";
|
|
10124
|
+
BuiltInCalls2["Sameterm"] = "builtInSameterm";
|
|
10125
|
+
BuiltInCalls2["Isiri"] = "builtInIsiri";
|
|
10126
|
+
BuiltInCalls2["Isuri"] = "builtInIsuri";
|
|
10127
|
+
BuiltInCalls2["Isblank"] = "builtInIsblank";
|
|
10128
|
+
BuiltInCalls2["Isliteral"] = "builtInIsliteral";
|
|
10129
|
+
BuiltInCalls2["Isnumeric"] = "builtInIsnumeric";
|
|
10130
|
+
BuiltInCalls2["Regex"] = "builtInRegex";
|
|
10131
|
+
BuiltInCalls2["Substr"] = "builtInSubstr";
|
|
10132
|
+
BuiltInCalls2["Replace"] = "builtInReplace";
|
|
10133
|
+
BuiltInCalls2["Exists"] = "builtInExists";
|
|
10134
|
+
BuiltInCalls2["Notexists"] = "builtInNotexists";
|
|
10135
|
+
BuiltInCalls2["Count"] = "builtInCount";
|
|
10136
|
+
BuiltInCalls2["Sum"] = "builtInSum";
|
|
10137
|
+
BuiltInCalls2["Min"] = "builtInMin";
|
|
10138
|
+
BuiltInCalls2["Max"] = "builtInMax";
|
|
10139
|
+
BuiltInCalls2["Avg"] = "builtInAvg";
|
|
10140
|
+
BuiltInCalls2["Sample"] = "builtInSample";
|
|
10141
|
+
BuiltInCalls2["Group_concat"] = "builtInGroup_concat";
|
|
10142
|
+
return BuiltInCalls2;
|
|
10143
|
+
})(BuiltInCalls || {});
|
|
10140
10144
|
function capitalize(string2) {
|
|
10141
10145
|
return string2.charAt(0).toUpperCase() + string2.slice(1);
|
|
10142
10146
|
}
|
|
@@ -10640,7 +10644,7 @@ var allBaseTokens = LexerBuilder.create().add(
|
|
|
10640
10644
|
notIn,
|
|
10641
10645
|
separator
|
|
10642
10646
|
);
|
|
10643
|
-
var
|
|
10647
|
+
var sparql11LexerBuilder = LexerBuilder.create(allTerminals).merge(allBaseTokens).merge(allBuiltInCalls).merge(allGraphTokens).merge(allSymbols).moveBefore(datatype, dataClause).moveAfter(avg, a).moveBefore(a, graphAll).moveAfter(groupConcat, groupByGroup);
|
|
10644
10648
|
|
|
10645
10649
|
// ../../packages/rules-sparql-1-1/lib/factoryMixins/ContextFactory.ts
|
|
10646
10650
|
var nodeType = "contextDef";
|
|
@@ -11085,10 +11089,7 @@ function SolutionModifiersFactoryMixin(Base) {
|
|
|
11085
11089
|
var nodeType8 = "term";
|
|
11086
11090
|
function TermFactoryMixin(Base) {
|
|
11087
11091
|
return class TermFactory extends Base {
|
|
11088
|
-
|
|
11089
|
-
super(...arguments);
|
|
11090
|
-
this.__blankNodeCounter = 0;
|
|
11091
|
-
}
|
|
11092
|
+
__blankNodeCounter = 0;
|
|
11092
11093
|
resetBlankNodeCounter() {
|
|
11093
11094
|
this.__blankNodeCounter = 0;
|
|
11094
11095
|
}
|
|
@@ -11804,6 +11805,120 @@ var verbA = {
|
|
|
11804
11805
|
}
|
|
11805
11806
|
};
|
|
11806
11807
|
|
|
11808
|
+
// ../../packages/rules-sparql-1-1/lib/grammar/general.ts
|
|
11809
|
+
var prologue = {
|
|
11810
|
+
name: "prologue",
|
|
11811
|
+
impl: ({ SUBRULE, MANY, OR }) => () => {
|
|
11812
|
+
const result = [];
|
|
11813
|
+
MANY(() => OR([
|
|
11814
|
+
{ ALT: () => result.push(SUBRULE(baseDecl2)) },
|
|
11815
|
+
// TODO: the [spec](https://www.w3.org/TR/sparql11-query/#iriRefs) says you cannot redefine prefixes.
|
|
11816
|
+
// We might need to check this.
|
|
11817
|
+
{ ALT: () => result.push(SUBRULE(prefixDecl2)) }
|
|
11818
|
+
]));
|
|
11819
|
+
return result;
|
|
11820
|
+
},
|
|
11821
|
+
gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
|
|
11822
|
+
for (const context of ast) {
|
|
11823
|
+
if (F3.isContextDefinitionBase(context)) {
|
|
11824
|
+
SUBRULE(baseDecl2, context);
|
|
11825
|
+
} else if (F3.isContextDefinitionPrefix(context)) {
|
|
11826
|
+
SUBRULE(prefixDecl2, context);
|
|
11827
|
+
}
|
|
11828
|
+
}
|
|
11829
|
+
}
|
|
11830
|
+
};
|
|
11831
|
+
var baseDecl2 = {
|
|
11832
|
+
name: "baseDecl",
|
|
11833
|
+
impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
|
|
11834
|
+
const base = CONSUME(baseDecl);
|
|
11835
|
+
const val = SUBRULE(iriFull);
|
|
11836
|
+
return ACTION(() => C.factory.contextDefinitionBase(C.factory.sourceLocation(base, val), val));
|
|
11837
|
+
},
|
|
11838
|
+
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
|
|
11839
|
+
F3.printFilter(ast, () => PRINT_WORD("BASE"));
|
|
11840
|
+
SUBRULE(iri2, ast.value);
|
|
11841
|
+
}
|
|
11842
|
+
};
|
|
11843
|
+
var prefixDecl2 = {
|
|
11844
|
+
name: "prefixDecl",
|
|
11845
|
+
impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
|
|
11846
|
+
const prefix = CONSUME(prefixDecl);
|
|
11847
|
+
const name = CONSUME(terminals_exports.pNameNs).image.slice(0, -1);
|
|
11848
|
+
const value = SUBRULE(iriFull);
|
|
11849
|
+
return ACTION(() => C.factory.contextDefinitionPrefix(C.factory.sourceLocation(prefix, value), name, value));
|
|
11850
|
+
},
|
|
11851
|
+
gImpl: ({ SUBRULE, PRINT_WORDS }) => (ast, { factory: F3 }) => {
|
|
11852
|
+
F3.printFilter(ast, () => {
|
|
11853
|
+
PRINT_WORDS("PREFIX", `${ast.key}:`);
|
|
11854
|
+
});
|
|
11855
|
+
SUBRULE(iri2, ast.value);
|
|
11856
|
+
}
|
|
11857
|
+
};
|
|
11858
|
+
var verb = {
|
|
11859
|
+
name: "verb",
|
|
11860
|
+
impl: ({ SUBRULE, OR }) => () => OR([
|
|
11861
|
+
{ ALT: () => SUBRULE(varOrIri) },
|
|
11862
|
+
{ ALT: () => SUBRULE(verbA) }
|
|
11863
|
+
])
|
|
11864
|
+
};
|
|
11865
|
+
var varOrTerm = {
|
|
11866
|
+
name: "varOrTerm",
|
|
11867
|
+
impl: ({ SUBRULE, OR }) => (C) => OR([
|
|
11868
|
+
{ GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(var_) },
|
|
11869
|
+
{ ALT: () => SUBRULE(graphTerm) }
|
|
11870
|
+
]),
|
|
11871
|
+
gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
|
|
11872
|
+
if (F3.isTermVariable(ast)) {
|
|
11873
|
+
return SUBRULE(var_, ast);
|
|
11874
|
+
}
|
|
11875
|
+
return SUBRULE(graphTerm, ast);
|
|
11876
|
+
}
|
|
11877
|
+
};
|
|
11878
|
+
var varOrIri = {
|
|
11879
|
+
name: "varOrIri",
|
|
11880
|
+
impl: ({ SUBRULE, OR }) => (C) => OR([
|
|
11881
|
+
{ GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(var_) },
|
|
11882
|
+
{ ALT: () => SUBRULE(iri2) }
|
|
11883
|
+
])
|
|
11884
|
+
};
|
|
11885
|
+
var var_ = {
|
|
11886
|
+
name: "var",
|
|
11887
|
+
impl: ({ ACTION, CONSUME, OR }) => (C) => {
|
|
11888
|
+
const varToken = OR([
|
|
11889
|
+
{ ALT: () => CONSUME(terminals_exports.var1) },
|
|
11890
|
+
{ ALT: () => CONSUME(terminals_exports.var2) }
|
|
11891
|
+
]);
|
|
11892
|
+
return ACTION(() => C.factory.variable(varToken.image.slice(1), C.factory.sourceLocation(varToken)));
|
|
11893
|
+
},
|
|
11894
|
+
gImpl: ({ PRINT_WORD }) => (ast, { factory: F3 }) => {
|
|
11895
|
+
F3.printFilter(ast, () => PRINT_WORD(`?${ast.value}`));
|
|
11896
|
+
}
|
|
11897
|
+
};
|
|
11898
|
+
var graphTerm = {
|
|
11899
|
+
name: "graphTerm",
|
|
11900
|
+
impl: ({ ACTION, SUBRULE, CONSUME, OR }) => (C) => OR([
|
|
11901
|
+
{ ALT: () => SUBRULE(iri2) },
|
|
11902
|
+
{ ALT: () => SUBRULE(rdfLiteral) },
|
|
11903
|
+
{ ALT: () => SUBRULE(numericLiteral) },
|
|
11904
|
+
{ ALT: () => SUBRULE(booleanLiteral) },
|
|
11905
|
+
{ GATE: () => C.parseMode.has("canCreateBlankNodes"), ALT: () => SUBRULE(blankNode) },
|
|
11906
|
+
{ ALT: () => {
|
|
11907
|
+
const tokenNil = CONSUME(terminals_exports.nil);
|
|
11908
|
+
return ACTION(() => C.factory.namedNode(C.factory.sourceLocation(tokenNil), "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" /* NIL */));
|
|
11909
|
+
} }
|
|
11910
|
+
]),
|
|
11911
|
+
gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
|
|
11912
|
+
if (F3.isTermNamed(ast)) {
|
|
11913
|
+
SUBRULE(iri2, ast);
|
|
11914
|
+
} else if (F3.isTermLiteral(ast)) {
|
|
11915
|
+
SUBRULE(rdfLiteral, ast);
|
|
11916
|
+
} else if (F3.isTermBlank(ast)) {
|
|
11917
|
+
SUBRULE(blankNode, ast);
|
|
11918
|
+
}
|
|
11919
|
+
}
|
|
11920
|
+
};
|
|
11921
|
+
|
|
11807
11922
|
// ../../packages/rules-sparql-1-1/lib/grammar/dataSetClause.ts
|
|
11808
11923
|
function datasetClauseUsing(name, token) {
|
|
11809
11924
|
return {
|
|
@@ -12059,55 +12174,55 @@ function baseAggregateFunc(func) {
|
|
|
12059
12174
|
}
|
|
12060
12175
|
|
|
12061
12176
|
// ../../packages/rules-sparql-1-1/lib/grammar/builtIn.ts
|
|
12062
|
-
var builtInStr = funcExpr1(
|
|
12063
|
-
var builtInLang = funcExpr1(
|
|
12064
|
-
var builtInLangmatches = funcExpr2(
|
|
12065
|
-
var builtInDatatype = funcExpr1(
|
|
12066
|
-
var builtInBound = funcVar1(
|
|
12067
|
-
var builtInIri = funcExpr1(
|
|
12068
|
-
var builtInUri = funcExpr1(
|
|
12069
|
-
var builtInBnodeSparqlJs = funcExprOrNil1(
|
|
12070
|
-
var builtInRand = funcNil1(
|
|
12071
|
-
var builtInAbs = funcExpr1(
|
|
12072
|
-
var builtInCeil = funcExpr1(
|
|
12073
|
-
var builtInFloor = funcExpr1(
|
|
12074
|
-
var builtInRound = funcExpr1(
|
|
12075
|
-
var builtInConcat = funcExprList1(
|
|
12076
|
-
var builtInStrlen = funcExpr1(
|
|
12077
|
-
var builtInUcase = funcExpr1(
|
|
12078
|
-
var builtInLcase = funcExpr1(
|
|
12079
|
-
var builtInEncode_for_uri = funcExpr1(
|
|
12080
|
-
var builtInContains = funcExpr2(
|
|
12081
|
-
var builtInStrstarts = funcExpr2(
|
|
12082
|
-
var builtInStrends = funcExpr2(
|
|
12083
|
-
var builtInStrbefore = funcExpr2(
|
|
12084
|
-
var builtInStrafter = funcExpr2(
|
|
12085
|
-
var builtInYear = funcExpr1(
|
|
12086
|
-
var builtInMonth = funcExpr1(
|
|
12087
|
-
var builtInDay = funcExpr1(
|
|
12088
|
-
var builtInHours = funcExpr1(
|
|
12089
|
-
var builtInMinutes = funcExpr1(
|
|
12090
|
-
var builtInSeconds = funcExpr1(
|
|
12091
|
-
var builtInTimezone = funcExpr1(
|
|
12092
|
-
var builtInTz = funcExpr1(
|
|
12093
|
-
var builtInNow = funcNil1(
|
|
12094
|
-
var builtInUuid = funcNil1(
|
|
12095
|
-
var builtInStruuid = funcNil1(
|
|
12096
|
-
var builtInMd5 = funcExpr1(
|
|
12097
|
-
var builtInSha1 = funcExpr1(
|
|
12098
|
-
var builtInSha256 = funcExpr1(
|
|
12099
|
-
var builtInSha384 = funcExpr1(
|
|
12100
|
-
var builtInSha512 = funcExpr1(
|
|
12101
|
-
var builtInCoalesce = funcExprList1(
|
|
12102
|
-
var builtInIf = funcExpr3(
|
|
12103
|
-
var builtInStrlang = funcExpr2(
|
|
12104
|
-
var builtInStrdt = funcExpr2(
|
|
12105
|
-
var builtInSameterm = funcExpr2(
|
|
12106
|
-
var builtInIsiri = funcExpr1(
|
|
12107
|
-
var builtInIsuri = funcExpr1(
|
|
12108
|
-
var builtInIsblank = funcExpr1(
|
|
12109
|
-
var builtInIsliteral = funcExpr1(
|
|
12110
|
-
var builtInIsnumeric = funcExpr1(
|
|
12177
|
+
var builtInStr = funcExpr1(BuiltInCalls_exports.str);
|
|
12178
|
+
var builtInLang = funcExpr1(BuiltInCalls_exports.lang);
|
|
12179
|
+
var builtInLangmatches = funcExpr2(BuiltInCalls_exports.langmatches);
|
|
12180
|
+
var builtInDatatype = funcExpr1(BuiltInCalls_exports.datatype);
|
|
12181
|
+
var builtInBound = funcVar1(BuiltInCalls_exports.bound);
|
|
12182
|
+
var builtInIri = funcExpr1(BuiltInCalls_exports.iri);
|
|
12183
|
+
var builtInUri = funcExpr1(BuiltInCalls_exports.uri);
|
|
12184
|
+
var builtInBnodeSparqlJs = funcExprOrNil1(BuiltInCalls_exports.bnode);
|
|
12185
|
+
var builtInRand = funcNil1(BuiltInCalls_exports.rand);
|
|
12186
|
+
var builtInAbs = funcExpr1(BuiltInCalls_exports.abs);
|
|
12187
|
+
var builtInCeil = funcExpr1(BuiltInCalls_exports.ceil);
|
|
12188
|
+
var builtInFloor = funcExpr1(BuiltInCalls_exports.floor);
|
|
12189
|
+
var builtInRound = funcExpr1(BuiltInCalls_exports.round);
|
|
12190
|
+
var builtInConcat = funcExprList1(BuiltInCalls_exports.concat);
|
|
12191
|
+
var builtInStrlen = funcExpr1(BuiltInCalls_exports.strlen);
|
|
12192
|
+
var builtInUcase = funcExpr1(BuiltInCalls_exports.ucase);
|
|
12193
|
+
var builtInLcase = funcExpr1(BuiltInCalls_exports.lcase);
|
|
12194
|
+
var builtInEncode_for_uri = funcExpr1(BuiltInCalls_exports.encode_for_uri);
|
|
12195
|
+
var builtInContains = funcExpr2(BuiltInCalls_exports.contains);
|
|
12196
|
+
var builtInStrstarts = funcExpr2(BuiltInCalls_exports.strstarts);
|
|
12197
|
+
var builtInStrends = funcExpr2(BuiltInCalls_exports.strends);
|
|
12198
|
+
var builtInStrbefore = funcExpr2(BuiltInCalls_exports.strbefore);
|
|
12199
|
+
var builtInStrafter = funcExpr2(BuiltInCalls_exports.strafter);
|
|
12200
|
+
var builtInYear = funcExpr1(BuiltInCalls_exports.year);
|
|
12201
|
+
var builtInMonth = funcExpr1(BuiltInCalls_exports.month);
|
|
12202
|
+
var builtInDay = funcExpr1(BuiltInCalls_exports.day);
|
|
12203
|
+
var builtInHours = funcExpr1(BuiltInCalls_exports.hours);
|
|
12204
|
+
var builtInMinutes = funcExpr1(BuiltInCalls_exports.minutes);
|
|
12205
|
+
var builtInSeconds = funcExpr1(BuiltInCalls_exports.seconds);
|
|
12206
|
+
var builtInTimezone = funcExpr1(BuiltInCalls_exports.timezone);
|
|
12207
|
+
var builtInTz = funcExpr1(BuiltInCalls_exports.tz);
|
|
12208
|
+
var builtInNow = funcNil1(BuiltInCalls_exports.now);
|
|
12209
|
+
var builtInUuid = funcNil1(BuiltInCalls_exports.uuid);
|
|
12210
|
+
var builtInStruuid = funcNil1(BuiltInCalls_exports.struuid);
|
|
12211
|
+
var builtInMd5 = funcExpr1(BuiltInCalls_exports.md5);
|
|
12212
|
+
var builtInSha1 = funcExpr1(BuiltInCalls_exports.sha1);
|
|
12213
|
+
var builtInSha256 = funcExpr1(BuiltInCalls_exports.sha256);
|
|
12214
|
+
var builtInSha384 = funcExpr1(BuiltInCalls_exports.sha384);
|
|
12215
|
+
var builtInSha512 = funcExpr1(BuiltInCalls_exports.sha512);
|
|
12216
|
+
var builtInCoalesce = funcExprList1(BuiltInCalls_exports.coalesce);
|
|
12217
|
+
var builtInIf = funcExpr3(BuiltInCalls_exports.if_);
|
|
12218
|
+
var builtInStrlang = funcExpr2(BuiltInCalls_exports.strlang);
|
|
12219
|
+
var builtInStrdt = funcExpr2(BuiltInCalls_exports.strdt);
|
|
12220
|
+
var builtInSameterm = funcExpr2(BuiltInCalls_exports.sameterm);
|
|
12221
|
+
var builtInIsiri = funcExpr1(BuiltInCalls_exports.isiri);
|
|
12222
|
+
var builtInIsuri = funcExpr1(BuiltInCalls_exports.isuri);
|
|
12223
|
+
var builtInIsblank = funcExpr1(BuiltInCalls_exports.isblank);
|
|
12224
|
+
var builtInIsliteral = funcExpr1(BuiltInCalls_exports.isliteral);
|
|
12225
|
+
var builtInIsnumeric = funcExpr1(BuiltInCalls_exports.isnumeric);
|
|
12111
12226
|
function builtInCallList(SUBRULE) {
|
|
12112
12227
|
return [
|
|
12113
12228
|
{ ALT: () => SUBRULE(aggregate) },
|
|
@@ -12179,15 +12294,15 @@ var builtInCall = {
|
|
|
12179
12294
|
return OR(builtIns);
|
|
12180
12295
|
}
|
|
12181
12296
|
};
|
|
12182
|
-
var regexExpression = funcExpr2or3(
|
|
12183
|
-
var substringExpression = funcExpr2or3(
|
|
12184
|
-
var strReplaceExpression = funcExpr3or4(
|
|
12185
|
-
var existsFunc = funcGroupGraphPattern(
|
|
12186
|
-
var notExistsFunc = funcGroupGraphPattern(
|
|
12297
|
+
var regexExpression = funcExpr2or3(BuiltInCalls_exports.regex);
|
|
12298
|
+
var substringExpression = funcExpr2or3(BuiltInCalls_exports.substr);
|
|
12299
|
+
var strReplaceExpression = funcExpr3or4(BuiltInCalls_exports.replace);
|
|
12300
|
+
var existsFunc = funcGroupGraphPattern(BuiltInCalls_exports.exists);
|
|
12301
|
+
var notExistsFunc = funcGroupGraphPattern(BuiltInCalls_exports.notexists);
|
|
12187
12302
|
var aggregateCount = {
|
|
12188
|
-
name: unCapitalize(
|
|
12303
|
+
name: unCapitalize(BuiltInCalls_exports.count.name),
|
|
12189
12304
|
impl: ({ ACTION, CONSUME, SUBRULE, OR, OPTION }) => (C) => {
|
|
12190
|
-
const operatorToken = CONSUME(
|
|
12305
|
+
const operatorToken = CONSUME(BuiltInCalls_exports.count);
|
|
12191
12306
|
CONSUME(symbols_exports.LParen);
|
|
12192
12307
|
const distinctToken = OPTION(() => CONSUME(distinct));
|
|
12193
12308
|
const expressionVal = OR([
|
|
@@ -12219,15 +12334,15 @@ var aggregateCount = {
|
|
|
12219
12334
|
});
|
|
12220
12335
|
}
|
|
12221
12336
|
};
|
|
12222
|
-
var aggregateSum = baseAggregateFunc(
|
|
12223
|
-
var aggregateMin = baseAggregateFunc(
|
|
12224
|
-
var aggregateMax = baseAggregateFunc(
|
|
12225
|
-
var aggregateAvg = baseAggregateFunc(
|
|
12226
|
-
var aggregateSample = baseAggregateFunc(
|
|
12337
|
+
var aggregateSum = baseAggregateFunc(BuiltInCalls_exports.sum);
|
|
12338
|
+
var aggregateMin = baseAggregateFunc(BuiltInCalls_exports.min);
|
|
12339
|
+
var aggregateMax = baseAggregateFunc(BuiltInCalls_exports.max);
|
|
12340
|
+
var aggregateAvg = baseAggregateFunc(BuiltInCalls_exports.avg);
|
|
12341
|
+
var aggregateSample = baseAggregateFunc(BuiltInCalls_exports.sample);
|
|
12227
12342
|
var aggregateGroup_concat = {
|
|
12228
|
-
name: unCapitalize(
|
|
12343
|
+
name: unCapitalize(BuiltInCalls_exports.groupConcat.name),
|
|
12229
12344
|
impl: ({ ACTION, CONSUME, OPTION1, SUBRULE, OPTION2 }) => (C) => {
|
|
12230
|
-
const operatorToken = CONSUME(
|
|
12345
|
+
const operatorToken = CONSUME(BuiltInCalls_exports.groupConcat);
|
|
12231
12346
|
CONSUME(symbols_exports.LParen);
|
|
12232
12347
|
const distinctToken = OPTION1(() => CONSUME(distinct));
|
|
12233
12348
|
const expr = SUBRULE(expression);
|
|
@@ -12295,120 +12410,6 @@ var aggregate = {
|
|
|
12295
12410
|
}
|
|
12296
12411
|
};
|
|
12297
12412
|
|
|
12298
|
-
// ../../packages/rules-sparql-1-1/lib/grammar/general.ts
|
|
12299
|
-
var prologue = {
|
|
12300
|
-
name: "prologue",
|
|
12301
|
-
impl: ({ SUBRULE, MANY, OR }) => () => {
|
|
12302
|
-
const result = [];
|
|
12303
|
-
MANY(() => OR([
|
|
12304
|
-
{ ALT: () => result.push(SUBRULE(baseDecl2)) },
|
|
12305
|
-
// TODO: the [spec](https://www.w3.org/TR/sparql11-query/#iriRefs) says you cannot redefine prefixes.
|
|
12306
|
-
// We might need to check this.
|
|
12307
|
-
{ ALT: () => result.push(SUBRULE(prefixDecl2)) }
|
|
12308
|
-
]));
|
|
12309
|
-
return result;
|
|
12310
|
-
},
|
|
12311
|
-
gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
|
|
12312
|
-
for (const context of ast) {
|
|
12313
|
-
if (F3.isContextDefinitionBase(context)) {
|
|
12314
|
-
SUBRULE(baseDecl2, context);
|
|
12315
|
-
} else if (F3.isContextDefinitionPrefix(context)) {
|
|
12316
|
-
SUBRULE(prefixDecl2, context);
|
|
12317
|
-
}
|
|
12318
|
-
}
|
|
12319
|
-
}
|
|
12320
|
-
};
|
|
12321
|
-
var baseDecl2 = {
|
|
12322
|
-
name: "baseDecl",
|
|
12323
|
-
impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
|
|
12324
|
-
const base = CONSUME(baseDecl);
|
|
12325
|
-
const val = SUBRULE(iriFull);
|
|
12326
|
-
return ACTION(() => C.factory.contextDefinitionBase(C.factory.sourceLocation(base, val), val));
|
|
12327
|
-
},
|
|
12328
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
|
|
12329
|
-
F3.printFilter(ast, () => PRINT_WORD("BASE"));
|
|
12330
|
-
SUBRULE(iri2, ast.value);
|
|
12331
|
-
}
|
|
12332
|
-
};
|
|
12333
|
-
var prefixDecl2 = {
|
|
12334
|
-
name: "prefixDecl",
|
|
12335
|
-
impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
|
|
12336
|
-
const prefix = CONSUME(prefixDecl);
|
|
12337
|
-
const name = CONSUME(terminals_exports.pNameNs).image.slice(0, -1);
|
|
12338
|
-
const value = SUBRULE(iriFull);
|
|
12339
|
-
return ACTION(() => C.factory.contextDefinitionPrefix(C.factory.sourceLocation(prefix, value), name, value));
|
|
12340
|
-
},
|
|
12341
|
-
gImpl: ({ SUBRULE, PRINT_WORDS }) => (ast, { factory: F3 }) => {
|
|
12342
|
-
F3.printFilter(ast, () => {
|
|
12343
|
-
PRINT_WORDS("PREFIX", `${ast.key}:`);
|
|
12344
|
-
});
|
|
12345
|
-
SUBRULE(iri2, ast.value);
|
|
12346
|
-
}
|
|
12347
|
-
};
|
|
12348
|
-
var verb = {
|
|
12349
|
-
name: "verb",
|
|
12350
|
-
impl: ({ SUBRULE, OR }) => () => OR([
|
|
12351
|
-
{ ALT: () => SUBRULE(varOrIri) },
|
|
12352
|
-
{ ALT: () => SUBRULE(verbA) }
|
|
12353
|
-
])
|
|
12354
|
-
};
|
|
12355
|
-
var varOrTerm = {
|
|
12356
|
-
name: "varOrTerm",
|
|
12357
|
-
impl: ({ SUBRULE, OR }) => (C) => OR([
|
|
12358
|
-
{ GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(var_) },
|
|
12359
|
-
{ ALT: () => SUBRULE(graphTerm) }
|
|
12360
|
-
]),
|
|
12361
|
-
gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
|
|
12362
|
-
if (F3.isTermVariable(ast)) {
|
|
12363
|
-
return SUBRULE(var_, ast);
|
|
12364
|
-
}
|
|
12365
|
-
return SUBRULE(graphTerm, ast);
|
|
12366
|
-
}
|
|
12367
|
-
};
|
|
12368
|
-
var varOrIri = {
|
|
12369
|
-
name: "varOrIri",
|
|
12370
|
-
impl: ({ SUBRULE, OR }) => (C) => OR([
|
|
12371
|
-
{ GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(var_) },
|
|
12372
|
-
{ ALT: () => SUBRULE(iri2) }
|
|
12373
|
-
])
|
|
12374
|
-
};
|
|
12375
|
-
var var_ = {
|
|
12376
|
-
name: "var",
|
|
12377
|
-
impl: ({ ACTION, CONSUME, OR }) => (C) => {
|
|
12378
|
-
const varToken = OR([
|
|
12379
|
-
{ ALT: () => CONSUME(terminals_exports.var1) },
|
|
12380
|
-
{ ALT: () => CONSUME(terminals_exports.var2) }
|
|
12381
|
-
]);
|
|
12382
|
-
return ACTION(() => C.factory.variable(varToken.image.slice(1), C.factory.sourceLocation(varToken)));
|
|
12383
|
-
},
|
|
12384
|
-
gImpl: ({ PRINT_WORD }) => (ast, { factory: F3 }) => {
|
|
12385
|
-
F3.printFilter(ast, () => PRINT_WORD(`?${ast.value}`));
|
|
12386
|
-
}
|
|
12387
|
-
};
|
|
12388
|
-
var graphTerm = {
|
|
12389
|
-
name: "graphTerm",
|
|
12390
|
-
impl: ({ ACTION, SUBRULE, CONSUME, OR }) => (C) => OR([
|
|
12391
|
-
{ ALT: () => SUBRULE(iri2) },
|
|
12392
|
-
{ ALT: () => SUBRULE(rdfLiteral) },
|
|
12393
|
-
{ ALT: () => SUBRULE(numericLiteral) },
|
|
12394
|
-
{ ALT: () => SUBRULE(booleanLiteral) },
|
|
12395
|
-
{ GATE: () => C.parseMode.has("canCreateBlankNodes"), ALT: () => SUBRULE(blankNode) },
|
|
12396
|
-
{ ALT: () => {
|
|
12397
|
-
const tokenNil = CONSUME(terminals_exports.nil);
|
|
12398
|
-
return ACTION(() => C.factory.namedNode(C.factory.sourceLocation(tokenNil), "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" /* NIL */));
|
|
12399
|
-
} }
|
|
12400
|
-
]),
|
|
12401
|
-
gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
|
|
12402
|
-
if (F3.isTermNamed(ast)) {
|
|
12403
|
-
SUBRULE(iri2, ast);
|
|
12404
|
-
} else if (F3.isTermLiteral(ast)) {
|
|
12405
|
-
SUBRULE(rdfLiteral, ast);
|
|
12406
|
-
} else if (F3.isTermBlank(ast)) {
|
|
12407
|
-
SUBRULE(blankNode, ast);
|
|
12408
|
-
}
|
|
12409
|
-
}
|
|
12410
|
-
};
|
|
12411
|
-
|
|
12412
12413
|
// ../../packages/rules-sparql-1-1/lib/grammar/propertyPaths.ts
|
|
12413
12414
|
var path = {
|
|
12414
12415
|
name: "path",
|
|
@@ -14664,8 +14665,70 @@ var quadsNotTriples = {
|
|
|
14664
14665
|
}
|
|
14665
14666
|
};
|
|
14666
14667
|
|
|
14667
|
-
//
|
|
14668
|
+
// ../../packages/rules-sparql-1-1/lib/grammar/index.ts
|
|
14668
14669
|
var queryOrUpdate = {
|
|
14670
|
+
name: "queryOrUpdate",
|
|
14671
|
+
impl: ({ ACTION, SUBRULE, OR1, OR2, MANY, OPTION1, CONSUME, SUBRULE2 }) => (C) => {
|
|
14672
|
+
const prologueValues = SUBRULE(prologue);
|
|
14673
|
+
return OR1([
|
|
14674
|
+
{ ALT: () => {
|
|
14675
|
+
const subType = OR2([
|
|
14676
|
+
{ ALT: () => SUBRULE(selectQuery) },
|
|
14677
|
+
{ ALT: () => SUBRULE(constructQuery) },
|
|
14678
|
+
{ ALT: () => SUBRULE(describeQuery) },
|
|
14679
|
+
{ ALT: () => SUBRULE(askQuery) }
|
|
14680
|
+
]);
|
|
14681
|
+
const values3 = SUBRULE(valuesClause);
|
|
14682
|
+
return ACTION(() => ({
|
|
14683
|
+
context: prologueValues,
|
|
14684
|
+
...subType,
|
|
14685
|
+
type: "query",
|
|
14686
|
+
...values3 && { values: values3 },
|
|
14687
|
+
loc: C.factory.sourceLocation(
|
|
14688
|
+
prologueValues.at(0),
|
|
14689
|
+
subType,
|
|
14690
|
+
values3
|
|
14691
|
+
)
|
|
14692
|
+
}));
|
|
14693
|
+
} },
|
|
14694
|
+
{ ALT: () => {
|
|
14695
|
+
const updates = [];
|
|
14696
|
+
updates.push({ context: prologueValues });
|
|
14697
|
+
let parsedSemi = true;
|
|
14698
|
+
MANY({
|
|
14699
|
+
GATE: () => parsedSemi,
|
|
14700
|
+
DEF: () => {
|
|
14701
|
+
parsedSemi = false;
|
|
14702
|
+
updates.at(-1).operation = SUBRULE(update1);
|
|
14703
|
+
OPTION1(() => {
|
|
14704
|
+
CONSUME(symbols_exports.semi);
|
|
14705
|
+
parsedSemi = true;
|
|
14706
|
+
const innerPrologue = SUBRULE2(prologue);
|
|
14707
|
+
updates.push({ context: innerPrologue });
|
|
14708
|
+
});
|
|
14709
|
+
}
|
|
14710
|
+
});
|
|
14711
|
+
return ACTION(() => {
|
|
14712
|
+
const update2 = {
|
|
14713
|
+
type: "update",
|
|
14714
|
+
updates,
|
|
14715
|
+
loc: C.factory.sourceLocation(
|
|
14716
|
+
...updates[0].context,
|
|
14717
|
+
updates[0].operation,
|
|
14718
|
+
...updates.at(-1).context,
|
|
14719
|
+
updates.at(-1)?.operation
|
|
14720
|
+
)
|
|
14721
|
+
};
|
|
14722
|
+
updateNoReuseBlankNodeLabels(update2);
|
|
14723
|
+
return update2;
|
|
14724
|
+
});
|
|
14725
|
+
} }
|
|
14726
|
+
]);
|
|
14727
|
+
}
|
|
14728
|
+
};
|
|
14729
|
+
|
|
14730
|
+
// ../generator-sparql-1-1/lib/index.js
|
|
14731
|
+
var queryOrUpdate2 = {
|
|
14669
14732
|
name: "queryOrUpdate",
|
|
14670
14733
|
gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
|
|
14671
14734
|
if (F3.isQuery(ast)) {
|
|
@@ -14682,7 +14745,7 @@ var sparql11GeneratorBuilder = GeneratorBuilder.create([
|
|
|
14682
14745
|
grammar_exports.describeQuery,
|
|
14683
14746
|
grammar_exports.askQuery,
|
|
14684
14747
|
grammar_exports.selectClause
|
|
14685
|
-
]).addMany(grammar_exports.update, grammar_exports.update1, grammar_exports.load, grammar_exports.clear, grammar_exports.drop, grammar_exports.create, grammar_exports.copy, grammar_exports.move, grammar_exports.add, grammar_exports.insertData, grammar_exports.deleteData, grammar_exports.deleteWhere, grammar_exports.modify, grammar_exports.graphRef, grammar_exports.graphRefAll, grammar_exports.quads, grammar_exports.quadsNotTriples).addRule(grammar_exports.aggregate).addMany(grammar_exports.datasetClauseStar, grammar_exports.usingClauseStar).addMany(grammar_exports.argList, grammar_exports.expression, grammar_exports.iriOrFunction).addMany(grammar_exports.prologue, grammar_exports.prefixDecl, grammar_exports.baseDecl, grammar_exports.varOrTerm, grammar_exports.var_, grammar_exports.graphTerm).addMany(grammar_exports.rdfLiteral, grammar_exports.iri, grammar_exports.iriFull, grammar_exports.prefixedName, grammar_exports.blankNode).addRule(grammar_exports.pathGenerator).addMany(grammar_exports.solutionModifier, grammar_exports.groupClause, grammar_exports.havingClause, grammar_exports.orderClause, grammar_exports.limitOffsetClauses).addMany(grammar_exports.triplesBlock, grammar_exports.collectionPath, grammar_exports.blankNodePropertyListPath, grammar_exports.triplesNodePath, grammar_exports.graphNodePath).addMany(grammar_exports.whereClause, grammar_exports.generatePattern, grammar_exports.groupGraphPattern, grammar_exports.graphPatternNotTriples, grammar_exports.optionalGraphPattern, grammar_exports.graphGraphPattern, grammar_exports.serviceGraphPattern, grammar_exports.bind, grammar_exports.inlineData, grammar_exports.minusGraphPattern, grammar_exports.groupOrUnionGraphPattern, grammar_exports.filter).addRule(
|
|
14748
|
+
]).addMany(grammar_exports.update, grammar_exports.update1, grammar_exports.load, grammar_exports.clear, grammar_exports.drop, grammar_exports.create, grammar_exports.copy, grammar_exports.move, grammar_exports.add, grammar_exports.insertData, grammar_exports.deleteData, grammar_exports.deleteWhere, grammar_exports.modify, grammar_exports.graphRef, grammar_exports.graphRefAll, grammar_exports.quads, grammar_exports.quadsNotTriples).addRule(grammar_exports.aggregate).addMany(grammar_exports.datasetClauseStar, grammar_exports.usingClauseStar).addMany(grammar_exports.argList, grammar_exports.expression, grammar_exports.iriOrFunction).addMany(grammar_exports.prologue, grammar_exports.prefixDecl, grammar_exports.baseDecl, grammar_exports.varOrTerm, grammar_exports.var_, grammar_exports.graphTerm).addMany(grammar_exports.rdfLiteral, grammar_exports.iri, grammar_exports.iriFull, grammar_exports.prefixedName, grammar_exports.blankNode).addRule(grammar_exports.pathGenerator).addMany(grammar_exports.solutionModifier, grammar_exports.groupClause, grammar_exports.havingClause, grammar_exports.orderClause, grammar_exports.limitOffsetClauses).addMany(grammar_exports.triplesBlock, grammar_exports.collectionPath, grammar_exports.blankNodePropertyListPath, grammar_exports.triplesNodePath, grammar_exports.graphNodePath).addMany(grammar_exports.whereClause, grammar_exports.generatePattern, grammar_exports.groupGraphPattern, grammar_exports.graphPatternNotTriples, grammar_exports.optionalGraphPattern, grammar_exports.graphGraphPattern, grammar_exports.serviceGraphPattern, grammar_exports.bind, grammar_exports.inlineData, grammar_exports.minusGraphPattern, grammar_exports.groupOrUnionGraphPattern, grammar_exports.filter).addRule(queryOrUpdate2);
|
|
14686
14749
|
|
|
14687
14750
|
// ../../packages/rules-sparql-1-2/lib/grammar.ts
|
|
14688
14751
|
var grammar_exports2 = {};
|
|
@@ -14691,16 +14754,16 @@ __export(grammar_exports2, {
|
|
|
14691
14754
|
annotationBlock: () => annotationBlock,
|
|
14692
14755
|
annotationBlockPath: () => annotationBlockPath,
|
|
14693
14756
|
annotationPath: () => annotationPath,
|
|
14757
|
+
buildInHasLang: () => buildInHasLang2,
|
|
14758
|
+
buildInHasLangDir: () => buildInHasLangDir2,
|
|
14759
|
+
buildInIsTriple: () => buildInIsTriple,
|
|
14760
|
+
buildInLangDir: () => buildInLangDir2,
|
|
14761
|
+
buildInLangStrDir: () => buildInLangStrDir,
|
|
14762
|
+
buildInObject: () => buildInObject,
|
|
14763
|
+
buildInPredicate: () => buildInPredicate,
|
|
14764
|
+
buildInSubject: () => buildInSubject,
|
|
14765
|
+
buildInTriple: () => buildInTriple,
|
|
14694
14766
|
builtInCall: () => builtInCall2,
|
|
14695
|
-
builtinHasLang: () => builtinHasLang2,
|
|
14696
|
-
builtinHasLangDir: () => builtinHasLangDir2,
|
|
14697
|
-
builtinIsTriple: () => builtinIsTriple,
|
|
14698
|
-
builtinLangDir: () => builtinLangDir2,
|
|
14699
|
-
builtinLangStrDir: () => builtinLangStrDir,
|
|
14700
|
-
builtinObject: () => builtinObject,
|
|
14701
|
-
builtinPredicate: () => builtinPredicate,
|
|
14702
|
-
builtinSubject: () => builtinSubject,
|
|
14703
|
-
builtinTriple: () => builtinTriple,
|
|
14704
14767
|
dataBlockValue: () => dataBlockValue2,
|
|
14705
14768
|
exprTripleTerm: () => exprTripleTerm,
|
|
14706
14769
|
exprTripleTermObject: () => exprTripleTermObject,
|
|
@@ -14743,29 +14806,29 @@ var reificationOpen = createToken2({ name: "ReificationOpen", pattern: "<<", lab
|
|
|
14743
14806
|
var reificationClose = createToken2({ name: "ReificationClose", pattern: ">>", label: "Reification close >>" });
|
|
14744
14807
|
var tripleTermOpen = createToken2({ name: "TripleTermOpen", pattern: "<<(", label: "Triple Term Open <<(" });
|
|
14745
14808
|
var tripleTermClose = createToken2({ name: "TripleTermClose", pattern: ")>>", label: "Triple Term Close )>>" });
|
|
14746
|
-
var
|
|
14747
|
-
var
|
|
14809
|
+
var buildInLangDir = createToken2({ name: "BuiltInLangdir", pattern: /langdir/i, label: "LANGDIR" });
|
|
14810
|
+
var buildInStrLangDir = createToken2({
|
|
14748
14811
|
name: "BuiltInStrLangdir",
|
|
14749
14812
|
pattern: /strlangdir/i,
|
|
14750
14813
|
label: "STRLANGDIR"
|
|
14751
14814
|
});
|
|
14752
|
-
var
|
|
14753
|
-
var
|
|
14815
|
+
var buildInHasLang = createToken2({ name: "BuiltInHasLang", pattern: /haslang/i, label: "hasLANG" });
|
|
14816
|
+
var buildInHasLangDir = createToken2({
|
|
14754
14817
|
name: "BuiltInHasLangdir",
|
|
14755
14818
|
pattern: /haslangdir/i,
|
|
14756
14819
|
label: "hasLANGDIR"
|
|
14757
14820
|
});
|
|
14758
|
-
var
|
|
14759
|
-
var
|
|
14760
|
-
var
|
|
14761
|
-
var
|
|
14762
|
-
var
|
|
14821
|
+
var buildInIsTRIPLE = createToken2({ name: "BuiltInIsTriple", pattern: /istriple/i, label: "isTRIPLE" });
|
|
14822
|
+
var buildInTRIPLE = createToken2({ name: "BuiltInTriple", pattern: /triple/i, label: "TRIPLE" });
|
|
14823
|
+
var buildInSUBJECT = createToken2({ name: "BuiltInSubject", pattern: /subject/i, label: "SUBJECT" });
|
|
14824
|
+
var buildInPREDICATE = createToken2({ name: "BuiltInPredicate", pattern: /predicate/i, label: "PREDICATE" });
|
|
14825
|
+
var buildInOBJECT = createToken2({ name: "BuiltInObject", pattern: /object/i, label: "OBJECT" });
|
|
14763
14826
|
var LANG_DIR = createToken2({
|
|
14764
14827
|
name: "LANG_DIR",
|
|
14765
14828
|
pattern: /@[a-z]+(?:-[\da-z]+)*(?:--[a-z]+)?/i,
|
|
14766
14829
|
label: "LANG_DIR"
|
|
14767
14830
|
});
|
|
14768
|
-
var
|
|
14831
|
+
var sparql12LexerBuilder = LexerBuilder.create(lexer_exports.sparql11LexerBuilder).addBefore(
|
|
14769
14832
|
lexer_exports.symbols.logicAnd,
|
|
14770
14833
|
tilde,
|
|
14771
14834
|
annotationOpen,
|
|
@@ -14777,15 +14840,15 @@ var sparql12Tokens = LexerBuilder.create(lexer_exports.sparql11Tokens).addBefore
|
|
|
14777
14840
|
version
|
|
14778
14841
|
).addBefore(
|
|
14779
14842
|
lexer_exports.builtIn.langmatches,
|
|
14780
|
-
|
|
14781
|
-
|
|
14782
|
-
|
|
14783
|
-
|
|
14784
|
-
|
|
14785
|
-
|
|
14786
|
-
|
|
14787
|
-
|
|
14788
|
-
|
|
14843
|
+
buildInLangDir,
|
|
14844
|
+
buildInStrLangDir,
|
|
14845
|
+
buildInHasLangDir,
|
|
14846
|
+
buildInHasLang,
|
|
14847
|
+
buildInIsTRIPLE,
|
|
14848
|
+
buildInTRIPLE,
|
|
14849
|
+
buildInSUBJECT,
|
|
14850
|
+
buildInPREDICATE,
|
|
14851
|
+
buildInOBJECT
|
|
14789
14852
|
).addBefore(lexer_exports.terminals.langTag, LANG_DIR).delete(lexer_exports.terminals.langTag);
|
|
14790
14853
|
|
|
14791
14854
|
// ../../packages/rules-sparql-1-2/lib/validator.ts
|
|
@@ -15210,28 +15273,28 @@ var exprTripleTermObject = {
|
|
|
15210
15273
|
name: "exprTripleTermObject",
|
|
15211
15274
|
impl: exprTripleTermSubject.impl
|
|
15212
15275
|
};
|
|
15213
|
-
var
|
|
15214
|
-
var
|
|
15215
|
-
var
|
|
15216
|
-
var
|
|
15217
|
-
var
|
|
15218
|
-
var
|
|
15219
|
-
var
|
|
15220
|
-
var
|
|
15221
|
-
var
|
|
15276
|
+
var buildInLangDir2 = funcExpr1(buildInLangDir);
|
|
15277
|
+
var buildInLangStrDir = funcExpr3(buildInStrLangDir);
|
|
15278
|
+
var buildInHasLang2 = funcExpr1(buildInHasLang);
|
|
15279
|
+
var buildInHasLangDir2 = funcExpr1(buildInHasLangDir);
|
|
15280
|
+
var buildInIsTriple = funcExpr1(buildInIsTRIPLE);
|
|
15281
|
+
var buildInTriple = funcExpr3(buildInTRIPLE);
|
|
15282
|
+
var buildInSubject = funcExpr1(buildInSUBJECT);
|
|
15283
|
+
var buildInPredicate = funcExpr1(buildInPREDICATE);
|
|
15284
|
+
var buildInObject = funcExpr1(buildInOBJECT);
|
|
15222
15285
|
var builtInCall2 = {
|
|
15223
15286
|
name: "builtInCall",
|
|
15224
15287
|
impl: ($) => (C) => $.OR2([
|
|
15225
15288
|
{ ALT: () => grammar_exports.builtInCall.impl($)(C) },
|
|
15226
|
-
{ ALT: () => $.SUBRULE(
|
|
15227
|
-
{ ALT: () => $.SUBRULE(
|
|
15228
|
-
{ ALT: () => $.SUBRULE(
|
|
15229
|
-
{ ALT: () => $.SUBRULE(
|
|
15230
|
-
{ ALT: () => $.SUBRULE(
|
|
15231
|
-
{ ALT: () => $.SUBRULE(
|
|
15232
|
-
{ ALT: () => $.SUBRULE(
|
|
15233
|
-
{ ALT: () => $.SUBRULE(
|
|
15234
|
-
{ ALT: () => $.SUBRULE(
|
|
15289
|
+
{ ALT: () => $.SUBRULE(buildInLangDir2) },
|
|
15290
|
+
{ ALT: () => $.SUBRULE(buildInLangStrDir) },
|
|
15291
|
+
{ ALT: () => $.SUBRULE(buildInHasLang2) },
|
|
15292
|
+
{ ALT: () => $.SUBRULE(buildInHasLangDir2) },
|
|
15293
|
+
{ ALT: () => $.SUBRULE(buildInIsTriple) },
|
|
15294
|
+
{ ALT: () => $.SUBRULE(buildInTriple) },
|
|
15295
|
+
{ ALT: () => $.SUBRULE(buildInSubject) },
|
|
15296
|
+
{ ALT: () => $.SUBRULE(buildInPredicate) },
|
|
15297
|
+
{ ALT: () => $.SUBRULE(buildInObject) }
|
|
15235
15298
|
])
|
|
15236
15299
|
};
|
|
15237
15300
|
var rdfLiteral2 = {
|
|
@@ -15306,20 +15369,6 @@ var generateGraphTerm = {
|
|
|
15306
15369
|
|
|
15307
15370
|
// ../../packages/rules-sparql-1-2/lib/Factory.ts
|
|
15308
15371
|
var Factory2 = class extends Factory {
|
|
15309
|
-
constructor() {
|
|
15310
|
-
super(...arguments);
|
|
15311
|
-
/**
|
|
15312
|
-
* Overwritten triple constructor to always contain an empty annotations list
|
|
15313
|
-
*/
|
|
15314
|
-
this.triple = (subject, predicate, object3, loc) => ({
|
|
15315
|
-
type: "triple",
|
|
15316
|
-
subject,
|
|
15317
|
-
predicate,
|
|
15318
|
-
object: object3,
|
|
15319
|
-
annotations: [],
|
|
15320
|
-
loc: loc ?? this.sourceLocation(subject, predicate, object3)
|
|
15321
|
-
});
|
|
15322
|
-
}
|
|
15323
15372
|
termTriple(subject, predicate, object3, loc) {
|
|
15324
15373
|
return {
|
|
15325
15374
|
type: "term",
|
|
@@ -15354,6 +15403,17 @@ var Factory2 = class extends Factory {
|
|
|
15354
15403
|
loc
|
|
15355
15404
|
};
|
|
15356
15405
|
}
|
|
15406
|
+
/**
|
|
15407
|
+
* Overwritten triple constructor to always contain an empty annotations list
|
|
15408
|
+
*/
|
|
15409
|
+
triple = (subject, predicate, object3, loc) => ({
|
|
15410
|
+
type: "triple",
|
|
15411
|
+
subject,
|
|
15412
|
+
predicate,
|
|
15413
|
+
object: object3,
|
|
15414
|
+
annotations: [],
|
|
15415
|
+
loc: loc ?? this.sourceLocation(subject, predicate, object3)
|
|
15416
|
+
});
|
|
15357
15417
|
annotatedTriple(subject, predicate, object3, annotations, loc) {
|
|
15358
15418
|
return {
|
|
15359
15419
|
type: "triple",
|
|
@@ -15377,8 +15437,21 @@ var Factory2 = class extends Factory {
|
|
|
15377
15437
|
}
|
|
15378
15438
|
};
|
|
15379
15439
|
|
|
15440
|
+
// ../../packages/rules-sparql-1-2/lib/parserUtils.ts
|
|
15441
|
+
function completeParseContext2(context) {
|
|
15442
|
+
return {
|
|
15443
|
+
factory: context.factory ?? new Factory2(),
|
|
15444
|
+
baseIRI: context.baseIRI,
|
|
15445
|
+
prefixes: { ...context.prefixes },
|
|
15446
|
+
origSource: context.origSource ?? "",
|
|
15447
|
+
offset: context.offset,
|
|
15448
|
+
parseMode: context.parseMode ? new Set(context.parseMode) : /* @__PURE__ */ new Set(["canParseVars", "canCreateBlankNodes"]),
|
|
15449
|
+
skipValidation: context.skipValidation ?? false
|
|
15450
|
+
};
|
|
15451
|
+
}
|
|
15452
|
+
|
|
15380
15453
|
// lib/index.ts
|
|
15381
|
-
var
|
|
15454
|
+
var queryOrUpdate3 = {
|
|
15382
15455
|
name: "queryOrUpdate",
|
|
15383
15456
|
gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
|
|
15384
15457
|
if (F3.isQuery(ast)) {
|
|
@@ -15388,25 +15461,15 @@ var queryOrUpdate2 = {
|
|
|
15388
15461
|
}
|
|
15389
15462
|
}
|
|
15390
15463
|
};
|
|
15391
|
-
var sparql12GeneratorBuilder = GeneratorBuilder.create(sparql11GeneratorBuilder).widenContext().typePatch().addRule(grammar_exports2.tripleTerm).addRule(grammar_exports2.reifiedTriple).patchRule(grammar_exports2.graphNodePath).addRule(grammar_exports2.annotationBlockPath).addRule(grammar_exports2.annotationPath).addRule(grammar_exports2.versionDecl).patchRule(grammar_exports2.prologue).patchRule(
|
|
15464
|
+
var sparql12GeneratorBuilder = GeneratorBuilder.create(sparql11GeneratorBuilder).widenContext().typePatch().addRule(grammar_exports2.tripleTerm).addRule(grammar_exports2.reifiedTriple).patchRule(grammar_exports2.graphNodePath).addRule(grammar_exports2.annotationBlockPath).addRule(grammar_exports2.annotationPath).addRule(grammar_exports2.versionDecl).patchRule(grammar_exports2.prologue).patchRule(queryOrUpdate3).patchRule(grammar_exports2.generateTriplesBlock).patchRule(grammar_exports2.generateGraphTerm);
|
|
15392
15465
|
var Generator = class {
|
|
15393
|
-
|
|
15394
|
-
|
|
15395
|
-
|
|
15396
|
-
|
|
15397
|
-
generate(ast, origSource = "") {
|
|
15398
|
-
return this.generator.queryOrUpdate(ast, {
|
|
15399
|
-
factory: this.F,
|
|
15400
|
-
offset: 0,
|
|
15401
|
-
origSource
|
|
15402
|
-
});
|
|
15466
|
+
generator = sparql12GeneratorBuilder.build();
|
|
15467
|
+
F = new Factory2();
|
|
15468
|
+
generate(ast, context = {}) {
|
|
15469
|
+
return this.generator.queryOrUpdate(ast, completeParseContext2(context));
|
|
15403
15470
|
}
|
|
15404
|
-
generatePath(ast,
|
|
15405
|
-
return this.generator.path(ast,
|
|
15406
|
-
factory: this.F,
|
|
15407
|
-
offset: 0,
|
|
15408
|
-
origSource
|
|
15409
|
-
}, void 0);
|
|
15471
|
+
generatePath(ast, context = {}) {
|
|
15472
|
+
return this.generator.path(ast, completeParseContext2(context), void 0);
|
|
15410
15473
|
}
|
|
15411
15474
|
};
|
|
15412
15475
|
/*! Bundled license information:
|