@traqula/parser-sparql-1-1-adjust 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/lib/Parser.d.ts +77 -77
- package/lib/Parser.js +9 -15
- package/lib/Parser.js.map +1 -1
- package/lib/index.cjs +353 -354
- package/package.json +8 -8
package/lib/index.cjs
CHANGED
|
@@ -21,8 +21,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
Parser: () => Parser2,
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
adjustLexerBuilder: () => adjustLexerBuilder,
|
|
25
|
+
adjustParserBuilder: () => adjustParserBuilder
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(index_exports);
|
|
28
28
|
|
|
@@ -354,10 +354,10 @@ var coreJsData = root_default["__core-js_shared__"];
|
|
|
354
354
|
var coreJsData_default = coreJsData;
|
|
355
355
|
|
|
356
356
|
// ../../node_modules/lodash-es/_isMasked.js
|
|
357
|
-
var maskSrcKey = function() {
|
|
357
|
+
var maskSrcKey = (function() {
|
|
358
358
|
var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || "");
|
|
359
359
|
return uid ? "Symbol(src)_1." + uid : "";
|
|
360
|
-
}();
|
|
360
|
+
})();
|
|
361
361
|
function isMasked(func) {
|
|
362
362
|
return !!maskSrcKey && maskSrcKey in func;
|
|
363
363
|
}
|
|
@@ -419,7 +419,7 @@ var WeakMap_default = WeakMap2;
|
|
|
419
419
|
|
|
420
420
|
// ../../node_modules/lodash-es/_baseCreate.js
|
|
421
421
|
var objectCreate = Object.create;
|
|
422
|
-
var baseCreate = /* @__PURE__ */ function() {
|
|
422
|
+
var baseCreate = /* @__PURE__ */ (function() {
|
|
423
423
|
function object2() {
|
|
424
424
|
}
|
|
425
425
|
return function(proto) {
|
|
@@ -434,7 +434,7 @@ var baseCreate = /* @__PURE__ */ function() {
|
|
|
434
434
|
object2.prototype = void 0;
|
|
435
435
|
return result;
|
|
436
436
|
};
|
|
437
|
-
}();
|
|
437
|
+
})();
|
|
438
438
|
var baseCreate_default = baseCreate;
|
|
439
439
|
|
|
440
440
|
// ../../node_modules/lodash-es/_apply.js
|
|
@@ -499,14 +499,14 @@ function constant(value) {
|
|
|
499
499
|
var constant_default = constant;
|
|
500
500
|
|
|
501
501
|
// ../../node_modules/lodash-es/_defineProperty.js
|
|
502
|
-
var defineProperty = function() {
|
|
502
|
+
var defineProperty = (function() {
|
|
503
503
|
try {
|
|
504
504
|
var func = getNative_default(Object, "defineProperty");
|
|
505
505
|
func({}, "", {});
|
|
506
506
|
return func;
|
|
507
507
|
} catch (e) {
|
|
508
508
|
}
|
|
509
|
-
}();
|
|
509
|
+
})();
|
|
510
510
|
var defineProperty_default = defineProperty;
|
|
511
511
|
|
|
512
512
|
// ../../node_modules/lodash-es/_baseSetToString.js
|
|
@@ -744,9 +744,9 @@ var baseIsArguments_default = baseIsArguments;
|
|
|
744
744
|
var objectProto6 = Object.prototype;
|
|
745
745
|
var hasOwnProperty4 = objectProto6.hasOwnProperty;
|
|
746
746
|
var propertyIsEnumerable = objectProto6.propertyIsEnumerable;
|
|
747
|
-
var isArguments = baseIsArguments_default(/* @__PURE__ */ function() {
|
|
747
|
+
var isArguments = baseIsArguments_default(/* @__PURE__ */ (function() {
|
|
748
748
|
return arguments;
|
|
749
|
-
}()) ? baseIsArguments_default : function(value) {
|
|
749
|
+
})()) ? baseIsArguments_default : function(value) {
|
|
750
750
|
return isObjectLike_default(value) && hasOwnProperty4.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
|
|
751
751
|
};
|
|
752
752
|
var isArguments_default = isArguments;
|
|
@@ -812,7 +812,7 @@ var freeExports2 = typeof exports == "object" && exports && !exports.nodeType &&
|
|
|
812
812
|
var freeModule2 = freeExports2 && typeof module == "object" && module && !module.nodeType && module;
|
|
813
813
|
var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
|
|
814
814
|
var freeProcess = moduleExports2 && freeGlobal_default.process;
|
|
815
|
-
var nodeUtil = function() {
|
|
815
|
+
var nodeUtil = (function() {
|
|
816
816
|
try {
|
|
817
817
|
var types = freeModule2 && freeModule2.require && freeModule2.require("util").types;
|
|
818
818
|
if (types) {
|
|
@@ -821,7 +821,7 @@ var nodeUtil = function() {
|
|
|
821
821
|
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
822
822
|
} catch (e) {
|
|
823
823
|
}
|
|
824
|
-
}();
|
|
824
|
+
})();
|
|
825
825
|
var nodeUtil_default = nodeUtil;
|
|
826
826
|
|
|
827
827
|
// ../../node_modules/lodash-es/isTypedArray.js
|
|
@@ -9373,6 +9373,7 @@ var EmbeddedActionsParser = class extends Parser {
|
|
|
9373
9373
|
|
|
9374
9374
|
// ../../packages/core/lib/lexer-builder/LexerBuilder.ts
|
|
9375
9375
|
var LexerBuilder = class _LexerBuilder {
|
|
9376
|
+
tokens;
|
|
9376
9377
|
static create(starter) {
|
|
9377
9378
|
return new _LexerBuilder(starter);
|
|
9378
9379
|
}
|
|
@@ -9469,6 +9470,7 @@ var LexerBuilder = class _LexerBuilder {
|
|
|
9469
9470
|
|
|
9470
9471
|
// ../../packages/core/lib/parser-builder/dynamicParser.ts
|
|
9471
9472
|
var DynamicParser = class extends EmbeddedActionsParser {
|
|
9473
|
+
context;
|
|
9472
9474
|
setContext(context) {
|
|
9473
9475
|
this.context = context;
|
|
9474
9476
|
}
|
|
@@ -9476,7 +9478,7 @@ var DynamicParser = class extends EmbeddedActionsParser {
|
|
|
9476
9478
|
super(tokenVocabulary, {
|
|
9477
9479
|
// RecoveryEnabled: true,
|
|
9478
9480
|
maxLookahead: 2,
|
|
9479
|
-
|
|
9481
|
+
skipValidations: true,
|
|
9480
9482
|
...config
|
|
9481
9483
|
});
|
|
9482
9484
|
this.context = void 0;
|
|
@@ -9491,7 +9493,7 @@ var DynamicParser = class extends EmbeddedActionsParser {
|
|
|
9491
9493
|
this.performSelfAnalysis();
|
|
9492
9494
|
}
|
|
9493
9495
|
constructSelfRef() {
|
|
9494
|
-
const subRuleImpl = (chevrotainSubrule) => (cstDef, ...arg) => chevrotainSubrule(this[cstDef.name], { ARGS: [this.context, ...arg] });
|
|
9496
|
+
const subRuleImpl = (chevrotainSubrule) => ((cstDef, ...arg) => chevrotainSubrule(this[cstDef.name], { ARGS: [this.context, ...arg] }));
|
|
9495
9497
|
return {
|
|
9496
9498
|
CONSUME: (tokenType, option) => this.CONSUME(tokenType, option),
|
|
9497
9499
|
CONSUME1: (tokenType, option) => this.CONSUME1(tokenType, option),
|
|
@@ -9598,6 +9600,7 @@ var ParserBuilder = class _ParserBuilder {
|
|
|
9598
9600
|
}
|
|
9599
9601
|
return new _ParserBuilder(listToRuleDefMap(start));
|
|
9600
9602
|
}
|
|
9603
|
+
rules;
|
|
9601
9604
|
constructor(startRules) {
|
|
9602
9605
|
this.rules = startRules;
|
|
9603
9606
|
}
|
|
@@ -9702,9 +9705,9 @@ ${firstError.message}`);
|
|
|
9702
9705
|
const lexer = LexerBuilder.create().add(...tokenVocabulary).build({
|
|
9703
9706
|
positionTracking: "full",
|
|
9704
9707
|
recoveryEnabled: false,
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
|
|
9708
|
+
ensureOptimizations: true,
|
|
9709
|
+
safeMode: false,
|
|
9710
|
+
skipValidations: true,
|
|
9708
9711
|
...lexerConfig
|
|
9709
9712
|
});
|
|
9710
9713
|
const parser = this.consume({
|
|
@@ -9713,7 +9716,7 @@ ${firstError.message}`);
|
|
|
9713
9716
|
});
|
|
9714
9717
|
const selfSufficientParser = {};
|
|
9715
9718
|
for (const rule of Object.values(this.rules)) {
|
|
9716
|
-
selfSufficientParser[rule.name] = (input, context, ...args) => {
|
|
9719
|
+
selfSufficientParser[rule.name] = ((input, context, ...args) => {
|
|
9717
9720
|
const processedInput = queryPreProcessor(input);
|
|
9718
9721
|
const lexResult = lexer.tokenize(processedInput);
|
|
9719
9722
|
parser.input = lexResult.tokens;
|
|
@@ -9727,7 +9730,7 @@ ${firstError.message}`);
|
|
|
9727
9730
|
}
|
|
9728
9731
|
}
|
|
9729
9732
|
return result;
|
|
9730
|
-
};
|
|
9733
|
+
});
|
|
9731
9734
|
}
|
|
9732
9735
|
return selfSufficientParser;
|
|
9733
9736
|
}
|
|
@@ -9982,6 +9985,7 @@ __export(grammar_exports, {
|
|
|
9982
9985
|
quads: () => quads,
|
|
9983
9986
|
quadsNotTriples: () => quadsNotTriples,
|
|
9984
9987
|
query: () => query,
|
|
9988
|
+
queryOrUpdate: () => queryOrUpdate,
|
|
9985
9989
|
queryUnit: () => queryUnit,
|
|
9986
9990
|
rdfLiteral: () => rdfLiteral,
|
|
9987
9991
|
regexExpression: () => regexExpression,
|
|
@@ -10030,7 +10034,7 @@ __export(lexer_exports, {
|
|
|
10030
10034
|
ask: () => ask,
|
|
10031
10035
|
baseDecl: () => baseDecl,
|
|
10032
10036
|
bind: () => bind,
|
|
10033
|
-
builtIn: () =>
|
|
10037
|
+
builtIn: () => BuiltInCalls_exports,
|
|
10034
10038
|
by: () => by,
|
|
10035
10039
|
clear: () => clear,
|
|
10036
10040
|
construct: () => construct,
|
|
@@ -10067,7 +10071,7 @@ __export(lexer_exports, {
|
|
|
10067
10071
|
separator: () => separator,
|
|
10068
10072
|
service: () => service,
|
|
10069
10073
|
silent: () => silent,
|
|
10070
|
-
|
|
10074
|
+
sparql11LexerBuilder: () => sparql11LexerBuilder,
|
|
10071
10075
|
symbols: () => symbols_exports,
|
|
10072
10076
|
terminals: () => terminals_exports,
|
|
10073
10077
|
to: () => to,
|
|
@@ -10079,10 +10083,10 @@ __export(lexer_exports, {
|
|
|
10079
10083
|
where: () => where
|
|
10080
10084
|
});
|
|
10081
10085
|
|
|
10082
|
-
// ../../packages/rules-sparql-1-1/lib/lexer/
|
|
10083
|
-
var
|
|
10084
|
-
__export(
|
|
10085
|
-
|
|
10086
|
+
// ../../packages/rules-sparql-1-1/lib/lexer/BuiltInCalls.ts
|
|
10087
|
+
var BuiltInCalls_exports = {};
|
|
10088
|
+
__export(BuiltInCalls_exports, {
|
|
10089
|
+
BuiltInCalls: () => BuiltInCalls,
|
|
10086
10090
|
abs: () => abs,
|
|
10087
10091
|
allBuiltInCalls: () => allBuiltInCalls,
|
|
10088
10092
|
avg: () => avg,
|
|
@@ -10146,70 +10150,70 @@ __export(BuildinCalls_exports, {
|
|
|
10146
10150
|
uuid: () => uuid,
|
|
10147
10151
|
year: () => year
|
|
10148
10152
|
});
|
|
10149
|
-
var
|
|
10150
|
-
|
|
10151
|
-
|
|
10152
|
-
|
|
10153
|
-
|
|
10154
|
-
|
|
10155
|
-
|
|
10156
|
-
|
|
10157
|
-
|
|
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
|
-
return
|
|
10212
|
-
})(
|
|
10153
|
+
var BuiltInCalls = /* @__PURE__ */ ((BuiltInCalls2) => {
|
|
10154
|
+
BuiltInCalls2["Str"] = "builtInStr";
|
|
10155
|
+
BuiltInCalls2["Lang"] = "builtInLang";
|
|
10156
|
+
BuiltInCalls2["Langmatches"] = "builtInLangmatches";
|
|
10157
|
+
BuiltInCalls2["Datatype"] = "builtInDatatype";
|
|
10158
|
+
BuiltInCalls2["Bound"] = "builtInBound";
|
|
10159
|
+
BuiltInCalls2["Iri"] = "builtInIri";
|
|
10160
|
+
BuiltInCalls2["Uri"] = "builtInUri";
|
|
10161
|
+
BuiltInCalls2["Bnode"] = "builtInBnode";
|
|
10162
|
+
BuiltInCalls2["Rand"] = "builtInRand";
|
|
10163
|
+
BuiltInCalls2["Abs"] = "builtInAbs";
|
|
10164
|
+
BuiltInCalls2["Ceil"] = "builtInCeil";
|
|
10165
|
+
BuiltInCalls2["Floor"] = "builtInFloor";
|
|
10166
|
+
BuiltInCalls2["Round"] = "builtInRound";
|
|
10167
|
+
BuiltInCalls2["Concat"] = "builtInConcat";
|
|
10168
|
+
BuiltInCalls2["Strlen"] = "builtInStrlen";
|
|
10169
|
+
BuiltInCalls2["Ucase"] = "builtInUcase";
|
|
10170
|
+
BuiltInCalls2["Lcase"] = "builtInLcase";
|
|
10171
|
+
BuiltInCalls2["Encode_for_uri"] = "builtInEncode_for_uri";
|
|
10172
|
+
BuiltInCalls2["Contains"] = "builtInContains";
|
|
10173
|
+
BuiltInCalls2["Strstarts"] = "builtInStrstarts";
|
|
10174
|
+
BuiltInCalls2["Strends"] = "builtInStrends";
|
|
10175
|
+
BuiltInCalls2["Strbefore"] = "builtInStrbefore";
|
|
10176
|
+
BuiltInCalls2["Strafter"] = "builtInStrafter";
|
|
10177
|
+
BuiltInCalls2["Year"] = "builtInYear";
|
|
10178
|
+
BuiltInCalls2["Month"] = "builtInMonth";
|
|
10179
|
+
BuiltInCalls2["Day"] = "builtInDay";
|
|
10180
|
+
BuiltInCalls2["Hours"] = "builtInHours";
|
|
10181
|
+
BuiltInCalls2["Minutes"] = "builtInMinutes";
|
|
10182
|
+
BuiltInCalls2["Seconds"] = "builtInSeconds";
|
|
10183
|
+
BuiltInCalls2["Timezone"] = "builtInTimezone";
|
|
10184
|
+
BuiltInCalls2["Tz"] = "builtInTz";
|
|
10185
|
+
BuiltInCalls2["Now"] = "builtInNow";
|
|
10186
|
+
BuiltInCalls2["Uuid"] = "builtInUuid";
|
|
10187
|
+
BuiltInCalls2["Struuid"] = "builtInStruuid";
|
|
10188
|
+
BuiltInCalls2["Md5"] = "builtInMd5";
|
|
10189
|
+
BuiltInCalls2["Sha1"] = "builtInSha1";
|
|
10190
|
+
BuiltInCalls2["Sha256"] = "builtInSha256";
|
|
10191
|
+
BuiltInCalls2["Sha384"] = "builtInSha384";
|
|
10192
|
+
BuiltInCalls2["Sha512"] = "builtInSha512";
|
|
10193
|
+
BuiltInCalls2["Coalesce"] = "builtInCoalesce";
|
|
10194
|
+
BuiltInCalls2["If"] = "builtInIf";
|
|
10195
|
+
BuiltInCalls2["Strlang"] = "builtInStrlang";
|
|
10196
|
+
BuiltInCalls2["Strdt"] = "builtInStrdt";
|
|
10197
|
+
BuiltInCalls2["Sameterm"] = "builtInSameterm";
|
|
10198
|
+
BuiltInCalls2["Isiri"] = "builtInIsiri";
|
|
10199
|
+
BuiltInCalls2["Isuri"] = "builtInIsuri";
|
|
10200
|
+
BuiltInCalls2["Isblank"] = "builtInIsblank";
|
|
10201
|
+
BuiltInCalls2["Isliteral"] = "builtInIsliteral";
|
|
10202
|
+
BuiltInCalls2["Isnumeric"] = "builtInIsnumeric";
|
|
10203
|
+
BuiltInCalls2["Regex"] = "builtInRegex";
|
|
10204
|
+
BuiltInCalls2["Substr"] = "builtInSubstr";
|
|
10205
|
+
BuiltInCalls2["Replace"] = "builtInReplace";
|
|
10206
|
+
BuiltInCalls2["Exists"] = "builtInExists";
|
|
10207
|
+
BuiltInCalls2["Notexists"] = "builtInNotexists";
|
|
10208
|
+
BuiltInCalls2["Count"] = "builtInCount";
|
|
10209
|
+
BuiltInCalls2["Sum"] = "builtInSum";
|
|
10210
|
+
BuiltInCalls2["Min"] = "builtInMin";
|
|
10211
|
+
BuiltInCalls2["Max"] = "builtInMax";
|
|
10212
|
+
BuiltInCalls2["Avg"] = "builtInAvg";
|
|
10213
|
+
BuiltInCalls2["Sample"] = "builtInSample";
|
|
10214
|
+
BuiltInCalls2["Group_concat"] = "builtInGroup_concat";
|
|
10215
|
+
return BuiltInCalls2;
|
|
10216
|
+
})(BuiltInCalls || {});
|
|
10213
10217
|
function capitalize(string2) {
|
|
10214
10218
|
return string2.charAt(0).toUpperCase() + string2.slice(1);
|
|
10215
10219
|
}
|
|
@@ -10713,7 +10717,7 @@ var allBaseTokens = LexerBuilder.create().add(
|
|
|
10713
10717
|
notIn,
|
|
10714
10718
|
separator
|
|
10715
10719
|
);
|
|
10716
|
-
var
|
|
10720
|
+
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);
|
|
10717
10721
|
|
|
10718
10722
|
// ../../packages/rules-sparql-1-1/lib/factoryMixins/ContextFactory.ts
|
|
10719
10723
|
var nodeType = "contextDef";
|
|
@@ -11158,10 +11162,7 @@ function SolutionModifiersFactoryMixin(Base) {
|
|
|
11158
11162
|
var nodeType8 = "term";
|
|
11159
11163
|
function TermFactoryMixin(Base) {
|
|
11160
11164
|
return class TermFactory extends Base {
|
|
11161
|
-
|
|
11162
|
-
super(...arguments);
|
|
11163
|
-
this.__blankNodeCounter = 0;
|
|
11164
|
-
}
|
|
11165
|
+
__blankNodeCounter = 0;
|
|
11165
11166
|
resetBlankNodeCounter() {
|
|
11166
11167
|
this.__blankNodeCounter = 0;
|
|
11167
11168
|
}
|
|
@@ -11900,6 +11901,120 @@ var verbA = {
|
|
|
11900
11901
|
}
|
|
11901
11902
|
};
|
|
11902
11903
|
|
|
11904
|
+
// ../../packages/rules-sparql-1-1/lib/grammar/general.ts
|
|
11905
|
+
var prologue = {
|
|
11906
|
+
name: "prologue",
|
|
11907
|
+
impl: ({ SUBRULE, MANY, OR }) => () => {
|
|
11908
|
+
const result = [];
|
|
11909
|
+
MANY(() => OR([
|
|
11910
|
+
{ ALT: () => result.push(SUBRULE(baseDecl2)) },
|
|
11911
|
+
// TODO: the [spec](https://www.w3.org/TR/sparql11-query/#iriRefs) says you cannot redefine prefixes.
|
|
11912
|
+
// We might need to check this.
|
|
11913
|
+
{ ALT: () => result.push(SUBRULE(prefixDecl2)) }
|
|
11914
|
+
]));
|
|
11915
|
+
return result;
|
|
11916
|
+
},
|
|
11917
|
+
gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => {
|
|
11918
|
+
for (const context of ast) {
|
|
11919
|
+
if (F2.isContextDefinitionBase(context)) {
|
|
11920
|
+
SUBRULE(baseDecl2, context);
|
|
11921
|
+
} else if (F2.isContextDefinitionPrefix(context)) {
|
|
11922
|
+
SUBRULE(prefixDecl2, context);
|
|
11923
|
+
}
|
|
11924
|
+
}
|
|
11925
|
+
}
|
|
11926
|
+
};
|
|
11927
|
+
var baseDecl2 = {
|
|
11928
|
+
name: "baseDecl",
|
|
11929
|
+
impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
|
|
11930
|
+
const base = CONSUME(baseDecl);
|
|
11931
|
+
const val = SUBRULE(iriFull);
|
|
11932
|
+
return ACTION(() => C.factory.contextDefinitionBase(C.factory.sourceLocation(base, val), val));
|
|
11933
|
+
},
|
|
11934
|
+
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
|
|
11935
|
+
F2.printFilter(ast, () => PRINT_WORD("BASE"));
|
|
11936
|
+
SUBRULE(iri2, ast.value);
|
|
11937
|
+
}
|
|
11938
|
+
};
|
|
11939
|
+
var prefixDecl2 = {
|
|
11940
|
+
name: "prefixDecl",
|
|
11941
|
+
impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
|
|
11942
|
+
const prefix = CONSUME(prefixDecl);
|
|
11943
|
+
const name = CONSUME(terminals_exports.pNameNs).image.slice(0, -1);
|
|
11944
|
+
const value = SUBRULE(iriFull);
|
|
11945
|
+
return ACTION(() => C.factory.contextDefinitionPrefix(C.factory.sourceLocation(prefix, value), name, value));
|
|
11946
|
+
},
|
|
11947
|
+
gImpl: ({ SUBRULE, PRINT_WORDS }) => (ast, { factory: F2 }) => {
|
|
11948
|
+
F2.printFilter(ast, () => {
|
|
11949
|
+
PRINT_WORDS("PREFIX", `${ast.key}:`);
|
|
11950
|
+
});
|
|
11951
|
+
SUBRULE(iri2, ast.value);
|
|
11952
|
+
}
|
|
11953
|
+
};
|
|
11954
|
+
var verb = {
|
|
11955
|
+
name: "verb",
|
|
11956
|
+
impl: ({ SUBRULE, OR }) => () => OR([
|
|
11957
|
+
{ ALT: () => SUBRULE(varOrIri) },
|
|
11958
|
+
{ ALT: () => SUBRULE(verbA) }
|
|
11959
|
+
])
|
|
11960
|
+
};
|
|
11961
|
+
var varOrTerm = {
|
|
11962
|
+
name: "varOrTerm",
|
|
11963
|
+
impl: ({ SUBRULE, OR }) => (C) => OR([
|
|
11964
|
+
{ GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(var_) },
|
|
11965
|
+
{ ALT: () => SUBRULE(graphTerm) }
|
|
11966
|
+
]),
|
|
11967
|
+
gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => {
|
|
11968
|
+
if (F2.isTermVariable(ast)) {
|
|
11969
|
+
return SUBRULE(var_, ast);
|
|
11970
|
+
}
|
|
11971
|
+
return SUBRULE(graphTerm, ast);
|
|
11972
|
+
}
|
|
11973
|
+
};
|
|
11974
|
+
var varOrIri = {
|
|
11975
|
+
name: "varOrIri",
|
|
11976
|
+
impl: ({ SUBRULE, OR }) => (C) => OR([
|
|
11977
|
+
{ GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(var_) },
|
|
11978
|
+
{ ALT: () => SUBRULE(iri2) }
|
|
11979
|
+
])
|
|
11980
|
+
};
|
|
11981
|
+
var var_ = {
|
|
11982
|
+
name: "var",
|
|
11983
|
+
impl: ({ ACTION, CONSUME, OR }) => (C) => {
|
|
11984
|
+
const varToken = OR([
|
|
11985
|
+
{ ALT: () => CONSUME(terminals_exports.var1) },
|
|
11986
|
+
{ ALT: () => CONSUME(terminals_exports.var2) }
|
|
11987
|
+
]);
|
|
11988
|
+
return ACTION(() => C.factory.variable(varToken.image.slice(1), C.factory.sourceLocation(varToken)));
|
|
11989
|
+
},
|
|
11990
|
+
gImpl: ({ PRINT_WORD }) => (ast, { factory: F2 }) => {
|
|
11991
|
+
F2.printFilter(ast, () => PRINT_WORD(`?${ast.value}`));
|
|
11992
|
+
}
|
|
11993
|
+
};
|
|
11994
|
+
var graphTerm = {
|
|
11995
|
+
name: "graphTerm",
|
|
11996
|
+
impl: ({ ACTION, SUBRULE, CONSUME, OR }) => (C) => OR([
|
|
11997
|
+
{ ALT: () => SUBRULE(iri2) },
|
|
11998
|
+
{ ALT: () => SUBRULE(rdfLiteral) },
|
|
11999
|
+
{ ALT: () => SUBRULE(numericLiteral) },
|
|
12000
|
+
{ ALT: () => SUBRULE(booleanLiteral) },
|
|
12001
|
+
{ GATE: () => C.parseMode.has("canCreateBlankNodes"), ALT: () => SUBRULE(blankNode) },
|
|
12002
|
+
{ ALT: () => {
|
|
12003
|
+
const tokenNil = CONSUME(terminals_exports.nil);
|
|
12004
|
+
return ACTION(() => C.factory.namedNode(C.factory.sourceLocation(tokenNil), "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" /* NIL */));
|
|
12005
|
+
} }
|
|
12006
|
+
]),
|
|
12007
|
+
gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => {
|
|
12008
|
+
if (F2.isTermNamed(ast)) {
|
|
12009
|
+
SUBRULE(iri2, ast);
|
|
12010
|
+
} else if (F2.isTermLiteral(ast)) {
|
|
12011
|
+
SUBRULE(rdfLiteral, ast);
|
|
12012
|
+
} else if (F2.isTermBlank(ast)) {
|
|
12013
|
+
SUBRULE(blankNode, ast);
|
|
12014
|
+
}
|
|
12015
|
+
}
|
|
12016
|
+
};
|
|
12017
|
+
|
|
11903
12018
|
// ../../packages/rules-sparql-1-1/lib/grammar/dataSetClause.ts
|
|
11904
12019
|
function datasetClauseUsing(name, token) {
|
|
11905
12020
|
return {
|
|
@@ -12155,55 +12270,55 @@ function baseAggregateFunc(func) {
|
|
|
12155
12270
|
}
|
|
12156
12271
|
|
|
12157
12272
|
// ../../packages/rules-sparql-1-1/lib/grammar/builtIn.ts
|
|
12158
|
-
var builtInStr = funcExpr1(
|
|
12159
|
-
var builtInLang = funcExpr1(
|
|
12160
|
-
var builtInLangmatches = funcExpr2(
|
|
12161
|
-
var builtInDatatype = funcExpr1(
|
|
12162
|
-
var builtInBound = funcVar1(
|
|
12163
|
-
var builtInIri = funcExpr1(
|
|
12164
|
-
var builtInUri = funcExpr1(
|
|
12165
|
-
var builtInBnodeSparqlJs = funcExprOrNil1(
|
|
12166
|
-
var builtInRand = funcNil1(
|
|
12167
|
-
var builtInAbs = funcExpr1(
|
|
12168
|
-
var builtInCeil = funcExpr1(
|
|
12169
|
-
var builtInFloor = funcExpr1(
|
|
12170
|
-
var builtInRound = funcExpr1(
|
|
12171
|
-
var builtInConcat = funcExprList1(
|
|
12172
|
-
var builtInStrlen = funcExpr1(
|
|
12173
|
-
var builtInUcase = funcExpr1(
|
|
12174
|
-
var builtInLcase = funcExpr1(
|
|
12175
|
-
var builtInEncode_for_uri = funcExpr1(
|
|
12176
|
-
var builtInContains = funcExpr2(
|
|
12177
|
-
var builtInStrstarts = funcExpr2(
|
|
12178
|
-
var builtInStrends = funcExpr2(
|
|
12179
|
-
var builtInStrbefore = funcExpr2(
|
|
12180
|
-
var builtInStrafter = funcExpr2(
|
|
12181
|
-
var builtInYear = funcExpr1(
|
|
12182
|
-
var builtInMonth = funcExpr1(
|
|
12183
|
-
var builtInDay = funcExpr1(
|
|
12184
|
-
var builtInHours = funcExpr1(
|
|
12185
|
-
var builtInMinutes = funcExpr1(
|
|
12186
|
-
var builtInSeconds = funcExpr1(
|
|
12187
|
-
var builtInTimezone = funcExpr1(
|
|
12188
|
-
var builtInTz = funcExpr1(
|
|
12189
|
-
var builtInNow = funcNil1(
|
|
12190
|
-
var builtInUuid = funcNil1(
|
|
12191
|
-
var builtInStruuid = funcNil1(
|
|
12192
|
-
var builtInMd5 = funcExpr1(
|
|
12193
|
-
var builtInSha1 = funcExpr1(
|
|
12194
|
-
var builtInSha256 = funcExpr1(
|
|
12195
|
-
var builtInSha384 = funcExpr1(
|
|
12196
|
-
var builtInSha512 = funcExpr1(
|
|
12197
|
-
var builtInCoalesce = funcExprList1(
|
|
12198
|
-
var builtInIf = funcExpr3(
|
|
12199
|
-
var builtInStrlang = funcExpr2(
|
|
12200
|
-
var builtInStrdt = funcExpr2(
|
|
12201
|
-
var builtInSameterm = funcExpr2(
|
|
12202
|
-
var builtInIsiri = funcExpr1(
|
|
12203
|
-
var builtInIsuri = funcExpr1(
|
|
12204
|
-
var builtInIsblank = funcExpr1(
|
|
12205
|
-
var builtInIsliteral = funcExpr1(
|
|
12206
|
-
var builtInIsnumeric = funcExpr1(
|
|
12273
|
+
var builtInStr = funcExpr1(BuiltInCalls_exports.str);
|
|
12274
|
+
var builtInLang = funcExpr1(BuiltInCalls_exports.lang);
|
|
12275
|
+
var builtInLangmatches = funcExpr2(BuiltInCalls_exports.langmatches);
|
|
12276
|
+
var builtInDatatype = funcExpr1(BuiltInCalls_exports.datatype);
|
|
12277
|
+
var builtInBound = funcVar1(BuiltInCalls_exports.bound);
|
|
12278
|
+
var builtInIri = funcExpr1(BuiltInCalls_exports.iri);
|
|
12279
|
+
var builtInUri = funcExpr1(BuiltInCalls_exports.uri);
|
|
12280
|
+
var builtInBnodeSparqlJs = funcExprOrNil1(BuiltInCalls_exports.bnode);
|
|
12281
|
+
var builtInRand = funcNil1(BuiltInCalls_exports.rand);
|
|
12282
|
+
var builtInAbs = funcExpr1(BuiltInCalls_exports.abs);
|
|
12283
|
+
var builtInCeil = funcExpr1(BuiltInCalls_exports.ceil);
|
|
12284
|
+
var builtInFloor = funcExpr1(BuiltInCalls_exports.floor);
|
|
12285
|
+
var builtInRound = funcExpr1(BuiltInCalls_exports.round);
|
|
12286
|
+
var builtInConcat = funcExprList1(BuiltInCalls_exports.concat);
|
|
12287
|
+
var builtInStrlen = funcExpr1(BuiltInCalls_exports.strlen);
|
|
12288
|
+
var builtInUcase = funcExpr1(BuiltInCalls_exports.ucase);
|
|
12289
|
+
var builtInLcase = funcExpr1(BuiltInCalls_exports.lcase);
|
|
12290
|
+
var builtInEncode_for_uri = funcExpr1(BuiltInCalls_exports.encode_for_uri);
|
|
12291
|
+
var builtInContains = funcExpr2(BuiltInCalls_exports.contains);
|
|
12292
|
+
var builtInStrstarts = funcExpr2(BuiltInCalls_exports.strstarts);
|
|
12293
|
+
var builtInStrends = funcExpr2(BuiltInCalls_exports.strends);
|
|
12294
|
+
var builtInStrbefore = funcExpr2(BuiltInCalls_exports.strbefore);
|
|
12295
|
+
var builtInStrafter = funcExpr2(BuiltInCalls_exports.strafter);
|
|
12296
|
+
var builtInYear = funcExpr1(BuiltInCalls_exports.year);
|
|
12297
|
+
var builtInMonth = funcExpr1(BuiltInCalls_exports.month);
|
|
12298
|
+
var builtInDay = funcExpr1(BuiltInCalls_exports.day);
|
|
12299
|
+
var builtInHours = funcExpr1(BuiltInCalls_exports.hours);
|
|
12300
|
+
var builtInMinutes = funcExpr1(BuiltInCalls_exports.minutes);
|
|
12301
|
+
var builtInSeconds = funcExpr1(BuiltInCalls_exports.seconds);
|
|
12302
|
+
var builtInTimezone = funcExpr1(BuiltInCalls_exports.timezone);
|
|
12303
|
+
var builtInTz = funcExpr1(BuiltInCalls_exports.tz);
|
|
12304
|
+
var builtInNow = funcNil1(BuiltInCalls_exports.now);
|
|
12305
|
+
var builtInUuid = funcNil1(BuiltInCalls_exports.uuid);
|
|
12306
|
+
var builtInStruuid = funcNil1(BuiltInCalls_exports.struuid);
|
|
12307
|
+
var builtInMd5 = funcExpr1(BuiltInCalls_exports.md5);
|
|
12308
|
+
var builtInSha1 = funcExpr1(BuiltInCalls_exports.sha1);
|
|
12309
|
+
var builtInSha256 = funcExpr1(BuiltInCalls_exports.sha256);
|
|
12310
|
+
var builtInSha384 = funcExpr1(BuiltInCalls_exports.sha384);
|
|
12311
|
+
var builtInSha512 = funcExpr1(BuiltInCalls_exports.sha512);
|
|
12312
|
+
var builtInCoalesce = funcExprList1(BuiltInCalls_exports.coalesce);
|
|
12313
|
+
var builtInIf = funcExpr3(BuiltInCalls_exports.if_);
|
|
12314
|
+
var builtInStrlang = funcExpr2(BuiltInCalls_exports.strlang);
|
|
12315
|
+
var builtInStrdt = funcExpr2(BuiltInCalls_exports.strdt);
|
|
12316
|
+
var builtInSameterm = funcExpr2(BuiltInCalls_exports.sameterm);
|
|
12317
|
+
var builtInIsiri = funcExpr1(BuiltInCalls_exports.isiri);
|
|
12318
|
+
var builtInIsuri = funcExpr1(BuiltInCalls_exports.isuri);
|
|
12319
|
+
var builtInIsblank = funcExpr1(BuiltInCalls_exports.isblank);
|
|
12320
|
+
var builtInIsliteral = funcExpr1(BuiltInCalls_exports.isliteral);
|
|
12321
|
+
var builtInIsnumeric = funcExpr1(BuiltInCalls_exports.isnumeric);
|
|
12207
12322
|
function builtInCallList(SUBRULE) {
|
|
12208
12323
|
return [
|
|
12209
12324
|
{ ALT: () => SUBRULE(aggregate) },
|
|
@@ -12275,15 +12390,15 @@ var builtInCall = {
|
|
|
12275
12390
|
return OR(builtIns);
|
|
12276
12391
|
}
|
|
12277
12392
|
};
|
|
12278
|
-
var regexExpression = funcExpr2or3(
|
|
12279
|
-
var substringExpression = funcExpr2or3(
|
|
12280
|
-
var strReplaceExpression = funcExpr3or4(
|
|
12281
|
-
var existsFunc = funcGroupGraphPattern(
|
|
12282
|
-
var notExistsFunc = funcGroupGraphPattern(
|
|
12393
|
+
var regexExpression = funcExpr2or3(BuiltInCalls_exports.regex);
|
|
12394
|
+
var substringExpression = funcExpr2or3(BuiltInCalls_exports.substr);
|
|
12395
|
+
var strReplaceExpression = funcExpr3or4(BuiltInCalls_exports.replace);
|
|
12396
|
+
var existsFunc = funcGroupGraphPattern(BuiltInCalls_exports.exists);
|
|
12397
|
+
var notExistsFunc = funcGroupGraphPattern(BuiltInCalls_exports.notexists);
|
|
12283
12398
|
var aggregateCount = {
|
|
12284
|
-
name: unCapitalize(
|
|
12399
|
+
name: unCapitalize(BuiltInCalls_exports.count.name),
|
|
12285
12400
|
impl: ({ ACTION, CONSUME, SUBRULE, OR, OPTION }) => (C) => {
|
|
12286
|
-
const operatorToken = CONSUME(
|
|
12401
|
+
const operatorToken = CONSUME(BuiltInCalls_exports.count);
|
|
12287
12402
|
CONSUME(symbols_exports.LParen);
|
|
12288
12403
|
const distinctToken = OPTION(() => CONSUME(distinct));
|
|
12289
12404
|
const expressionVal = OR([
|
|
@@ -12315,15 +12430,15 @@ var aggregateCount = {
|
|
|
12315
12430
|
});
|
|
12316
12431
|
}
|
|
12317
12432
|
};
|
|
12318
|
-
var aggregateSum = baseAggregateFunc(
|
|
12319
|
-
var aggregateMin = baseAggregateFunc(
|
|
12320
|
-
var aggregateMax = baseAggregateFunc(
|
|
12321
|
-
var aggregateAvg = baseAggregateFunc(
|
|
12322
|
-
var aggregateSample = baseAggregateFunc(
|
|
12433
|
+
var aggregateSum = baseAggregateFunc(BuiltInCalls_exports.sum);
|
|
12434
|
+
var aggregateMin = baseAggregateFunc(BuiltInCalls_exports.min);
|
|
12435
|
+
var aggregateMax = baseAggregateFunc(BuiltInCalls_exports.max);
|
|
12436
|
+
var aggregateAvg = baseAggregateFunc(BuiltInCalls_exports.avg);
|
|
12437
|
+
var aggregateSample = baseAggregateFunc(BuiltInCalls_exports.sample);
|
|
12323
12438
|
var aggregateGroup_concat = {
|
|
12324
|
-
name: unCapitalize(
|
|
12439
|
+
name: unCapitalize(BuiltInCalls_exports.groupConcat.name),
|
|
12325
12440
|
impl: ({ ACTION, CONSUME, OPTION1, SUBRULE, OPTION2 }) => (C) => {
|
|
12326
|
-
const operatorToken = CONSUME(
|
|
12441
|
+
const operatorToken = CONSUME(BuiltInCalls_exports.groupConcat);
|
|
12327
12442
|
CONSUME(symbols_exports.LParen);
|
|
12328
12443
|
const distinctToken = OPTION1(() => CONSUME(distinct));
|
|
12329
12444
|
const expr = SUBRULE(expression);
|
|
@@ -12391,120 +12506,6 @@ var aggregate = {
|
|
|
12391
12506
|
}
|
|
12392
12507
|
};
|
|
12393
12508
|
|
|
12394
|
-
// ../../packages/rules-sparql-1-1/lib/grammar/general.ts
|
|
12395
|
-
var prologue = {
|
|
12396
|
-
name: "prologue",
|
|
12397
|
-
impl: ({ SUBRULE, MANY, OR }) => () => {
|
|
12398
|
-
const result = [];
|
|
12399
|
-
MANY(() => OR([
|
|
12400
|
-
{ ALT: () => result.push(SUBRULE(baseDecl2)) },
|
|
12401
|
-
// TODO: the [spec](https://www.w3.org/TR/sparql11-query/#iriRefs) says you cannot redefine prefixes.
|
|
12402
|
-
// We might need to check this.
|
|
12403
|
-
{ ALT: () => result.push(SUBRULE(prefixDecl2)) }
|
|
12404
|
-
]));
|
|
12405
|
-
return result;
|
|
12406
|
-
},
|
|
12407
|
-
gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => {
|
|
12408
|
-
for (const context of ast) {
|
|
12409
|
-
if (F2.isContextDefinitionBase(context)) {
|
|
12410
|
-
SUBRULE(baseDecl2, context);
|
|
12411
|
-
} else if (F2.isContextDefinitionPrefix(context)) {
|
|
12412
|
-
SUBRULE(prefixDecl2, context);
|
|
12413
|
-
}
|
|
12414
|
-
}
|
|
12415
|
-
}
|
|
12416
|
-
};
|
|
12417
|
-
var baseDecl2 = {
|
|
12418
|
-
name: "baseDecl",
|
|
12419
|
-
impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
|
|
12420
|
-
const base = CONSUME(baseDecl);
|
|
12421
|
-
const val = SUBRULE(iriFull);
|
|
12422
|
-
return ACTION(() => C.factory.contextDefinitionBase(C.factory.sourceLocation(base, val), val));
|
|
12423
|
-
},
|
|
12424
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
|
|
12425
|
-
F2.printFilter(ast, () => PRINT_WORD("BASE"));
|
|
12426
|
-
SUBRULE(iri2, ast.value);
|
|
12427
|
-
}
|
|
12428
|
-
};
|
|
12429
|
-
var prefixDecl2 = {
|
|
12430
|
-
name: "prefixDecl",
|
|
12431
|
-
impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
|
|
12432
|
-
const prefix = CONSUME(prefixDecl);
|
|
12433
|
-
const name = CONSUME(terminals_exports.pNameNs).image.slice(0, -1);
|
|
12434
|
-
const value = SUBRULE(iriFull);
|
|
12435
|
-
return ACTION(() => C.factory.contextDefinitionPrefix(C.factory.sourceLocation(prefix, value), name, value));
|
|
12436
|
-
},
|
|
12437
|
-
gImpl: ({ SUBRULE, PRINT_WORDS }) => (ast, { factory: F2 }) => {
|
|
12438
|
-
F2.printFilter(ast, () => {
|
|
12439
|
-
PRINT_WORDS("PREFIX", `${ast.key}:`);
|
|
12440
|
-
});
|
|
12441
|
-
SUBRULE(iri2, ast.value);
|
|
12442
|
-
}
|
|
12443
|
-
};
|
|
12444
|
-
var verb = {
|
|
12445
|
-
name: "verb",
|
|
12446
|
-
impl: ({ SUBRULE, OR }) => () => OR([
|
|
12447
|
-
{ ALT: () => SUBRULE(varOrIri) },
|
|
12448
|
-
{ ALT: () => SUBRULE(verbA) }
|
|
12449
|
-
])
|
|
12450
|
-
};
|
|
12451
|
-
var varOrTerm = {
|
|
12452
|
-
name: "varOrTerm",
|
|
12453
|
-
impl: ({ SUBRULE, OR }) => (C) => OR([
|
|
12454
|
-
{ GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(var_) },
|
|
12455
|
-
{ ALT: () => SUBRULE(graphTerm) }
|
|
12456
|
-
]),
|
|
12457
|
-
gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => {
|
|
12458
|
-
if (F2.isTermVariable(ast)) {
|
|
12459
|
-
return SUBRULE(var_, ast);
|
|
12460
|
-
}
|
|
12461
|
-
return SUBRULE(graphTerm, ast);
|
|
12462
|
-
}
|
|
12463
|
-
};
|
|
12464
|
-
var varOrIri = {
|
|
12465
|
-
name: "varOrIri",
|
|
12466
|
-
impl: ({ SUBRULE, OR }) => (C) => OR([
|
|
12467
|
-
{ GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(var_) },
|
|
12468
|
-
{ ALT: () => SUBRULE(iri2) }
|
|
12469
|
-
])
|
|
12470
|
-
};
|
|
12471
|
-
var var_ = {
|
|
12472
|
-
name: "var",
|
|
12473
|
-
impl: ({ ACTION, CONSUME, OR }) => (C) => {
|
|
12474
|
-
const varToken = OR([
|
|
12475
|
-
{ ALT: () => CONSUME(terminals_exports.var1) },
|
|
12476
|
-
{ ALT: () => CONSUME(terminals_exports.var2) }
|
|
12477
|
-
]);
|
|
12478
|
-
return ACTION(() => C.factory.variable(varToken.image.slice(1), C.factory.sourceLocation(varToken)));
|
|
12479
|
-
},
|
|
12480
|
-
gImpl: ({ PRINT_WORD }) => (ast, { factory: F2 }) => {
|
|
12481
|
-
F2.printFilter(ast, () => PRINT_WORD(`?${ast.value}`));
|
|
12482
|
-
}
|
|
12483
|
-
};
|
|
12484
|
-
var graphTerm = {
|
|
12485
|
-
name: "graphTerm",
|
|
12486
|
-
impl: ({ ACTION, SUBRULE, CONSUME, OR }) => (C) => OR([
|
|
12487
|
-
{ ALT: () => SUBRULE(iri2) },
|
|
12488
|
-
{ ALT: () => SUBRULE(rdfLiteral) },
|
|
12489
|
-
{ ALT: () => SUBRULE(numericLiteral) },
|
|
12490
|
-
{ ALT: () => SUBRULE(booleanLiteral) },
|
|
12491
|
-
{ GATE: () => C.parseMode.has("canCreateBlankNodes"), ALT: () => SUBRULE(blankNode) },
|
|
12492
|
-
{ ALT: () => {
|
|
12493
|
-
const tokenNil = CONSUME(terminals_exports.nil);
|
|
12494
|
-
return ACTION(() => C.factory.namedNode(C.factory.sourceLocation(tokenNil), "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" /* NIL */));
|
|
12495
|
-
} }
|
|
12496
|
-
]),
|
|
12497
|
-
gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => {
|
|
12498
|
-
if (F2.isTermNamed(ast)) {
|
|
12499
|
-
SUBRULE(iri2, ast);
|
|
12500
|
-
} else if (F2.isTermLiteral(ast)) {
|
|
12501
|
-
SUBRULE(rdfLiteral, ast);
|
|
12502
|
-
} else if (F2.isTermBlank(ast)) {
|
|
12503
|
-
SUBRULE(blankNode, ast);
|
|
12504
|
-
}
|
|
12505
|
-
}
|
|
12506
|
-
};
|
|
12507
|
-
|
|
12508
12509
|
// ../../packages/rules-sparql-1-1/lib/grammar/propertyPaths.ts
|
|
12509
12510
|
var path = {
|
|
12510
12511
|
name: "path",
|
|
@@ -14760,7 +14761,69 @@ var quadsNotTriples = {
|
|
|
14760
14761
|
}
|
|
14761
14762
|
};
|
|
14762
14763
|
|
|
14763
|
-
// ../../packages/rules-sparql-1-1/lib/
|
|
14764
|
+
// ../../packages/rules-sparql-1-1/lib/grammar/index.ts
|
|
14765
|
+
var queryOrUpdate = {
|
|
14766
|
+
name: "queryOrUpdate",
|
|
14767
|
+
impl: ({ ACTION, SUBRULE, OR1, OR2, MANY, OPTION1, CONSUME, SUBRULE2 }) => (C) => {
|
|
14768
|
+
const prologueValues = SUBRULE(prologue);
|
|
14769
|
+
return OR1([
|
|
14770
|
+
{ ALT: () => {
|
|
14771
|
+
const subType = OR2([
|
|
14772
|
+
{ ALT: () => SUBRULE(selectQuery) },
|
|
14773
|
+
{ ALT: () => SUBRULE(constructQuery) },
|
|
14774
|
+
{ ALT: () => SUBRULE(describeQuery) },
|
|
14775
|
+
{ ALT: () => SUBRULE(askQuery) }
|
|
14776
|
+
]);
|
|
14777
|
+
const values3 = SUBRULE(valuesClause);
|
|
14778
|
+
return ACTION(() => ({
|
|
14779
|
+
context: prologueValues,
|
|
14780
|
+
...subType,
|
|
14781
|
+
type: "query",
|
|
14782
|
+
...values3 && { values: values3 },
|
|
14783
|
+
loc: C.factory.sourceLocation(
|
|
14784
|
+
prologueValues.at(0),
|
|
14785
|
+
subType,
|
|
14786
|
+
values3
|
|
14787
|
+
)
|
|
14788
|
+
}));
|
|
14789
|
+
} },
|
|
14790
|
+
{ ALT: () => {
|
|
14791
|
+
const updates = [];
|
|
14792
|
+
updates.push({ context: prologueValues });
|
|
14793
|
+
let parsedSemi = true;
|
|
14794
|
+
MANY({
|
|
14795
|
+
GATE: () => parsedSemi,
|
|
14796
|
+
DEF: () => {
|
|
14797
|
+
parsedSemi = false;
|
|
14798
|
+
updates.at(-1).operation = SUBRULE(update1);
|
|
14799
|
+
OPTION1(() => {
|
|
14800
|
+
CONSUME(symbols_exports.semi);
|
|
14801
|
+
parsedSemi = true;
|
|
14802
|
+
const innerPrologue = SUBRULE2(prologue);
|
|
14803
|
+
updates.push({ context: innerPrologue });
|
|
14804
|
+
});
|
|
14805
|
+
}
|
|
14806
|
+
});
|
|
14807
|
+
return ACTION(() => {
|
|
14808
|
+
const update2 = {
|
|
14809
|
+
type: "update",
|
|
14810
|
+
updates,
|
|
14811
|
+
loc: C.factory.sourceLocation(
|
|
14812
|
+
...updates[0].context,
|
|
14813
|
+
updates[0].operation,
|
|
14814
|
+
...updates.at(-1).context,
|
|
14815
|
+
updates.at(-1)?.operation
|
|
14816
|
+
)
|
|
14817
|
+
};
|
|
14818
|
+
updateNoReuseBlankNodeLabels(update2);
|
|
14819
|
+
return update2;
|
|
14820
|
+
});
|
|
14821
|
+
} }
|
|
14822
|
+
]);
|
|
14823
|
+
}
|
|
14824
|
+
};
|
|
14825
|
+
|
|
14826
|
+
// ../../packages/rules-sparql-1-1/lib/MinimalSparqlParser.ts
|
|
14764
14827
|
function completeParseContext(context) {
|
|
14765
14828
|
return {
|
|
14766
14829
|
factory: context.factory ?? new Factory(),
|
|
@@ -14772,11 +14835,11 @@ function completeParseContext(context) {
|
|
|
14772
14835
|
skipValidation: context.skipValidation ?? false
|
|
14773
14836
|
};
|
|
14774
14837
|
}
|
|
14775
|
-
var
|
|
14838
|
+
var MinimalSparqlParser = class {
|
|
14776
14839
|
constructor(parser) {
|
|
14777
14840
|
this.parser = parser;
|
|
14778
|
-
this.F = new Factory();
|
|
14779
14841
|
}
|
|
14842
|
+
F = new Factory();
|
|
14780
14843
|
parse(query2, context = {}) {
|
|
14781
14844
|
return this.parser.queryOrUpdate(query2, completeParseContext(context));
|
|
14782
14845
|
}
|
|
@@ -14915,7 +14978,7 @@ var rules = [
|
|
|
14915
14978
|
grammar_exports.numericLiteralPositive,
|
|
14916
14979
|
grammar_exports.numericLiteralNegative
|
|
14917
14980
|
];
|
|
14918
|
-
var
|
|
14981
|
+
var objectListParserBuilder = ParserBuilder.create(rules);
|
|
14919
14982
|
|
|
14920
14983
|
// ../parser-sparql-1-1/lib/triplesBlockParser.ts
|
|
14921
14984
|
var triplesBlockParserBuilder = ParserBuilder.create([
|
|
@@ -14929,7 +14992,7 @@ var triplesBlockParserBuilder = ParserBuilder.create([
|
|
|
14929
14992
|
grammar_exports.verbPath,
|
|
14930
14993
|
grammar_exports.verbSimple,
|
|
14931
14994
|
grammar_exports.objectListPath
|
|
14932
|
-
]).merge(
|
|
14995
|
+
]).merge(objectListParserBuilder, []).addMany(
|
|
14933
14996
|
grammar_exports.path,
|
|
14934
14997
|
grammar_exports.pathAlternative,
|
|
14935
14998
|
grammar_exports.pathSequence,
|
|
@@ -15089,76 +15152,16 @@ var updateParserBuilder = ParserBuilder.create(updateNoModifyParserBuilder).patc
|
|
|
15089
15152
|
grammar_exports.sourceSelector,
|
|
15090
15153
|
grammar_exports.usingClauseStar,
|
|
15091
15154
|
grammar_exports.groupGraphPattern
|
|
15092
|
-
).merge(
|
|
15155
|
+
).merge(objectListParserBuilder, []).merge(subSelectParserBuilder, []);
|
|
15093
15156
|
|
|
15094
15157
|
// ../parser-sparql-1-1/lib/Parser.ts
|
|
15095
|
-
var
|
|
15096
|
-
name: "queryOrUpdate",
|
|
15097
|
-
impl: ({ ACTION, SUBRULE, OR1, OR2, MANY, OPTION1, CONSUME, SUBRULE2 }) => (C) => {
|
|
15098
|
-
const prologueValues = SUBRULE(grammar_exports.prologue);
|
|
15099
|
-
return OR1([
|
|
15100
|
-
{ ALT: () => {
|
|
15101
|
-
const subType = OR2([
|
|
15102
|
-
{ ALT: () => SUBRULE(grammar_exports.selectQuery) },
|
|
15103
|
-
{ ALT: () => SUBRULE(grammar_exports.constructQuery) },
|
|
15104
|
-
{ ALT: () => SUBRULE(grammar_exports.describeQuery) },
|
|
15105
|
-
{ ALT: () => SUBRULE(grammar_exports.askQuery) }
|
|
15106
|
-
]);
|
|
15107
|
-
const values3 = SUBRULE(grammar_exports.valuesClause);
|
|
15108
|
-
return ACTION(() => ({
|
|
15109
|
-
context: prologueValues,
|
|
15110
|
-
...subType,
|
|
15111
|
-
type: "query",
|
|
15112
|
-
...values3 && { values: values3 },
|
|
15113
|
-
loc: C.factory.sourceLocation(
|
|
15114
|
-
prologueValues.at(0),
|
|
15115
|
-
subType,
|
|
15116
|
-
values3
|
|
15117
|
-
)
|
|
15118
|
-
}));
|
|
15119
|
-
} },
|
|
15120
|
-
{ ALT: () => {
|
|
15121
|
-
const updates = [];
|
|
15122
|
-
updates.push({ context: prologueValues });
|
|
15123
|
-
let parsedSemi = true;
|
|
15124
|
-
MANY({
|
|
15125
|
-
GATE: () => parsedSemi,
|
|
15126
|
-
DEF: () => {
|
|
15127
|
-
parsedSemi = false;
|
|
15128
|
-
updates.at(-1).operation = SUBRULE(grammar_exports.update1);
|
|
15129
|
-
OPTION1(() => {
|
|
15130
|
-
CONSUME(lexer_exports.symbols.semi);
|
|
15131
|
-
parsedSemi = true;
|
|
15132
|
-
const innerPrologue = SUBRULE2(grammar_exports.prologue);
|
|
15133
|
-
updates.push({ context: innerPrologue });
|
|
15134
|
-
});
|
|
15135
|
-
}
|
|
15136
|
-
});
|
|
15137
|
-
return ACTION(() => {
|
|
15138
|
-
const update2 = {
|
|
15139
|
-
type: "update",
|
|
15140
|
-
updates,
|
|
15141
|
-
loc: C.factory.sourceLocation(
|
|
15142
|
-
...updates[0].context,
|
|
15143
|
-
updates[0].operation,
|
|
15144
|
-
...updates.at(-1).context,
|
|
15145
|
-
updates.at(-1)?.operation
|
|
15146
|
-
)
|
|
15147
|
-
};
|
|
15148
|
-
updateNoReuseBlankNodeLabels(update2);
|
|
15149
|
-
return update2;
|
|
15150
|
-
});
|
|
15151
|
-
} }
|
|
15152
|
-
]);
|
|
15153
|
-
}
|
|
15154
|
-
};
|
|
15155
|
-
var sparql11ParserBuilder = ParserBuilder.create(queryUnitParserBuilder).merge(updateParserBuilder, []).addRule(queryOrUpdate);
|
|
15158
|
+
var sparql11ParserBuilder = ParserBuilder.create(queryUnitParserBuilder).merge(updateParserBuilder, []).addRule(grammar_exports.queryOrUpdate);
|
|
15156
15159
|
|
|
15157
15160
|
// ../../packages/rules-sparql-1-1-adjust/lib/grammar.ts
|
|
15158
15161
|
var grammar_exports2 = {};
|
|
15159
15162
|
__export(grammar_exports2, {
|
|
15160
15163
|
builtInAdjust: () => builtInAdjust,
|
|
15161
|
-
|
|
15164
|
+
builtInPatch: () => builtInPatch2
|
|
15162
15165
|
});
|
|
15163
15166
|
|
|
15164
15167
|
// ../../packages/rules-sparql-1-1-adjust/lib/lexer.ts
|
|
@@ -15170,25 +15173,21 @@ var BuiltInAdjust = createToken2({ name: "BuiltInAdjust", pattern: "ADJUST" });
|
|
|
15170
15173
|
|
|
15171
15174
|
// ../../packages/rules-sparql-1-1-adjust/lib/grammar.ts
|
|
15172
15175
|
var builtInAdjust = funcExpr2(BuiltInAdjust);
|
|
15173
|
-
var existingBuildInCall = {
|
|
15174
|
-
name: "existingBuildInCall",
|
|
15175
|
-
impl: grammar_exports.builtInCall.impl
|
|
15176
|
-
};
|
|
15177
|
-
|
|
15178
|
-
// lib/Parser.ts
|
|
15179
15176
|
var builtInPatch2 = {
|
|
15180
|
-
name:
|
|
15181
|
-
impl: (
|
|
15182
|
-
{ ALT: () => SUBRULE(
|
|
15183
|
-
{ ALT: () =>
|
|
15177
|
+
name: grammar_exports.builtInCall.name,
|
|
15178
|
+
impl: ($) => (C) => $.OR2([
|
|
15179
|
+
{ ALT: () => $.SUBRULE(builtInAdjust) },
|
|
15180
|
+
{ ALT: () => grammar_exports.builtInCall.impl($)(C) }
|
|
15184
15181
|
])
|
|
15185
15182
|
};
|
|
15186
|
-
|
|
15187
|
-
|
|
15188
|
-
var
|
|
15183
|
+
|
|
15184
|
+
// lib/Parser.ts
|
|
15185
|
+
var adjustParserBuilder = ParserBuilder.create(sparql11ParserBuilder).typePatch().addRule(grammar_exports2.builtInAdjust).patchRule(grammar_exports2.builtInPatch);
|
|
15186
|
+
var adjustLexerBuilder = LexerBuilder.create(lexer_exports.sparql11LexerBuilder).addBefore(lexer_exports.a, lexer_exports2.BuiltInAdjust);
|
|
15187
|
+
var Parser2 = class extends MinimalSparqlParser {
|
|
15189
15188
|
constructor() {
|
|
15190
|
-
const parser =
|
|
15191
|
-
tokenVocabulary:
|
|
15189
|
+
const parser = adjustParserBuilder.build({
|
|
15190
|
+
tokenVocabulary: adjustLexerBuilder.tokenVocabulary,
|
|
15192
15191
|
queryPreProcessor: sparqlCodepointEscape
|
|
15193
15192
|
});
|
|
15194
15193
|
super(parser);
|