@traqula/parser-sparql-1-1 0.0.4 → 0.0.6
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/Parser.d.ts +73 -77
- package/lib/Parser.js +4 -59
- package/lib/Parser.js.map +1 -1
- package/lib/expressionParser.d.ts +1 -0
- package/lib/expressionParser.js.map +1 -1
- package/lib/index.cjs +342 -340
- package/lib/objectListParser.d.ts +2 -1
- package/lib/objectListParser.js +1 -1
- package/lib/objectListParser.js.map +1 -1
- package/lib/queryUnitParser.d.ts +9 -8
- package/lib/queryUnitParser.js.map +1 -1
- package/lib/subSelectParser.d.ts +5 -4
- package/lib/subSelectParser.js.map +1 -1
- package/lib/triplesBlockParser.d.ts +1 -0
- package/lib/triplesBlockParser.js +2 -2
- package/lib/triplesBlockParser.js.map +1 -1
- package/lib/triplesTemplateParserBuilder.d.ts +1 -0
- package/lib/triplesTemplateParserBuilder.js.map +1 -1
- package/lib/updateNoModifyParser.d.ts +1 -0
- package/lib/updateNoModifyParser.js.map +1 -1
- package/lib/updateUnitParser.d.ts +9 -8
- package/lib/updateUnitParser.js +2 -2
- package/lib/updateUnitParser.js.map +1 -1
- package/package.json +6 -6
package/lib/index.cjs
CHANGED
|
@@ -22,8 +22,7 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
Parser: () => Parser2,
|
|
24
24
|
expressionParserBuilder: () => expressionParserBuilder,
|
|
25
|
-
|
|
26
|
-
queryOrUpdate: () => queryOrUpdate,
|
|
25
|
+
objectListParserBuilder: () => objectListParserBuilder,
|
|
27
26
|
queryUnitParserBuilder: () => queryUnitParserBuilder,
|
|
28
27
|
sparql11ParserBuilder: () => sparql11ParserBuilder,
|
|
29
28
|
subSelectParserBuilder: () => subSelectParserBuilder,
|
|
@@ -362,10 +361,10 @@ var coreJsData = root_default["__core-js_shared__"];
|
|
|
362
361
|
var coreJsData_default = coreJsData;
|
|
363
362
|
|
|
364
363
|
// ../../node_modules/lodash-es/_isMasked.js
|
|
365
|
-
var maskSrcKey = function() {
|
|
364
|
+
var maskSrcKey = (function() {
|
|
366
365
|
var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || "");
|
|
367
366
|
return uid ? "Symbol(src)_1." + uid : "";
|
|
368
|
-
}();
|
|
367
|
+
})();
|
|
369
368
|
function isMasked(func) {
|
|
370
369
|
return !!maskSrcKey && maskSrcKey in func;
|
|
371
370
|
}
|
|
@@ -427,7 +426,7 @@ var WeakMap_default = WeakMap2;
|
|
|
427
426
|
|
|
428
427
|
// ../../node_modules/lodash-es/_baseCreate.js
|
|
429
428
|
var objectCreate = Object.create;
|
|
430
|
-
var baseCreate = /* @__PURE__ */ function() {
|
|
429
|
+
var baseCreate = /* @__PURE__ */ (function() {
|
|
431
430
|
function object2() {
|
|
432
431
|
}
|
|
433
432
|
return function(proto) {
|
|
@@ -442,7 +441,7 @@ var baseCreate = /* @__PURE__ */ function() {
|
|
|
442
441
|
object2.prototype = void 0;
|
|
443
442
|
return result;
|
|
444
443
|
};
|
|
445
|
-
}();
|
|
444
|
+
})();
|
|
446
445
|
var baseCreate_default = baseCreate;
|
|
447
446
|
|
|
448
447
|
// ../../node_modules/lodash-es/_apply.js
|
|
@@ -507,14 +506,14 @@ function constant(value) {
|
|
|
507
506
|
var constant_default = constant;
|
|
508
507
|
|
|
509
508
|
// ../../node_modules/lodash-es/_defineProperty.js
|
|
510
|
-
var defineProperty = function() {
|
|
509
|
+
var defineProperty = (function() {
|
|
511
510
|
try {
|
|
512
511
|
var func = getNative_default(Object, "defineProperty");
|
|
513
512
|
func({}, "", {});
|
|
514
513
|
return func;
|
|
515
514
|
} catch (e) {
|
|
516
515
|
}
|
|
517
|
-
}();
|
|
516
|
+
})();
|
|
518
517
|
var defineProperty_default = defineProperty;
|
|
519
518
|
|
|
520
519
|
// ../../node_modules/lodash-es/_baseSetToString.js
|
|
@@ -752,9 +751,9 @@ var baseIsArguments_default = baseIsArguments;
|
|
|
752
751
|
var objectProto6 = Object.prototype;
|
|
753
752
|
var hasOwnProperty4 = objectProto6.hasOwnProperty;
|
|
754
753
|
var propertyIsEnumerable = objectProto6.propertyIsEnumerable;
|
|
755
|
-
var isArguments = baseIsArguments_default(/* @__PURE__ */ function() {
|
|
754
|
+
var isArguments = baseIsArguments_default(/* @__PURE__ */ (function() {
|
|
756
755
|
return arguments;
|
|
757
|
-
}()) ? baseIsArguments_default : function(value) {
|
|
756
|
+
})()) ? baseIsArguments_default : function(value) {
|
|
758
757
|
return isObjectLike_default(value) && hasOwnProperty4.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
|
|
759
758
|
};
|
|
760
759
|
var isArguments_default = isArguments;
|
|
@@ -820,7 +819,7 @@ var freeExports2 = typeof exports == "object" && exports && !exports.nodeType &&
|
|
|
820
819
|
var freeModule2 = freeExports2 && typeof module == "object" && module && !module.nodeType && module;
|
|
821
820
|
var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
|
|
822
821
|
var freeProcess = moduleExports2 && freeGlobal_default.process;
|
|
823
|
-
var nodeUtil = function() {
|
|
822
|
+
var nodeUtil = (function() {
|
|
824
823
|
try {
|
|
825
824
|
var types = freeModule2 && freeModule2.require && freeModule2.require("util").types;
|
|
826
825
|
if (types) {
|
|
@@ -829,7 +828,7 @@ var nodeUtil = function() {
|
|
|
829
828
|
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
830
829
|
} catch (e) {
|
|
831
830
|
}
|
|
832
|
-
}();
|
|
831
|
+
})();
|
|
833
832
|
var nodeUtil_default = nodeUtil;
|
|
834
833
|
|
|
835
834
|
// ../../node_modules/lodash-es/isTypedArray.js
|
|
@@ -9381,6 +9380,7 @@ var EmbeddedActionsParser = class extends Parser {
|
|
|
9381
9380
|
|
|
9382
9381
|
// ../../packages/core/lib/lexer-builder/LexerBuilder.ts
|
|
9383
9382
|
var LexerBuilder = class _LexerBuilder {
|
|
9383
|
+
tokens;
|
|
9384
9384
|
static create(starter) {
|
|
9385
9385
|
return new _LexerBuilder(starter);
|
|
9386
9386
|
}
|
|
@@ -9477,6 +9477,7 @@ var LexerBuilder = class _LexerBuilder {
|
|
|
9477
9477
|
|
|
9478
9478
|
// ../../packages/core/lib/parser-builder/dynamicParser.ts
|
|
9479
9479
|
var DynamicParser = class extends EmbeddedActionsParser {
|
|
9480
|
+
context;
|
|
9480
9481
|
setContext(context) {
|
|
9481
9482
|
this.context = context;
|
|
9482
9483
|
}
|
|
@@ -9484,7 +9485,7 @@ var DynamicParser = class extends EmbeddedActionsParser {
|
|
|
9484
9485
|
super(tokenVocabulary, {
|
|
9485
9486
|
// RecoveryEnabled: true,
|
|
9486
9487
|
maxLookahead: 2,
|
|
9487
|
-
|
|
9488
|
+
skipValidations: true,
|
|
9488
9489
|
...config
|
|
9489
9490
|
});
|
|
9490
9491
|
this.context = void 0;
|
|
@@ -9499,7 +9500,7 @@ var DynamicParser = class extends EmbeddedActionsParser {
|
|
|
9499
9500
|
this.performSelfAnalysis();
|
|
9500
9501
|
}
|
|
9501
9502
|
constructSelfRef() {
|
|
9502
|
-
const subRuleImpl = (chevrotainSubrule) => (cstDef, ...arg) => chevrotainSubrule(this[cstDef.name], { ARGS: [this.context, ...arg] });
|
|
9503
|
+
const subRuleImpl = (chevrotainSubrule) => ((cstDef, ...arg) => chevrotainSubrule(this[cstDef.name], { ARGS: [this.context, ...arg] }));
|
|
9503
9504
|
return {
|
|
9504
9505
|
CONSUME: (tokenType, option) => this.CONSUME(tokenType, option),
|
|
9505
9506
|
CONSUME1: (tokenType, option) => this.CONSUME1(tokenType, option),
|
|
@@ -9606,6 +9607,7 @@ var ParserBuilder = class _ParserBuilder {
|
|
|
9606
9607
|
}
|
|
9607
9608
|
return new _ParserBuilder(listToRuleDefMap(start));
|
|
9608
9609
|
}
|
|
9610
|
+
rules;
|
|
9609
9611
|
constructor(startRules) {
|
|
9610
9612
|
this.rules = startRules;
|
|
9611
9613
|
}
|
|
@@ -9710,9 +9712,9 @@ ${firstError.message}`);
|
|
|
9710
9712
|
const lexer = LexerBuilder.create().add(...tokenVocabulary).build({
|
|
9711
9713
|
positionTracking: "full",
|
|
9712
9714
|
recoveryEnabled: false,
|
|
9713
|
-
|
|
9714
|
-
|
|
9715
|
-
|
|
9715
|
+
ensureOptimizations: true,
|
|
9716
|
+
safeMode: false,
|
|
9717
|
+
skipValidations: true,
|
|
9716
9718
|
...lexerConfig
|
|
9717
9719
|
});
|
|
9718
9720
|
const parser = this.consume({
|
|
@@ -9721,7 +9723,7 @@ ${firstError.message}`);
|
|
|
9721
9723
|
});
|
|
9722
9724
|
const selfSufficientParser = {};
|
|
9723
9725
|
for (const rule of Object.values(this.rules)) {
|
|
9724
|
-
selfSufficientParser[rule.name] = (input, context, ...args) => {
|
|
9726
|
+
selfSufficientParser[rule.name] = ((input, context, ...args) => {
|
|
9725
9727
|
const processedInput = queryPreProcessor(input);
|
|
9726
9728
|
const lexResult = lexer.tokenize(processedInput);
|
|
9727
9729
|
parser.input = lexResult.tokens;
|
|
@@ -9735,7 +9737,7 @@ ${firstError.message}`);
|
|
|
9735
9737
|
}
|
|
9736
9738
|
}
|
|
9737
9739
|
return result;
|
|
9738
|
-
};
|
|
9740
|
+
});
|
|
9739
9741
|
}
|
|
9740
9742
|
return selfSufficientParser;
|
|
9741
9743
|
}
|
|
@@ -9990,6 +9992,7 @@ __export(grammar_exports, {
|
|
|
9990
9992
|
quads: () => quads,
|
|
9991
9993
|
quadsNotTriples: () => quadsNotTriples,
|
|
9992
9994
|
query: () => query,
|
|
9995
|
+
queryOrUpdate: () => queryOrUpdate,
|
|
9993
9996
|
queryUnit: () => queryUnit,
|
|
9994
9997
|
rdfLiteral: () => rdfLiteral,
|
|
9995
9998
|
regexExpression: () => regexExpression,
|
|
@@ -10038,7 +10041,7 @@ __export(lexer_exports, {
|
|
|
10038
10041
|
ask: () => ask,
|
|
10039
10042
|
baseDecl: () => baseDecl,
|
|
10040
10043
|
bind: () => bind,
|
|
10041
|
-
builtIn: () =>
|
|
10044
|
+
builtIn: () => BuiltInCalls_exports,
|
|
10042
10045
|
by: () => by,
|
|
10043
10046
|
clear: () => clear,
|
|
10044
10047
|
construct: () => construct,
|
|
@@ -10075,7 +10078,7 @@ __export(lexer_exports, {
|
|
|
10075
10078
|
separator: () => separator,
|
|
10076
10079
|
service: () => service,
|
|
10077
10080
|
silent: () => silent,
|
|
10078
|
-
|
|
10081
|
+
sparql11LexerBuilder: () => sparql11LexerBuilder,
|
|
10079
10082
|
symbols: () => symbols_exports,
|
|
10080
10083
|
terminals: () => terminals_exports,
|
|
10081
10084
|
to: () => to,
|
|
@@ -10087,10 +10090,10 @@ __export(lexer_exports, {
|
|
|
10087
10090
|
where: () => where
|
|
10088
10091
|
});
|
|
10089
10092
|
|
|
10090
|
-
// ../../packages/rules-sparql-1-1/lib/lexer/
|
|
10091
|
-
var
|
|
10092
|
-
__export(
|
|
10093
|
-
|
|
10093
|
+
// ../../packages/rules-sparql-1-1/lib/lexer/BuiltInCalls.ts
|
|
10094
|
+
var BuiltInCalls_exports = {};
|
|
10095
|
+
__export(BuiltInCalls_exports, {
|
|
10096
|
+
BuiltInCalls: () => BuiltInCalls,
|
|
10094
10097
|
abs: () => abs,
|
|
10095
10098
|
allBuiltInCalls: () => allBuiltInCalls,
|
|
10096
10099
|
avg: () => avg,
|
|
@@ -10154,70 +10157,70 @@ __export(BuildinCalls_exports, {
|
|
|
10154
10157
|
uuid: () => uuid,
|
|
10155
10158
|
year: () => year
|
|
10156
10159
|
});
|
|
10157
|
-
var
|
|
10158
|
-
|
|
10159
|
-
|
|
10160
|
-
|
|
10161
|
-
|
|
10162
|
-
|
|
10163
|
-
|
|
10164
|
-
|
|
10165
|
-
|
|
10166
|
-
|
|
10167
|
-
|
|
10168
|
-
|
|
10169
|
-
|
|
10170
|
-
|
|
10171
|
-
|
|
10172
|
-
|
|
10173
|
-
|
|
10174
|
-
|
|
10175
|
-
|
|
10176
|
-
|
|
10177
|
-
|
|
10178
|
-
|
|
10179
|
-
|
|
10180
|
-
|
|
10181
|
-
|
|
10182
|
-
|
|
10183
|
-
|
|
10184
|
-
|
|
10185
|
-
|
|
10186
|
-
|
|
10187
|
-
|
|
10188
|
-
|
|
10189
|
-
|
|
10190
|
-
|
|
10191
|
-
|
|
10192
|
-
|
|
10193
|
-
|
|
10194
|
-
|
|
10195
|
-
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
|
|
10201
|
-
|
|
10202
|
-
|
|
10203
|
-
|
|
10204
|
-
|
|
10205
|
-
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
|
|
10209
|
-
|
|
10210
|
-
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
|
|
10218
|
-
|
|
10219
|
-
return
|
|
10220
|
-
})(
|
|
10160
|
+
var BuiltInCalls = /* @__PURE__ */ ((BuiltInCalls2) => {
|
|
10161
|
+
BuiltInCalls2["Str"] = "builtInStr";
|
|
10162
|
+
BuiltInCalls2["Lang"] = "builtInLang";
|
|
10163
|
+
BuiltInCalls2["Langmatches"] = "builtInLangmatches";
|
|
10164
|
+
BuiltInCalls2["Datatype"] = "builtInDatatype";
|
|
10165
|
+
BuiltInCalls2["Bound"] = "builtInBound";
|
|
10166
|
+
BuiltInCalls2["Iri"] = "builtInIri";
|
|
10167
|
+
BuiltInCalls2["Uri"] = "builtInUri";
|
|
10168
|
+
BuiltInCalls2["Bnode"] = "builtInBnode";
|
|
10169
|
+
BuiltInCalls2["Rand"] = "builtInRand";
|
|
10170
|
+
BuiltInCalls2["Abs"] = "builtInAbs";
|
|
10171
|
+
BuiltInCalls2["Ceil"] = "builtInCeil";
|
|
10172
|
+
BuiltInCalls2["Floor"] = "builtInFloor";
|
|
10173
|
+
BuiltInCalls2["Round"] = "builtInRound";
|
|
10174
|
+
BuiltInCalls2["Concat"] = "builtInConcat";
|
|
10175
|
+
BuiltInCalls2["Strlen"] = "builtInStrlen";
|
|
10176
|
+
BuiltInCalls2["Ucase"] = "builtInUcase";
|
|
10177
|
+
BuiltInCalls2["Lcase"] = "builtInLcase";
|
|
10178
|
+
BuiltInCalls2["Encode_for_uri"] = "builtInEncode_for_uri";
|
|
10179
|
+
BuiltInCalls2["Contains"] = "builtInContains";
|
|
10180
|
+
BuiltInCalls2["Strstarts"] = "builtInStrstarts";
|
|
10181
|
+
BuiltInCalls2["Strends"] = "builtInStrends";
|
|
10182
|
+
BuiltInCalls2["Strbefore"] = "builtInStrbefore";
|
|
10183
|
+
BuiltInCalls2["Strafter"] = "builtInStrafter";
|
|
10184
|
+
BuiltInCalls2["Year"] = "builtInYear";
|
|
10185
|
+
BuiltInCalls2["Month"] = "builtInMonth";
|
|
10186
|
+
BuiltInCalls2["Day"] = "builtInDay";
|
|
10187
|
+
BuiltInCalls2["Hours"] = "builtInHours";
|
|
10188
|
+
BuiltInCalls2["Minutes"] = "builtInMinutes";
|
|
10189
|
+
BuiltInCalls2["Seconds"] = "builtInSeconds";
|
|
10190
|
+
BuiltInCalls2["Timezone"] = "builtInTimezone";
|
|
10191
|
+
BuiltInCalls2["Tz"] = "builtInTz";
|
|
10192
|
+
BuiltInCalls2["Now"] = "builtInNow";
|
|
10193
|
+
BuiltInCalls2["Uuid"] = "builtInUuid";
|
|
10194
|
+
BuiltInCalls2["Struuid"] = "builtInStruuid";
|
|
10195
|
+
BuiltInCalls2["Md5"] = "builtInMd5";
|
|
10196
|
+
BuiltInCalls2["Sha1"] = "builtInSha1";
|
|
10197
|
+
BuiltInCalls2["Sha256"] = "builtInSha256";
|
|
10198
|
+
BuiltInCalls2["Sha384"] = "builtInSha384";
|
|
10199
|
+
BuiltInCalls2["Sha512"] = "builtInSha512";
|
|
10200
|
+
BuiltInCalls2["Coalesce"] = "builtInCoalesce";
|
|
10201
|
+
BuiltInCalls2["If"] = "builtInIf";
|
|
10202
|
+
BuiltInCalls2["Strlang"] = "builtInStrlang";
|
|
10203
|
+
BuiltInCalls2["Strdt"] = "builtInStrdt";
|
|
10204
|
+
BuiltInCalls2["Sameterm"] = "builtInSameterm";
|
|
10205
|
+
BuiltInCalls2["Isiri"] = "builtInIsiri";
|
|
10206
|
+
BuiltInCalls2["Isuri"] = "builtInIsuri";
|
|
10207
|
+
BuiltInCalls2["Isblank"] = "builtInIsblank";
|
|
10208
|
+
BuiltInCalls2["Isliteral"] = "builtInIsliteral";
|
|
10209
|
+
BuiltInCalls2["Isnumeric"] = "builtInIsnumeric";
|
|
10210
|
+
BuiltInCalls2["Regex"] = "builtInRegex";
|
|
10211
|
+
BuiltInCalls2["Substr"] = "builtInSubstr";
|
|
10212
|
+
BuiltInCalls2["Replace"] = "builtInReplace";
|
|
10213
|
+
BuiltInCalls2["Exists"] = "builtInExists";
|
|
10214
|
+
BuiltInCalls2["Notexists"] = "builtInNotexists";
|
|
10215
|
+
BuiltInCalls2["Count"] = "builtInCount";
|
|
10216
|
+
BuiltInCalls2["Sum"] = "builtInSum";
|
|
10217
|
+
BuiltInCalls2["Min"] = "builtInMin";
|
|
10218
|
+
BuiltInCalls2["Max"] = "builtInMax";
|
|
10219
|
+
BuiltInCalls2["Avg"] = "builtInAvg";
|
|
10220
|
+
BuiltInCalls2["Sample"] = "builtInSample";
|
|
10221
|
+
BuiltInCalls2["Group_concat"] = "builtInGroup_concat";
|
|
10222
|
+
return BuiltInCalls2;
|
|
10223
|
+
})(BuiltInCalls || {});
|
|
10221
10224
|
function capitalize(string2) {
|
|
10222
10225
|
return string2.charAt(0).toUpperCase() + string2.slice(1);
|
|
10223
10226
|
}
|
|
@@ -10721,7 +10724,7 @@ var allBaseTokens = LexerBuilder.create().add(
|
|
|
10721
10724
|
notIn,
|
|
10722
10725
|
separator
|
|
10723
10726
|
);
|
|
10724
|
-
var
|
|
10727
|
+
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);
|
|
10725
10728
|
|
|
10726
10729
|
// ../../packages/rules-sparql-1-1/lib/factoryMixins/ContextFactory.ts
|
|
10727
10730
|
var nodeType = "contextDef";
|
|
@@ -11166,10 +11169,7 @@ function SolutionModifiersFactoryMixin(Base) {
|
|
|
11166
11169
|
var nodeType8 = "term";
|
|
11167
11170
|
function TermFactoryMixin(Base) {
|
|
11168
11171
|
return class TermFactory extends Base {
|
|
11169
|
-
|
|
11170
|
-
super(...arguments);
|
|
11171
|
-
this.__blankNodeCounter = 0;
|
|
11172
|
-
}
|
|
11172
|
+
__blankNodeCounter = 0;
|
|
11173
11173
|
resetBlankNodeCounter() {
|
|
11174
11174
|
this.__blankNodeCounter = 0;
|
|
11175
11175
|
}
|
|
@@ -11908,6 +11908,120 @@ var verbA = {
|
|
|
11908
11908
|
}
|
|
11909
11909
|
};
|
|
11910
11910
|
|
|
11911
|
+
// ../../packages/rules-sparql-1-1/lib/grammar/general.ts
|
|
11912
|
+
var prologue = {
|
|
11913
|
+
name: "prologue",
|
|
11914
|
+
impl: ({ SUBRULE, MANY, OR }) => () => {
|
|
11915
|
+
const result = [];
|
|
11916
|
+
MANY(() => OR([
|
|
11917
|
+
{ ALT: () => result.push(SUBRULE(baseDecl2)) },
|
|
11918
|
+
// TODO: the [spec](https://www.w3.org/TR/sparql11-query/#iriRefs) says you cannot redefine prefixes.
|
|
11919
|
+
// We might need to check this.
|
|
11920
|
+
{ ALT: () => result.push(SUBRULE(prefixDecl2)) }
|
|
11921
|
+
]));
|
|
11922
|
+
return result;
|
|
11923
|
+
},
|
|
11924
|
+
gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => {
|
|
11925
|
+
for (const context of ast) {
|
|
11926
|
+
if (F2.isContextDefinitionBase(context)) {
|
|
11927
|
+
SUBRULE(baseDecl2, context);
|
|
11928
|
+
} else if (F2.isContextDefinitionPrefix(context)) {
|
|
11929
|
+
SUBRULE(prefixDecl2, context);
|
|
11930
|
+
}
|
|
11931
|
+
}
|
|
11932
|
+
}
|
|
11933
|
+
};
|
|
11934
|
+
var baseDecl2 = {
|
|
11935
|
+
name: "baseDecl",
|
|
11936
|
+
impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
|
|
11937
|
+
const base = CONSUME(baseDecl);
|
|
11938
|
+
const val = SUBRULE(iriFull);
|
|
11939
|
+
return ACTION(() => C.factory.contextDefinitionBase(C.factory.sourceLocation(base, val), val));
|
|
11940
|
+
},
|
|
11941
|
+
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
|
|
11942
|
+
F2.printFilter(ast, () => PRINT_WORD("BASE"));
|
|
11943
|
+
SUBRULE(iri2, ast.value);
|
|
11944
|
+
}
|
|
11945
|
+
};
|
|
11946
|
+
var prefixDecl2 = {
|
|
11947
|
+
name: "prefixDecl",
|
|
11948
|
+
impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
|
|
11949
|
+
const prefix = CONSUME(prefixDecl);
|
|
11950
|
+
const name = CONSUME(terminals_exports.pNameNs).image.slice(0, -1);
|
|
11951
|
+
const value = SUBRULE(iriFull);
|
|
11952
|
+
return ACTION(() => C.factory.contextDefinitionPrefix(C.factory.sourceLocation(prefix, value), name, value));
|
|
11953
|
+
},
|
|
11954
|
+
gImpl: ({ SUBRULE, PRINT_WORDS }) => (ast, { factory: F2 }) => {
|
|
11955
|
+
F2.printFilter(ast, () => {
|
|
11956
|
+
PRINT_WORDS("PREFIX", `${ast.key}:`);
|
|
11957
|
+
});
|
|
11958
|
+
SUBRULE(iri2, ast.value);
|
|
11959
|
+
}
|
|
11960
|
+
};
|
|
11961
|
+
var verb = {
|
|
11962
|
+
name: "verb",
|
|
11963
|
+
impl: ({ SUBRULE, OR }) => () => OR([
|
|
11964
|
+
{ ALT: () => SUBRULE(varOrIri) },
|
|
11965
|
+
{ ALT: () => SUBRULE(verbA) }
|
|
11966
|
+
])
|
|
11967
|
+
};
|
|
11968
|
+
var varOrTerm = {
|
|
11969
|
+
name: "varOrTerm",
|
|
11970
|
+
impl: ({ SUBRULE, OR }) => (C) => OR([
|
|
11971
|
+
{ GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(var_) },
|
|
11972
|
+
{ ALT: () => SUBRULE(graphTerm) }
|
|
11973
|
+
]),
|
|
11974
|
+
gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => {
|
|
11975
|
+
if (F2.isTermVariable(ast)) {
|
|
11976
|
+
return SUBRULE(var_, ast);
|
|
11977
|
+
}
|
|
11978
|
+
return SUBRULE(graphTerm, ast);
|
|
11979
|
+
}
|
|
11980
|
+
};
|
|
11981
|
+
var varOrIri = {
|
|
11982
|
+
name: "varOrIri",
|
|
11983
|
+
impl: ({ SUBRULE, OR }) => (C) => OR([
|
|
11984
|
+
{ GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(var_) },
|
|
11985
|
+
{ ALT: () => SUBRULE(iri2) }
|
|
11986
|
+
])
|
|
11987
|
+
};
|
|
11988
|
+
var var_ = {
|
|
11989
|
+
name: "var",
|
|
11990
|
+
impl: ({ ACTION, CONSUME, OR }) => (C) => {
|
|
11991
|
+
const varToken = OR([
|
|
11992
|
+
{ ALT: () => CONSUME(terminals_exports.var1) },
|
|
11993
|
+
{ ALT: () => CONSUME(terminals_exports.var2) }
|
|
11994
|
+
]);
|
|
11995
|
+
return ACTION(() => C.factory.variable(varToken.image.slice(1), C.factory.sourceLocation(varToken)));
|
|
11996
|
+
},
|
|
11997
|
+
gImpl: ({ PRINT_WORD }) => (ast, { factory: F2 }) => {
|
|
11998
|
+
F2.printFilter(ast, () => PRINT_WORD(`?${ast.value}`));
|
|
11999
|
+
}
|
|
12000
|
+
};
|
|
12001
|
+
var graphTerm = {
|
|
12002
|
+
name: "graphTerm",
|
|
12003
|
+
impl: ({ ACTION, SUBRULE, CONSUME, OR }) => (C) => OR([
|
|
12004
|
+
{ ALT: () => SUBRULE(iri2) },
|
|
12005
|
+
{ ALT: () => SUBRULE(rdfLiteral) },
|
|
12006
|
+
{ ALT: () => SUBRULE(numericLiteral) },
|
|
12007
|
+
{ ALT: () => SUBRULE(booleanLiteral) },
|
|
12008
|
+
{ GATE: () => C.parseMode.has("canCreateBlankNodes"), ALT: () => SUBRULE(blankNode) },
|
|
12009
|
+
{ ALT: () => {
|
|
12010
|
+
const tokenNil = CONSUME(terminals_exports.nil);
|
|
12011
|
+
return ACTION(() => C.factory.namedNode(C.factory.sourceLocation(tokenNil), "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" /* NIL */));
|
|
12012
|
+
} }
|
|
12013
|
+
]),
|
|
12014
|
+
gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => {
|
|
12015
|
+
if (F2.isTermNamed(ast)) {
|
|
12016
|
+
SUBRULE(iri2, ast);
|
|
12017
|
+
} else if (F2.isTermLiteral(ast)) {
|
|
12018
|
+
SUBRULE(rdfLiteral, ast);
|
|
12019
|
+
} else if (F2.isTermBlank(ast)) {
|
|
12020
|
+
SUBRULE(blankNode, ast);
|
|
12021
|
+
}
|
|
12022
|
+
}
|
|
12023
|
+
};
|
|
12024
|
+
|
|
11911
12025
|
// ../../packages/rules-sparql-1-1/lib/grammar/dataSetClause.ts
|
|
11912
12026
|
function datasetClauseUsing(name, token) {
|
|
11913
12027
|
return {
|
|
@@ -12163,55 +12277,55 @@ function baseAggregateFunc(func) {
|
|
|
12163
12277
|
}
|
|
12164
12278
|
|
|
12165
12279
|
// ../../packages/rules-sparql-1-1/lib/grammar/builtIn.ts
|
|
12166
|
-
var builtInStr = funcExpr1(
|
|
12167
|
-
var builtInLang = funcExpr1(
|
|
12168
|
-
var builtInLangmatches = funcExpr2(
|
|
12169
|
-
var builtInDatatype = funcExpr1(
|
|
12170
|
-
var builtInBound = funcVar1(
|
|
12171
|
-
var builtInIri = funcExpr1(
|
|
12172
|
-
var builtInUri = funcExpr1(
|
|
12173
|
-
var builtInBnodeSparqlJs = funcExprOrNil1(
|
|
12174
|
-
var builtInRand = funcNil1(
|
|
12175
|
-
var builtInAbs = funcExpr1(
|
|
12176
|
-
var builtInCeil = funcExpr1(
|
|
12177
|
-
var builtInFloor = funcExpr1(
|
|
12178
|
-
var builtInRound = funcExpr1(
|
|
12179
|
-
var builtInConcat = funcExprList1(
|
|
12180
|
-
var builtInStrlen = funcExpr1(
|
|
12181
|
-
var builtInUcase = funcExpr1(
|
|
12182
|
-
var builtInLcase = funcExpr1(
|
|
12183
|
-
var builtInEncode_for_uri = funcExpr1(
|
|
12184
|
-
var builtInContains = funcExpr2(
|
|
12185
|
-
var builtInStrstarts = funcExpr2(
|
|
12186
|
-
var builtInStrends = funcExpr2(
|
|
12187
|
-
var builtInStrbefore = funcExpr2(
|
|
12188
|
-
var builtInStrafter = funcExpr2(
|
|
12189
|
-
var builtInYear = funcExpr1(
|
|
12190
|
-
var builtInMonth = funcExpr1(
|
|
12191
|
-
var builtInDay = funcExpr1(
|
|
12192
|
-
var builtInHours = funcExpr1(
|
|
12193
|
-
var builtInMinutes = funcExpr1(
|
|
12194
|
-
var builtInSeconds = funcExpr1(
|
|
12195
|
-
var builtInTimezone = funcExpr1(
|
|
12196
|
-
var builtInTz = funcExpr1(
|
|
12197
|
-
var builtInNow = funcNil1(
|
|
12198
|
-
var builtInUuid = funcNil1(
|
|
12199
|
-
var builtInStruuid = funcNil1(
|
|
12200
|
-
var builtInMd5 = funcExpr1(
|
|
12201
|
-
var builtInSha1 = funcExpr1(
|
|
12202
|
-
var builtInSha256 = funcExpr1(
|
|
12203
|
-
var builtInSha384 = funcExpr1(
|
|
12204
|
-
var builtInSha512 = funcExpr1(
|
|
12205
|
-
var builtInCoalesce = funcExprList1(
|
|
12206
|
-
var builtInIf = funcExpr3(
|
|
12207
|
-
var builtInStrlang = funcExpr2(
|
|
12208
|
-
var builtInStrdt = funcExpr2(
|
|
12209
|
-
var builtInSameterm = funcExpr2(
|
|
12210
|
-
var builtInIsiri = funcExpr1(
|
|
12211
|
-
var builtInIsuri = funcExpr1(
|
|
12212
|
-
var builtInIsblank = funcExpr1(
|
|
12213
|
-
var builtInIsliteral = funcExpr1(
|
|
12214
|
-
var builtInIsnumeric = funcExpr1(
|
|
12280
|
+
var builtInStr = funcExpr1(BuiltInCalls_exports.str);
|
|
12281
|
+
var builtInLang = funcExpr1(BuiltInCalls_exports.lang);
|
|
12282
|
+
var builtInLangmatches = funcExpr2(BuiltInCalls_exports.langmatches);
|
|
12283
|
+
var builtInDatatype = funcExpr1(BuiltInCalls_exports.datatype);
|
|
12284
|
+
var builtInBound = funcVar1(BuiltInCalls_exports.bound);
|
|
12285
|
+
var builtInIri = funcExpr1(BuiltInCalls_exports.iri);
|
|
12286
|
+
var builtInUri = funcExpr1(BuiltInCalls_exports.uri);
|
|
12287
|
+
var builtInBnodeSparqlJs = funcExprOrNil1(BuiltInCalls_exports.bnode);
|
|
12288
|
+
var builtInRand = funcNil1(BuiltInCalls_exports.rand);
|
|
12289
|
+
var builtInAbs = funcExpr1(BuiltInCalls_exports.abs);
|
|
12290
|
+
var builtInCeil = funcExpr1(BuiltInCalls_exports.ceil);
|
|
12291
|
+
var builtInFloor = funcExpr1(BuiltInCalls_exports.floor);
|
|
12292
|
+
var builtInRound = funcExpr1(BuiltInCalls_exports.round);
|
|
12293
|
+
var builtInConcat = funcExprList1(BuiltInCalls_exports.concat);
|
|
12294
|
+
var builtInStrlen = funcExpr1(BuiltInCalls_exports.strlen);
|
|
12295
|
+
var builtInUcase = funcExpr1(BuiltInCalls_exports.ucase);
|
|
12296
|
+
var builtInLcase = funcExpr1(BuiltInCalls_exports.lcase);
|
|
12297
|
+
var builtInEncode_for_uri = funcExpr1(BuiltInCalls_exports.encode_for_uri);
|
|
12298
|
+
var builtInContains = funcExpr2(BuiltInCalls_exports.contains);
|
|
12299
|
+
var builtInStrstarts = funcExpr2(BuiltInCalls_exports.strstarts);
|
|
12300
|
+
var builtInStrends = funcExpr2(BuiltInCalls_exports.strends);
|
|
12301
|
+
var builtInStrbefore = funcExpr2(BuiltInCalls_exports.strbefore);
|
|
12302
|
+
var builtInStrafter = funcExpr2(BuiltInCalls_exports.strafter);
|
|
12303
|
+
var builtInYear = funcExpr1(BuiltInCalls_exports.year);
|
|
12304
|
+
var builtInMonth = funcExpr1(BuiltInCalls_exports.month);
|
|
12305
|
+
var builtInDay = funcExpr1(BuiltInCalls_exports.day);
|
|
12306
|
+
var builtInHours = funcExpr1(BuiltInCalls_exports.hours);
|
|
12307
|
+
var builtInMinutes = funcExpr1(BuiltInCalls_exports.minutes);
|
|
12308
|
+
var builtInSeconds = funcExpr1(BuiltInCalls_exports.seconds);
|
|
12309
|
+
var builtInTimezone = funcExpr1(BuiltInCalls_exports.timezone);
|
|
12310
|
+
var builtInTz = funcExpr1(BuiltInCalls_exports.tz);
|
|
12311
|
+
var builtInNow = funcNil1(BuiltInCalls_exports.now);
|
|
12312
|
+
var builtInUuid = funcNil1(BuiltInCalls_exports.uuid);
|
|
12313
|
+
var builtInStruuid = funcNil1(BuiltInCalls_exports.struuid);
|
|
12314
|
+
var builtInMd5 = funcExpr1(BuiltInCalls_exports.md5);
|
|
12315
|
+
var builtInSha1 = funcExpr1(BuiltInCalls_exports.sha1);
|
|
12316
|
+
var builtInSha256 = funcExpr1(BuiltInCalls_exports.sha256);
|
|
12317
|
+
var builtInSha384 = funcExpr1(BuiltInCalls_exports.sha384);
|
|
12318
|
+
var builtInSha512 = funcExpr1(BuiltInCalls_exports.sha512);
|
|
12319
|
+
var builtInCoalesce = funcExprList1(BuiltInCalls_exports.coalesce);
|
|
12320
|
+
var builtInIf = funcExpr3(BuiltInCalls_exports.if_);
|
|
12321
|
+
var builtInStrlang = funcExpr2(BuiltInCalls_exports.strlang);
|
|
12322
|
+
var builtInStrdt = funcExpr2(BuiltInCalls_exports.strdt);
|
|
12323
|
+
var builtInSameterm = funcExpr2(BuiltInCalls_exports.sameterm);
|
|
12324
|
+
var builtInIsiri = funcExpr1(BuiltInCalls_exports.isiri);
|
|
12325
|
+
var builtInIsuri = funcExpr1(BuiltInCalls_exports.isuri);
|
|
12326
|
+
var builtInIsblank = funcExpr1(BuiltInCalls_exports.isblank);
|
|
12327
|
+
var builtInIsliteral = funcExpr1(BuiltInCalls_exports.isliteral);
|
|
12328
|
+
var builtInIsnumeric = funcExpr1(BuiltInCalls_exports.isnumeric);
|
|
12215
12329
|
function builtInCallList(SUBRULE) {
|
|
12216
12330
|
return [
|
|
12217
12331
|
{ ALT: () => SUBRULE(aggregate) },
|
|
@@ -12283,15 +12397,15 @@ var builtInCall = {
|
|
|
12283
12397
|
return OR(builtIns);
|
|
12284
12398
|
}
|
|
12285
12399
|
};
|
|
12286
|
-
var regexExpression = funcExpr2or3(
|
|
12287
|
-
var substringExpression = funcExpr2or3(
|
|
12288
|
-
var strReplaceExpression = funcExpr3or4(
|
|
12289
|
-
var existsFunc = funcGroupGraphPattern(
|
|
12290
|
-
var notExistsFunc = funcGroupGraphPattern(
|
|
12400
|
+
var regexExpression = funcExpr2or3(BuiltInCalls_exports.regex);
|
|
12401
|
+
var substringExpression = funcExpr2or3(BuiltInCalls_exports.substr);
|
|
12402
|
+
var strReplaceExpression = funcExpr3or4(BuiltInCalls_exports.replace);
|
|
12403
|
+
var existsFunc = funcGroupGraphPattern(BuiltInCalls_exports.exists);
|
|
12404
|
+
var notExistsFunc = funcGroupGraphPattern(BuiltInCalls_exports.notexists);
|
|
12291
12405
|
var aggregateCount = {
|
|
12292
|
-
name: unCapitalize(
|
|
12406
|
+
name: unCapitalize(BuiltInCalls_exports.count.name),
|
|
12293
12407
|
impl: ({ ACTION, CONSUME, SUBRULE, OR, OPTION }) => (C) => {
|
|
12294
|
-
const operatorToken = CONSUME(
|
|
12408
|
+
const operatorToken = CONSUME(BuiltInCalls_exports.count);
|
|
12295
12409
|
CONSUME(symbols_exports.LParen);
|
|
12296
12410
|
const distinctToken = OPTION(() => CONSUME(distinct));
|
|
12297
12411
|
const expressionVal = OR([
|
|
@@ -12323,15 +12437,15 @@ var aggregateCount = {
|
|
|
12323
12437
|
});
|
|
12324
12438
|
}
|
|
12325
12439
|
};
|
|
12326
|
-
var aggregateSum = baseAggregateFunc(
|
|
12327
|
-
var aggregateMin = baseAggregateFunc(
|
|
12328
|
-
var aggregateMax = baseAggregateFunc(
|
|
12329
|
-
var aggregateAvg = baseAggregateFunc(
|
|
12330
|
-
var aggregateSample = baseAggregateFunc(
|
|
12440
|
+
var aggregateSum = baseAggregateFunc(BuiltInCalls_exports.sum);
|
|
12441
|
+
var aggregateMin = baseAggregateFunc(BuiltInCalls_exports.min);
|
|
12442
|
+
var aggregateMax = baseAggregateFunc(BuiltInCalls_exports.max);
|
|
12443
|
+
var aggregateAvg = baseAggregateFunc(BuiltInCalls_exports.avg);
|
|
12444
|
+
var aggregateSample = baseAggregateFunc(BuiltInCalls_exports.sample);
|
|
12331
12445
|
var aggregateGroup_concat = {
|
|
12332
|
-
name: unCapitalize(
|
|
12446
|
+
name: unCapitalize(BuiltInCalls_exports.groupConcat.name),
|
|
12333
12447
|
impl: ({ ACTION, CONSUME, OPTION1, SUBRULE, OPTION2 }) => (C) => {
|
|
12334
|
-
const operatorToken = CONSUME(
|
|
12448
|
+
const operatorToken = CONSUME(BuiltInCalls_exports.groupConcat);
|
|
12335
12449
|
CONSUME(symbols_exports.LParen);
|
|
12336
12450
|
const distinctToken = OPTION1(() => CONSUME(distinct));
|
|
12337
12451
|
const expr = SUBRULE(expression);
|
|
@@ -12399,120 +12513,6 @@ var aggregate = {
|
|
|
12399
12513
|
}
|
|
12400
12514
|
};
|
|
12401
12515
|
|
|
12402
|
-
// ../../packages/rules-sparql-1-1/lib/grammar/general.ts
|
|
12403
|
-
var prologue = {
|
|
12404
|
-
name: "prologue",
|
|
12405
|
-
impl: ({ SUBRULE, MANY, OR }) => () => {
|
|
12406
|
-
const result = [];
|
|
12407
|
-
MANY(() => OR([
|
|
12408
|
-
{ ALT: () => result.push(SUBRULE(baseDecl2)) },
|
|
12409
|
-
// TODO: the [spec](https://www.w3.org/TR/sparql11-query/#iriRefs) says you cannot redefine prefixes.
|
|
12410
|
-
// We might need to check this.
|
|
12411
|
-
{ ALT: () => result.push(SUBRULE(prefixDecl2)) }
|
|
12412
|
-
]));
|
|
12413
|
-
return result;
|
|
12414
|
-
},
|
|
12415
|
-
gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => {
|
|
12416
|
-
for (const context of ast) {
|
|
12417
|
-
if (F2.isContextDefinitionBase(context)) {
|
|
12418
|
-
SUBRULE(baseDecl2, context);
|
|
12419
|
-
} else if (F2.isContextDefinitionPrefix(context)) {
|
|
12420
|
-
SUBRULE(prefixDecl2, context);
|
|
12421
|
-
}
|
|
12422
|
-
}
|
|
12423
|
-
}
|
|
12424
|
-
};
|
|
12425
|
-
var baseDecl2 = {
|
|
12426
|
-
name: "baseDecl",
|
|
12427
|
-
impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
|
|
12428
|
-
const base = CONSUME(baseDecl);
|
|
12429
|
-
const val = SUBRULE(iriFull);
|
|
12430
|
-
return ACTION(() => C.factory.contextDefinitionBase(C.factory.sourceLocation(base, val), val));
|
|
12431
|
-
},
|
|
12432
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
|
|
12433
|
-
F2.printFilter(ast, () => PRINT_WORD("BASE"));
|
|
12434
|
-
SUBRULE(iri2, ast.value);
|
|
12435
|
-
}
|
|
12436
|
-
};
|
|
12437
|
-
var prefixDecl2 = {
|
|
12438
|
-
name: "prefixDecl",
|
|
12439
|
-
impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
|
|
12440
|
-
const prefix = CONSUME(prefixDecl);
|
|
12441
|
-
const name = CONSUME(terminals_exports.pNameNs).image.slice(0, -1);
|
|
12442
|
-
const value = SUBRULE(iriFull);
|
|
12443
|
-
return ACTION(() => C.factory.contextDefinitionPrefix(C.factory.sourceLocation(prefix, value), name, value));
|
|
12444
|
-
},
|
|
12445
|
-
gImpl: ({ SUBRULE, PRINT_WORDS }) => (ast, { factory: F2 }) => {
|
|
12446
|
-
F2.printFilter(ast, () => {
|
|
12447
|
-
PRINT_WORDS("PREFIX", `${ast.key}:`);
|
|
12448
|
-
});
|
|
12449
|
-
SUBRULE(iri2, ast.value);
|
|
12450
|
-
}
|
|
12451
|
-
};
|
|
12452
|
-
var verb = {
|
|
12453
|
-
name: "verb",
|
|
12454
|
-
impl: ({ SUBRULE, OR }) => () => OR([
|
|
12455
|
-
{ ALT: () => SUBRULE(varOrIri) },
|
|
12456
|
-
{ ALT: () => SUBRULE(verbA) }
|
|
12457
|
-
])
|
|
12458
|
-
};
|
|
12459
|
-
var varOrTerm = {
|
|
12460
|
-
name: "varOrTerm",
|
|
12461
|
-
impl: ({ SUBRULE, OR }) => (C) => OR([
|
|
12462
|
-
{ GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(var_) },
|
|
12463
|
-
{ ALT: () => SUBRULE(graphTerm) }
|
|
12464
|
-
]),
|
|
12465
|
-
gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => {
|
|
12466
|
-
if (F2.isTermVariable(ast)) {
|
|
12467
|
-
return SUBRULE(var_, ast);
|
|
12468
|
-
}
|
|
12469
|
-
return SUBRULE(graphTerm, ast);
|
|
12470
|
-
}
|
|
12471
|
-
};
|
|
12472
|
-
var varOrIri = {
|
|
12473
|
-
name: "varOrIri",
|
|
12474
|
-
impl: ({ SUBRULE, OR }) => (C) => OR([
|
|
12475
|
-
{ GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(var_) },
|
|
12476
|
-
{ ALT: () => SUBRULE(iri2) }
|
|
12477
|
-
])
|
|
12478
|
-
};
|
|
12479
|
-
var var_ = {
|
|
12480
|
-
name: "var",
|
|
12481
|
-
impl: ({ ACTION, CONSUME, OR }) => (C) => {
|
|
12482
|
-
const varToken = OR([
|
|
12483
|
-
{ ALT: () => CONSUME(terminals_exports.var1) },
|
|
12484
|
-
{ ALT: () => CONSUME(terminals_exports.var2) }
|
|
12485
|
-
]);
|
|
12486
|
-
return ACTION(() => C.factory.variable(varToken.image.slice(1), C.factory.sourceLocation(varToken)));
|
|
12487
|
-
},
|
|
12488
|
-
gImpl: ({ PRINT_WORD }) => (ast, { factory: F2 }) => {
|
|
12489
|
-
F2.printFilter(ast, () => PRINT_WORD(`?${ast.value}`));
|
|
12490
|
-
}
|
|
12491
|
-
};
|
|
12492
|
-
var graphTerm = {
|
|
12493
|
-
name: "graphTerm",
|
|
12494
|
-
impl: ({ ACTION, SUBRULE, CONSUME, OR }) => (C) => OR([
|
|
12495
|
-
{ ALT: () => SUBRULE(iri2) },
|
|
12496
|
-
{ ALT: () => SUBRULE(rdfLiteral) },
|
|
12497
|
-
{ ALT: () => SUBRULE(numericLiteral) },
|
|
12498
|
-
{ ALT: () => SUBRULE(booleanLiteral) },
|
|
12499
|
-
{ GATE: () => C.parseMode.has("canCreateBlankNodes"), ALT: () => SUBRULE(blankNode) },
|
|
12500
|
-
{ ALT: () => {
|
|
12501
|
-
const tokenNil = CONSUME(terminals_exports.nil);
|
|
12502
|
-
return ACTION(() => C.factory.namedNode(C.factory.sourceLocation(tokenNil), "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" /* NIL */));
|
|
12503
|
-
} }
|
|
12504
|
-
]),
|
|
12505
|
-
gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => {
|
|
12506
|
-
if (F2.isTermNamed(ast)) {
|
|
12507
|
-
SUBRULE(iri2, ast);
|
|
12508
|
-
} else if (F2.isTermLiteral(ast)) {
|
|
12509
|
-
SUBRULE(rdfLiteral, ast);
|
|
12510
|
-
} else if (F2.isTermBlank(ast)) {
|
|
12511
|
-
SUBRULE(blankNode, ast);
|
|
12512
|
-
}
|
|
12513
|
-
}
|
|
12514
|
-
};
|
|
12515
|
-
|
|
12516
12516
|
// ../../packages/rules-sparql-1-1/lib/grammar/propertyPaths.ts
|
|
12517
12517
|
var path = {
|
|
12518
12518
|
name: "path",
|
|
@@ -14768,7 +14768,69 @@ var quadsNotTriples = {
|
|
|
14768
14768
|
}
|
|
14769
14769
|
};
|
|
14770
14770
|
|
|
14771
|
-
// ../../packages/rules-sparql-1-1/lib/
|
|
14771
|
+
// ../../packages/rules-sparql-1-1/lib/grammar/index.ts
|
|
14772
|
+
var queryOrUpdate = {
|
|
14773
|
+
name: "queryOrUpdate",
|
|
14774
|
+
impl: ({ ACTION, SUBRULE, OR1, OR2, MANY, OPTION1, CONSUME, SUBRULE2 }) => (C) => {
|
|
14775
|
+
const prologueValues = SUBRULE(prologue);
|
|
14776
|
+
return OR1([
|
|
14777
|
+
{ ALT: () => {
|
|
14778
|
+
const subType = OR2([
|
|
14779
|
+
{ ALT: () => SUBRULE(selectQuery) },
|
|
14780
|
+
{ ALT: () => SUBRULE(constructQuery) },
|
|
14781
|
+
{ ALT: () => SUBRULE(describeQuery) },
|
|
14782
|
+
{ ALT: () => SUBRULE(askQuery) }
|
|
14783
|
+
]);
|
|
14784
|
+
const values3 = SUBRULE(valuesClause);
|
|
14785
|
+
return ACTION(() => ({
|
|
14786
|
+
context: prologueValues,
|
|
14787
|
+
...subType,
|
|
14788
|
+
type: "query",
|
|
14789
|
+
...values3 && { values: values3 },
|
|
14790
|
+
loc: C.factory.sourceLocation(
|
|
14791
|
+
prologueValues.at(0),
|
|
14792
|
+
subType,
|
|
14793
|
+
values3
|
|
14794
|
+
)
|
|
14795
|
+
}));
|
|
14796
|
+
} },
|
|
14797
|
+
{ ALT: () => {
|
|
14798
|
+
const updates = [];
|
|
14799
|
+
updates.push({ context: prologueValues });
|
|
14800
|
+
let parsedSemi = true;
|
|
14801
|
+
MANY({
|
|
14802
|
+
GATE: () => parsedSemi,
|
|
14803
|
+
DEF: () => {
|
|
14804
|
+
parsedSemi = false;
|
|
14805
|
+
updates.at(-1).operation = SUBRULE(update1);
|
|
14806
|
+
OPTION1(() => {
|
|
14807
|
+
CONSUME(symbols_exports.semi);
|
|
14808
|
+
parsedSemi = true;
|
|
14809
|
+
const innerPrologue = SUBRULE2(prologue);
|
|
14810
|
+
updates.push({ context: innerPrologue });
|
|
14811
|
+
});
|
|
14812
|
+
}
|
|
14813
|
+
});
|
|
14814
|
+
return ACTION(() => {
|
|
14815
|
+
const update2 = {
|
|
14816
|
+
type: "update",
|
|
14817
|
+
updates,
|
|
14818
|
+
loc: C.factory.sourceLocation(
|
|
14819
|
+
...updates[0].context,
|
|
14820
|
+
updates[0].operation,
|
|
14821
|
+
...updates.at(-1).context,
|
|
14822
|
+
updates.at(-1)?.operation
|
|
14823
|
+
)
|
|
14824
|
+
};
|
|
14825
|
+
updateNoReuseBlankNodeLabels(update2);
|
|
14826
|
+
return update2;
|
|
14827
|
+
});
|
|
14828
|
+
} }
|
|
14829
|
+
]);
|
|
14830
|
+
}
|
|
14831
|
+
};
|
|
14832
|
+
|
|
14833
|
+
// ../../packages/rules-sparql-1-1/lib/MinimalSparqlParser.ts
|
|
14772
14834
|
function completeParseContext(context) {
|
|
14773
14835
|
return {
|
|
14774
14836
|
factory: context.factory ?? new Factory(),
|
|
@@ -14780,11 +14842,11 @@ function completeParseContext(context) {
|
|
|
14780
14842
|
skipValidation: context.skipValidation ?? false
|
|
14781
14843
|
};
|
|
14782
14844
|
}
|
|
14783
|
-
var
|
|
14845
|
+
var MinimalSparqlParser = class {
|
|
14784
14846
|
constructor(parser) {
|
|
14785
14847
|
this.parser = parser;
|
|
14786
|
-
this.F = new Factory();
|
|
14787
14848
|
}
|
|
14849
|
+
F = new Factory();
|
|
14788
14850
|
parse(query2, context = {}) {
|
|
14789
14851
|
return this.parser.queryOrUpdate(query2, completeParseContext(context));
|
|
14790
14852
|
}
|
|
@@ -14923,7 +14985,7 @@ var rules = [
|
|
|
14923
14985
|
grammar_exports.numericLiteralPositive,
|
|
14924
14986
|
grammar_exports.numericLiteralNegative
|
|
14925
14987
|
];
|
|
14926
|
-
var
|
|
14988
|
+
var objectListParserBuilder = ParserBuilder.create(rules);
|
|
14927
14989
|
|
|
14928
14990
|
// lib/triplesBlockParser.ts
|
|
14929
14991
|
var triplesBlockParserBuilder = ParserBuilder.create([
|
|
@@ -14937,7 +14999,7 @@ var triplesBlockParserBuilder = ParserBuilder.create([
|
|
|
14937
14999
|
grammar_exports.verbPath,
|
|
14938
15000
|
grammar_exports.verbSimple,
|
|
14939
15001
|
grammar_exports.objectListPath
|
|
14940
|
-
]).merge(
|
|
15002
|
+
]).merge(objectListParserBuilder, []).addMany(
|
|
14941
15003
|
grammar_exports.path,
|
|
14942
15004
|
grammar_exports.pathAlternative,
|
|
14943
15005
|
grammar_exports.pathSequence,
|
|
@@ -15097,74 +15159,14 @@ var updateParserBuilder = ParserBuilder.create(updateNoModifyParserBuilder).patc
|
|
|
15097
15159
|
grammar_exports.sourceSelector,
|
|
15098
15160
|
grammar_exports.usingClauseStar,
|
|
15099
15161
|
grammar_exports.groupGraphPattern
|
|
15100
|
-
).merge(
|
|
15162
|
+
).merge(objectListParserBuilder, []).merge(subSelectParserBuilder, []);
|
|
15101
15163
|
|
|
15102
15164
|
// lib/Parser.ts
|
|
15103
|
-
var
|
|
15104
|
-
|
|
15105
|
-
impl: ({ ACTION, SUBRULE, OR1, OR2, MANY, OPTION1, CONSUME, SUBRULE2 }) => (C) => {
|
|
15106
|
-
const prologueValues = SUBRULE(grammar_exports.prologue);
|
|
15107
|
-
return OR1([
|
|
15108
|
-
{ ALT: () => {
|
|
15109
|
-
const subType = OR2([
|
|
15110
|
-
{ ALT: () => SUBRULE(grammar_exports.selectQuery) },
|
|
15111
|
-
{ ALT: () => SUBRULE(grammar_exports.constructQuery) },
|
|
15112
|
-
{ ALT: () => SUBRULE(grammar_exports.describeQuery) },
|
|
15113
|
-
{ ALT: () => SUBRULE(grammar_exports.askQuery) }
|
|
15114
|
-
]);
|
|
15115
|
-
const values3 = SUBRULE(grammar_exports.valuesClause);
|
|
15116
|
-
return ACTION(() => ({
|
|
15117
|
-
context: prologueValues,
|
|
15118
|
-
...subType,
|
|
15119
|
-
type: "query",
|
|
15120
|
-
...values3 && { values: values3 },
|
|
15121
|
-
loc: C.factory.sourceLocation(
|
|
15122
|
-
prologueValues.at(0),
|
|
15123
|
-
subType,
|
|
15124
|
-
values3
|
|
15125
|
-
)
|
|
15126
|
-
}));
|
|
15127
|
-
} },
|
|
15128
|
-
{ ALT: () => {
|
|
15129
|
-
const updates = [];
|
|
15130
|
-
updates.push({ context: prologueValues });
|
|
15131
|
-
let parsedSemi = true;
|
|
15132
|
-
MANY({
|
|
15133
|
-
GATE: () => parsedSemi,
|
|
15134
|
-
DEF: () => {
|
|
15135
|
-
parsedSemi = false;
|
|
15136
|
-
updates.at(-1).operation = SUBRULE(grammar_exports.update1);
|
|
15137
|
-
OPTION1(() => {
|
|
15138
|
-
CONSUME(lexer_exports.symbols.semi);
|
|
15139
|
-
parsedSemi = true;
|
|
15140
|
-
const innerPrologue = SUBRULE2(grammar_exports.prologue);
|
|
15141
|
-
updates.push({ context: innerPrologue });
|
|
15142
|
-
});
|
|
15143
|
-
}
|
|
15144
|
-
});
|
|
15145
|
-
return ACTION(() => {
|
|
15146
|
-
const update2 = {
|
|
15147
|
-
type: "update",
|
|
15148
|
-
updates,
|
|
15149
|
-
loc: C.factory.sourceLocation(
|
|
15150
|
-
...updates[0].context,
|
|
15151
|
-
updates[0].operation,
|
|
15152
|
-
...updates.at(-1).context,
|
|
15153
|
-
updates.at(-1)?.operation
|
|
15154
|
-
)
|
|
15155
|
-
};
|
|
15156
|
-
updateNoReuseBlankNodeLabels(update2);
|
|
15157
|
-
return update2;
|
|
15158
|
-
});
|
|
15159
|
-
} }
|
|
15160
|
-
]);
|
|
15161
|
-
}
|
|
15162
|
-
};
|
|
15163
|
-
var sparql11ParserBuilder = ParserBuilder.create(queryUnitParserBuilder).merge(updateParserBuilder, []).addRule(queryOrUpdate);
|
|
15164
|
-
var Parser2 = class extends SparqlParser {
|
|
15165
|
+
var sparql11ParserBuilder = ParserBuilder.create(queryUnitParserBuilder).merge(updateParserBuilder, []).addRule(grammar_exports.queryOrUpdate);
|
|
15166
|
+
var Parser2 = class extends MinimalSparqlParser {
|
|
15165
15167
|
constructor() {
|
|
15166
15168
|
const parser = sparql11ParserBuilder.build({
|
|
15167
|
-
tokenVocabulary: lexer_exports.
|
|
15169
|
+
tokenVocabulary: lexer_exports.sparql11LexerBuilder.tokenVocabulary,
|
|
15168
15170
|
queryPreProcessor: sparqlCodepointEscape
|
|
15169
15171
|
});
|
|
15170
15172
|
super(parser);
|