@traqula/rules-sparql-1-1 0.0.23 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/cjs/lib/MinimalSparqlParser.js +35 -58
  2. package/dist/cjs/lib/MinimalSparqlParser.js.map +1 -0
  3. package/dist/cjs/lib/Sparql11types.js +2 -15
  4. package/dist/cjs/lib/Sparql11types.js.map +1 -0
  5. package/dist/cjs/lib/astFactory.js +107 -119
  6. package/dist/cjs/lib/astFactory.js.map +1 -0
  7. package/dist/cjs/lib/expressionHelpers.js +181 -191
  8. package/dist/cjs/lib/expressionHelpers.js.map +1 -0
  9. package/dist/cjs/lib/factoryMixins/ContextFactory.js +30 -52
  10. package/dist/cjs/lib/factoryMixins/ContextFactory.js.map +1 -0
  11. package/dist/cjs/lib/factoryMixins/ExpressionFactory.js +83 -102
  12. package/dist/cjs/lib/factoryMixins/ExpressionFactory.js.map +1 -0
  13. package/dist/cjs/lib/factoryMixins/GraphRefFactory.js +51 -73
  14. package/dist/cjs/lib/factoryMixins/GraphRefFactory.js.map +1 -0
  15. package/dist/cjs/lib/factoryMixins/PathFactory.js +68 -87
  16. package/dist/cjs/lib/factoryMixins/PathFactory.js.map +1 -0
  17. package/dist/cjs/lib/factoryMixins/Patternfactory.js +98 -120
  18. package/dist/cjs/lib/factoryMixins/Patternfactory.js.map +1 -0
  19. package/dist/cjs/lib/factoryMixins/QueryFactory.js +43 -65
  20. package/dist/cjs/lib/factoryMixins/QueryFactory.js.map +1 -0
  21. package/dist/cjs/lib/factoryMixins/SolutionModifiersFactory.js +55 -77
  22. package/dist/cjs/lib/factoryMixins/SolutionModifiersFactory.js.map +1 -0
  23. package/dist/cjs/lib/factoryMixins/TermFactory.js +81 -102
  24. package/dist/cjs/lib/factoryMixins/TermFactory.js.map +1 -0
  25. package/dist/cjs/lib/factoryMixins/UpdateOperationFactory.js +126 -147
  26. package/dist/cjs/lib/factoryMixins/UpdateOperationFactory.js.map +1 -0
  27. package/dist/cjs/lib/factoryMixins/mixins.js +21 -38
  28. package/dist/cjs/lib/factoryMixins/mixins.js.map +1 -0
  29. package/dist/cjs/lib/grammar/builtIn.js +277 -377
  30. package/dist/cjs/lib/grammar/builtIn.js.map +1 -0
  31. package/dist/cjs/lib/grammar/dataSetClause.js +110 -109
  32. package/dist/cjs/lib/grammar/dataSetClause.js.map +1 -0
  33. package/dist/cjs/lib/grammar/expression.js +387 -358
  34. package/dist/cjs/lib/grammar/expression.js.map +1 -0
  35. package/dist/cjs/lib/grammar/general.js +173 -158
  36. package/dist/cjs/lib/grammar/general.js.map +1 -0
  37. package/dist/cjs/lib/grammar/index.js +94 -111
  38. package/dist/cjs/lib/grammar/index.js.map +1 -0
  39. package/dist/cjs/lib/grammar/literals.js +282 -266
  40. package/dist/cjs/lib/grammar/literals.js.map +1 -0
  41. package/dist/cjs/lib/grammar/propertyPaths.js +206 -193
  42. package/dist/cjs/lib/grammar/propertyPaths.js.map +1 -0
  43. package/dist/cjs/lib/grammar/queryUnit.js +395 -372
  44. package/dist/cjs/lib/grammar/queryUnit.js.map +1 -0
  45. package/dist/cjs/lib/grammar/solutionModifier.js +281 -265
  46. package/dist/cjs/lib/grammar/solutionModifier.js.map +1 -0
  47. package/dist/cjs/lib/grammar/tripleBlock.js +390 -355
  48. package/dist/cjs/lib/grammar/tripleBlock.js.map +1 -0
  49. package/dist/cjs/lib/grammar/updateUnit.js +551 -519
  50. package/dist/cjs/lib/grammar/updateUnit.js.map +1 -0
  51. package/dist/cjs/lib/grammar/whereClause.js +486 -459
  52. package/dist/cjs/lib/grammar/whereClause.js.map +1 -0
  53. package/dist/cjs/lib/index.js +47 -54
  54. package/dist/cjs/lib/index.js.map +1 -0
  55. package/dist/cjs/lib/lexer/BuiltInCalls.js +188 -333
  56. package/dist/cjs/lib/lexer/BuiltInCalls.js.map +1 -0
  57. package/dist/cjs/lib/lexer/graph.js +10 -40
  58. package/dist/cjs/lib/lexer/graph.js.map +1 -0
  59. package/dist/cjs/lib/lexer/index.js +43 -48
  60. package/dist/cjs/lib/lexer/index.js.map +1 -0
  61. package/dist/cjs/lib/lexer/lexer.js +84 -195
  62. package/dist/cjs/lib/lexer/lexer.js.map +1 -0
  63. package/dist/cjs/lib/lexer/lexerPatterns.js +40 -132
  64. package/dist/cjs/lib/lexer/lexerPatterns.js.map +1 -0
  65. package/dist/cjs/lib/lexer/symbols.js +31 -106
  66. package/dist/cjs/lib/lexer/symbols.js.map +1 -0
  67. package/dist/cjs/lib/lexer/terminals.js +100 -102
  68. package/dist/cjs/lib/lexer/terminals.js.map +1 -0
  69. package/dist/cjs/lib/sparql11HelperTypes.js +2 -15
  70. package/dist/cjs/lib/sparql11HelperTypes.js.map +1 -0
  71. package/dist/cjs/lib/utils.js +40 -58
  72. package/dist/cjs/lib/utils.js.map +1 -0
  73. package/dist/cjs/lib/validation/validators.js +197 -186
  74. package/dist/cjs/lib/validation/validators.js.map +1 -0
  75. package/package.json +10 -10
@@ -1,385 +1,285 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var builtIn_exports = {};
30
- __export(builtIn_exports, {
31
- aggregate: () => aggregate,
32
- aggregateAvg: () => aggregateAvg,
33
- aggregateCount: () => aggregateCount,
34
- aggregateGroup_concat: () => aggregateGroup_concat,
35
- aggregateMax: () => aggregateMax,
36
- aggregateMin: () => aggregateMin,
37
- aggregateSample: () => aggregateSample,
38
- aggregateSum: () => aggregateSum,
39
- builtInAbs: () => builtInAbs,
40
- builtInBnodeSparqlJs: () => builtInBnodeSparqlJs,
41
- builtInBound: () => builtInBound,
42
- builtInCall: () => builtInCall,
43
- builtInCallList: () => builtInCallList,
44
- builtInCeil: () => builtInCeil,
45
- builtInCoalesce: () => builtInCoalesce,
46
- builtInConcat: () => builtInConcat,
47
- builtInContains: () => builtInContains,
48
- builtInDatatype: () => builtInDatatype,
49
- builtInDay: () => builtInDay,
50
- builtInEncode_for_uri: () => builtInEncode_for_uri,
51
- builtInFloor: () => builtInFloor,
52
- builtInHours: () => builtInHours,
53
- builtInIf: () => builtInIf,
54
- builtInIri: () => builtInIri,
55
- builtInIsblank: () => builtInIsblank,
56
- builtInIsiri: () => builtInIsiri,
57
- builtInIsliteral: () => builtInIsliteral,
58
- builtInIsnumeric: () => builtInIsnumeric,
59
- builtInIsuri: () => builtInIsuri,
60
- builtInLang: () => builtInLang,
61
- builtInLangmatches: () => builtInLangmatches,
62
- builtInLcase: () => builtInLcase,
63
- builtInMd5: () => builtInMd5,
64
- builtInMinutes: () => builtInMinutes,
65
- builtInMonth: () => builtInMonth,
66
- builtInNow: () => builtInNow,
67
- builtInRand: () => builtInRand,
68
- builtInRound: () => builtInRound,
69
- builtInSameterm: () => builtInSameterm,
70
- builtInSeconds: () => builtInSeconds,
71
- builtInSha1: () => builtInSha1,
72
- builtInSha256: () => builtInSha256,
73
- builtInSha384: () => builtInSha384,
74
- builtInSha512: () => builtInSha512,
75
- builtInStr: () => builtInStr,
76
- builtInStrafter: () => builtInStrafter,
77
- builtInStrbefore: () => builtInStrbefore,
78
- builtInStrdt: () => builtInStrdt,
79
- builtInStrends: () => builtInStrends,
80
- builtInStrlang: () => builtInStrlang,
81
- builtInStrlen: () => builtInStrlen,
82
- builtInStrstarts: () => builtInStrstarts,
83
- builtInStruuid: () => builtInStruuid,
84
- builtInTimezone: () => builtInTimezone,
85
- builtInTz: () => builtInTz,
86
- builtInUcase: () => builtInUcase,
87
- builtInUri: () => builtInUri,
88
- builtInUuid: () => builtInUuid,
89
- builtInYear: () => builtInYear,
90
- existsFunc: () => existsFunc,
91
- notExistsFunc: () => notExistsFunc,
92
- regexExpression: () => regexExpression,
93
- strReplaceExpression: () => strReplaceExpression,
94
- substringExpression: () => substringExpression
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
95
17
  });
96
- module.exports = __toCommonJS(builtIn_exports);
97
- var import_core = require("@traqula/core");
98
- var import_expressionHelpers = require("../expressionHelpers.js");
99
- var l = __toESM(require("../lexer/index.js"), 1);
100
- var import_expression = require("./expression.js");
101
- var import_literals = require("./literals.js");
102
- const builtInStr = (0, import_expressionHelpers.funcExpr1)(l.builtIn.str);
103
- const builtInLang = (0, import_expressionHelpers.funcExpr1)(l.builtIn.lang);
104
- const builtInLangmatches = (0, import_expressionHelpers.funcExpr2)(l.builtIn.langmatches);
105
- const builtInDatatype = (0, import_expressionHelpers.funcExpr1)(l.builtIn.datatype);
106
- const builtInBound = (0, import_expressionHelpers.funcVar1)(l.builtIn.bound);
107
- const builtInIri = (0, import_expressionHelpers.funcExpr1)(l.builtIn.iri);
108
- const builtInUri = (0, import_expressionHelpers.funcExpr1)(l.builtIn.uri);
109
- const builtInBnodeSparqlJs = (0, import_expressionHelpers.funcExprOrNil1)(l.builtIn.bnode);
110
- const builtInRand = (0, import_expressionHelpers.funcNil1)(l.builtIn.rand);
111
- const builtInAbs = (0, import_expressionHelpers.funcExpr1)(l.builtIn.abs);
112
- const builtInCeil = (0, import_expressionHelpers.funcExpr1)(l.builtIn.ceil);
113
- const builtInFloor = (0, import_expressionHelpers.funcExpr1)(l.builtIn.floor);
114
- const builtInRound = (0, import_expressionHelpers.funcExpr1)(l.builtIn.round);
115
- const builtInConcat = (0, import_expressionHelpers.funcExprList1)(l.builtIn.concat);
116
- const builtInStrlen = (0, import_expressionHelpers.funcExpr1)(l.builtIn.strlen);
117
- const builtInUcase = (0, import_expressionHelpers.funcExpr1)(l.builtIn.ucase);
118
- const builtInLcase = (0, import_expressionHelpers.funcExpr1)(l.builtIn.lcase);
119
- const builtInEncode_for_uri = (0, import_expressionHelpers.funcExpr1)(l.builtIn.encode_for_uri);
120
- const builtInContains = (0, import_expressionHelpers.funcExpr2)(l.builtIn.contains);
121
- const builtInStrstarts = (0, import_expressionHelpers.funcExpr2)(l.builtIn.strstarts);
122
- const builtInStrends = (0, import_expressionHelpers.funcExpr2)(l.builtIn.strends);
123
- const builtInStrbefore = (0, import_expressionHelpers.funcExpr2)(l.builtIn.strbefore);
124
- const builtInStrafter = (0, import_expressionHelpers.funcExpr2)(l.builtIn.strafter);
125
- const builtInYear = (0, import_expressionHelpers.funcExpr1)(l.builtIn.year);
126
- const builtInMonth = (0, import_expressionHelpers.funcExpr1)(l.builtIn.month);
127
- const builtInDay = (0, import_expressionHelpers.funcExpr1)(l.builtIn.day);
128
- const builtInHours = (0, import_expressionHelpers.funcExpr1)(l.builtIn.hours);
129
- const builtInMinutes = (0, import_expressionHelpers.funcExpr1)(l.builtIn.minutes);
130
- const builtInSeconds = (0, import_expressionHelpers.funcExpr1)(l.builtIn.seconds);
131
- const builtInTimezone = (0, import_expressionHelpers.funcExpr1)(l.builtIn.timezone);
132
- const builtInTz = (0, import_expressionHelpers.funcExpr1)(l.builtIn.tz);
133
- const builtInNow = (0, import_expressionHelpers.funcNil1)(l.builtIn.now);
134
- const builtInUuid = (0, import_expressionHelpers.funcNil1)(l.builtIn.uuid);
135
- const builtInStruuid = (0, import_expressionHelpers.funcNil1)(l.builtIn.struuid);
136
- const builtInMd5 = (0, import_expressionHelpers.funcExpr1)(l.builtIn.md5);
137
- const builtInSha1 = (0, import_expressionHelpers.funcExpr1)(l.builtIn.sha1);
138
- const builtInSha256 = (0, import_expressionHelpers.funcExpr1)(l.builtIn.sha256);
139
- const builtInSha384 = (0, import_expressionHelpers.funcExpr1)(l.builtIn.sha384);
140
- const builtInSha512 = (0, import_expressionHelpers.funcExpr1)(l.builtIn.sha512);
141
- const builtInCoalesce = (0, import_expressionHelpers.funcExprList1)(l.builtIn.coalesce);
142
- const builtInIf = (0, import_expressionHelpers.funcExpr3)(l.builtIn.if_);
143
- const builtInStrlang = (0, import_expressionHelpers.funcExpr2)(l.builtIn.strlang);
144
- const builtInStrdt = (0, import_expressionHelpers.funcExpr2)(l.builtIn.strdt);
145
- const builtInSameterm = (0, import_expressionHelpers.funcExpr2)(l.builtIn.sameterm);
146
- const builtInIsiri = (0, import_expressionHelpers.funcExpr1)(l.builtIn.isiri);
147
- const builtInIsuri = (0, import_expressionHelpers.funcExpr1)(l.builtIn.isuri);
148
- const builtInIsblank = (0, import_expressionHelpers.funcExpr1)(l.builtIn.isblank);
149
- const builtInIsliteral = (0, import_expressionHelpers.funcExpr1)(l.builtIn.isliteral);
150
- const builtInIsnumeric = (0, import_expressionHelpers.funcExpr1)(l.builtIn.isnumeric);
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.builtInCall = exports.builtInIsnumeric = exports.builtInIsliteral = exports.builtInIsblank = exports.builtInIsuri = exports.builtInIsiri = exports.builtInSameterm = exports.builtInStrdt = exports.builtInStrlang = exports.builtInIf = exports.builtInCoalesce = exports.builtInSha512 = exports.builtInSha384 = exports.builtInSha256 = exports.builtInSha1 = exports.builtInMd5 = exports.builtInStruuid = exports.builtInUuid = exports.builtInNow = exports.builtInTz = exports.builtInTimezone = exports.builtInSeconds = exports.builtInMinutes = exports.builtInHours = exports.builtInDay = exports.builtInMonth = exports.builtInYear = exports.builtInStrafter = exports.builtInStrbefore = exports.builtInStrends = exports.builtInStrstarts = exports.builtInContains = exports.builtInEncode_for_uri = exports.builtInLcase = exports.builtInUcase = exports.builtInStrlen = exports.builtInConcat = exports.builtInRound = exports.builtInFloor = exports.builtInCeil = exports.builtInAbs = exports.builtInRand = exports.builtInBnodeSparqlJs = exports.builtInUri = exports.builtInIri = exports.builtInBound = exports.builtInDatatype = exports.builtInLangmatches = exports.builtInLang = exports.builtInStr = void 0;
37
+ exports.aggregate = exports.aggregateGroup_concat = exports.aggregateSample = exports.aggregateAvg = exports.aggregateMax = exports.aggregateMin = exports.aggregateSum = exports.aggregateCount = exports.notExistsFunc = exports.existsFunc = exports.strReplaceExpression = exports.substringExpression = exports.regexExpression = void 0;
38
+ exports.builtInCallList = builtInCallList;
39
+ const core_1 = require("@traqula/core");
40
+ const expressionHelpers_js_1 = require("../expressionHelpers.js");
41
+ const l = __importStar(require("../lexer/index.js"));
42
+ const expression_js_1 = require("./expression.js");
43
+ const literals_js_1 = require("./literals.js");
44
+ exports.builtInStr = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.str);
45
+ exports.builtInLang = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.lang);
46
+ exports.builtInLangmatches = (0, expressionHelpers_js_1.funcExpr2)(l.builtIn.langmatches);
47
+ exports.builtInDatatype = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.datatype);
48
+ exports.builtInBound = (0, expressionHelpers_js_1.funcVar1)(l.builtIn.bound);
49
+ exports.builtInIri = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.iri);
50
+ exports.builtInUri = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.uri);
51
+ exports.builtInBnodeSparqlJs = (0, expressionHelpers_js_1.funcExprOrNil1)(l.builtIn.bnode);
52
+ exports.builtInRand = (0, expressionHelpers_js_1.funcNil1)(l.builtIn.rand);
53
+ exports.builtInAbs = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.abs);
54
+ exports.builtInCeil = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.ceil);
55
+ exports.builtInFloor = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.floor);
56
+ exports.builtInRound = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.round);
57
+ exports.builtInConcat = (0, expressionHelpers_js_1.funcExprList1)(l.builtIn.concat);
58
+ exports.builtInStrlen = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.strlen);
59
+ exports.builtInUcase = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.ucase);
60
+ exports.builtInLcase = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.lcase);
61
+ exports.builtInEncode_for_uri = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.encode_for_uri);
62
+ exports.builtInContains = (0, expressionHelpers_js_1.funcExpr2)(l.builtIn.contains);
63
+ exports.builtInStrstarts = (0, expressionHelpers_js_1.funcExpr2)(l.builtIn.strstarts);
64
+ exports.builtInStrends = (0, expressionHelpers_js_1.funcExpr2)(l.builtIn.strends);
65
+ exports.builtInStrbefore = (0, expressionHelpers_js_1.funcExpr2)(l.builtIn.strbefore);
66
+ exports.builtInStrafter = (0, expressionHelpers_js_1.funcExpr2)(l.builtIn.strafter);
67
+ exports.builtInYear = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.year);
68
+ exports.builtInMonth = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.month);
69
+ exports.builtInDay = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.day);
70
+ exports.builtInHours = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.hours);
71
+ exports.builtInMinutes = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.minutes);
72
+ exports.builtInSeconds = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.seconds);
73
+ exports.builtInTimezone = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.timezone);
74
+ exports.builtInTz = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.tz);
75
+ exports.builtInNow = (0, expressionHelpers_js_1.funcNil1)(l.builtIn.now);
76
+ exports.builtInUuid = (0, expressionHelpers_js_1.funcNil1)(l.builtIn.uuid);
77
+ exports.builtInStruuid = (0, expressionHelpers_js_1.funcNil1)(l.builtIn.struuid);
78
+ exports.builtInMd5 = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.md5);
79
+ exports.builtInSha1 = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.sha1);
80
+ exports.builtInSha256 = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.sha256);
81
+ exports.builtInSha384 = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.sha384);
82
+ exports.builtInSha512 = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.sha512);
83
+ exports.builtInCoalesce = (0, expressionHelpers_js_1.funcExprList1)(l.builtIn.coalesce);
84
+ exports.builtInIf = (0, expressionHelpers_js_1.funcExpr3)(l.builtIn.if_);
85
+ exports.builtInStrlang = (0, expressionHelpers_js_1.funcExpr2)(l.builtIn.strlang);
86
+ exports.builtInStrdt = (0, expressionHelpers_js_1.funcExpr2)(l.builtIn.strdt);
87
+ exports.builtInSameterm = (0, expressionHelpers_js_1.funcExpr2)(l.builtIn.sameterm);
88
+ exports.builtInIsiri = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.isiri);
89
+ exports.builtInIsuri = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.isuri);
90
+ exports.builtInIsblank = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.isblank);
91
+ exports.builtInIsliteral = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.isliteral);
92
+ exports.builtInIsnumeric = (0, expressionHelpers_js_1.funcExpr1)(l.builtIn.isnumeric);
151
93
  function builtInCallList(SUBRULE) {
152
- return [
153
- { ALT: () => SUBRULE(aggregate) },
154
- { ALT: () => SUBRULE(builtInStr) },
155
- { ALT: () => SUBRULE(builtInLang) },
156
- { ALT: () => SUBRULE(builtInLangmatches) },
157
- { ALT: () => SUBRULE(builtInDatatype) },
158
- { ALT: () => SUBRULE(builtInBound) },
159
- { ALT: () => SUBRULE(builtInIri) },
160
- { ALT: () => SUBRULE(builtInUri) },
161
- { ALT: () => SUBRULE(builtInBnodeSparqlJs) },
162
- { ALT: () => SUBRULE(builtInRand) },
163
- { ALT: () => SUBRULE(builtInAbs) },
164
- { ALT: () => SUBRULE(builtInCeil) },
165
- { ALT: () => SUBRULE(builtInFloor) },
166
- { ALT: () => SUBRULE(builtInRound) },
167
- { ALT: () => SUBRULE(builtInConcat) },
168
- { ALT: () => SUBRULE(substringExpression) },
169
- { ALT: () => SUBRULE(builtInStrlen) },
170
- { ALT: () => SUBRULE(strReplaceExpression) },
171
- { ALT: () => SUBRULE(builtInUcase) },
172
- { ALT: () => SUBRULE(builtInLcase) },
173
- { ALT: () => SUBRULE(builtInEncode_for_uri) },
174
- { ALT: () => SUBRULE(builtInContains) },
175
- { ALT: () => SUBRULE(builtInStrstarts) },
176
- { ALT: () => SUBRULE(builtInStrends) },
177
- { ALT: () => SUBRULE(builtInStrbefore) },
178
- { ALT: () => SUBRULE(builtInStrafter) },
179
- { ALT: () => SUBRULE(builtInYear) },
180
- { ALT: () => SUBRULE(builtInMonth) },
181
- { ALT: () => SUBRULE(builtInDay) },
182
- { ALT: () => SUBRULE(builtInHours) },
183
- { ALT: () => SUBRULE(builtInMinutes) },
184
- { ALT: () => SUBRULE(builtInSeconds) },
185
- { ALT: () => SUBRULE(builtInTimezone) },
186
- { ALT: () => SUBRULE(builtInTz) },
187
- { ALT: () => SUBRULE(builtInNow) },
188
- { ALT: () => SUBRULE(builtInUuid) },
189
- { ALT: () => SUBRULE(builtInStruuid) },
190
- { ALT: () => SUBRULE(builtInMd5) },
191
- { ALT: () => SUBRULE(builtInSha1) },
192
- { ALT: () => SUBRULE(builtInSha256) },
193
- { ALT: () => SUBRULE(builtInSha384) },
194
- { ALT: () => SUBRULE(builtInSha512) },
195
- { ALT: () => SUBRULE(builtInCoalesce) },
196
- { ALT: () => SUBRULE(builtInIf) },
197
- { ALT: () => SUBRULE(builtInStrlang) },
198
- { ALT: () => SUBRULE(builtInStrdt) },
199
- { ALT: () => SUBRULE(builtInSameterm) },
200
- { ALT: () => SUBRULE(builtInIsiri) },
201
- { ALT: () => SUBRULE(builtInIsuri) },
202
- { ALT: () => SUBRULE(builtInIsblank) },
203
- { ALT: () => SUBRULE(builtInIsliteral) },
204
- { ALT: () => SUBRULE(builtInIsnumeric) },
205
- { ALT: () => SUBRULE(regexExpression) },
206
- { ALT: () => SUBRULE(existsFunc) },
207
- { ALT: () => SUBRULE(notExistsFunc) }
208
- ];
94
+ return [
95
+ { ALT: () => SUBRULE(exports.aggregate) },
96
+ { ALT: () => SUBRULE(exports.builtInStr) },
97
+ { ALT: () => SUBRULE(exports.builtInLang) },
98
+ { ALT: () => SUBRULE(exports.builtInLangmatches) },
99
+ { ALT: () => SUBRULE(exports.builtInDatatype) },
100
+ { ALT: () => SUBRULE(exports.builtInBound) },
101
+ { ALT: () => SUBRULE(exports.builtInIri) },
102
+ { ALT: () => SUBRULE(exports.builtInUri) },
103
+ { ALT: () => SUBRULE(exports.builtInBnodeSparqlJs) },
104
+ { ALT: () => SUBRULE(exports.builtInRand) },
105
+ { ALT: () => SUBRULE(exports.builtInAbs) },
106
+ { ALT: () => SUBRULE(exports.builtInCeil) },
107
+ { ALT: () => SUBRULE(exports.builtInFloor) },
108
+ { ALT: () => SUBRULE(exports.builtInRound) },
109
+ { ALT: () => SUBRULE(exports.builtInConcat) },
110
+ { ALT: () => SUBRULE(exports.substringExpression) },
111
+ { ALT: () => SUBRULE(exports.builtInStrlen) },
112
+ { ALT: () => SUBRULE(exports.strReplaceExpression) },
113
+ { ALT: () => SUBRULE(exports.builtInUcase) },
114
+ { ALT: () => SUBRULE(exports.builtInLcase) },
115
+ { ALT: () => SUBRULE(exports.builtInEncode_for_uri) },
116
+ { ALT: () => SUBRULE(exports.builtInContains) },
117
+ { ALT: () => SUBRULE(exports.builtInStrstarts) },
118
+ { ALT: () => SUBRULE(exports.builtInStrends) },
119
+ { ALT: () => SUBRULE(exports.builtInStrbefore) },
120
+ { ALT: () => SUBRULE(exports.builtInStrafter) },
121
+ { ALT: () => SUBRULE(exports.builtInYear) },
122
+ { ALT: () => SUBRULE(exports.builtInMonth) },
123
+ { ALT: () => SUBRULE(exports.builtInDay) },
124
+ { ALT: () => SUBRULE(exports.builtInHours) },
125
+ { ALT: () => SUBRULE(exports.builtInMinutes) },
126
+ { ALT: () => SUBRULE(exports.builtInSeconds) },
127
+ { ALT: () => SUBRULE(exports.builtInTimezone) },
128
+ { ALT: () => SUBRULE(exports.builtInTz) },
129
+ { ALT: () => SUBRULE(exports.builtInNow) },
130
+ { ALT: () => SUBRULE(exports.builtInUuid) },
131
+ { ALT: () => SUBRULE(exports.builtInStruuid) },
132
+ { ALT: () => SUBRULE(exports.builtInMd5) },
133
+ { ALT: () => SUBRULE(exports.builtInSha1) },
134
+ { ALT: () => SUBRULE(exports.builtInSha256) },
135
+ { ALT: () => SUBRULE(exports.builtInSha384) },
136
+ { ALT: () => SUBRULE(exports.builtInSha512) },
137
+ { ALT: () => SUBRULE(exports.builtInCoalesce) },
138
+ { ALT: () => SUBRULE(exports.builtInIf) },
139
+ { ALT: () => SUBRULE(exports.builtInStrlang) },
140
+ { ALT: () => SUBRULE(exports.builtInStrdt) },
141
+ { ALT: () => SUBRULE(exports.builtInSameterm) },
142
+ { ALT: () => SUBRULE(exports.builtInIsiri) },
143
+ { ALT: () => SUBRULE(exports.builtInIsuri) },
144
+ { ALT: () => SUBRULE(exports.builtInIsblank) },
145
+ { ALT: () => SUBRULE(exports.builtInIsliteral) },
146
+ { ALT: () => SUBRULE(exports.builtInIsnumeric) },
147
+ { ALT: () => SUBRULE(exports.regexExpression) },
148
+ { ALT: () => SUBRULE(exports.existsFunc) },
149
+ { ALT: () => SUBRULE(exports.notExistsFunc) },
150
+ ];
209
151
  }
210
- const builtInCall = {
211
- name: "builtInCall",
212
- impl: ({ OR, SUBRULE, cache }) => () => {
213
- const cached = cache.get(builtInCall);
214
- if (cached) {
215
- return OR(cached);
216
- }
217
- const builtIns = builtInCallList(SUBRULE);
218
- cache.set(builtInCall, builtIns);
219
- return OR(builtIns);
220
- }
152
+ /**
153
+ * [[121]](https://www.w3.org/TR/sparql11-query/#rBuiltInCall)
154
+ */
155
+ exports.builtInCall = {
156
+ name: 'builtInCall',
157
+ impl: ({ OR, SUBRULE, cache }) => () => {
158
+ const cached = cache.get(exports.builtInCall);
159
+ if (cached) {
160
+ return OR(cached);
161
+ }
162
+ const builtIns = builtInCallList(SUBRULE);
163
+ cache.set(exports.builtInCall, builtIns);
164
+ return OR(builtIns);
165
+ },
221
166
  };
222
- const regexExpression = (0, import_expressionHelpers.funcExpr2or3)(l.builtIn.regex);
223
- const substringExpression = (0, import_expressionHelpers.funcExpr2or3)(l.builtIn.substr);
224
- const strReplaceExpression = (0, import_expressionHelpers.funcExpr3or4)(l.builtIn.replace);
225
- const existsFunc = (0, import_expressionHelpers.funcGroupGraphPattern)(l.builtIn.exists);
226
- const notExistsFunc = (0, import_expressionHelpers.funcGroupGraphPattern)(l.builtIn.notexists);
227
- const aggregateCount = {
228
- name: (0, import_core.unCapitalize)(l.builtIn.count.name),
229
- impl: ({ ACTION, CONSUME, SUBRULE, OR, OPTION }) => (C) => {
230
- const operatorToken = CONSUME(l.builtIn.count);
231
- CONSUME(l.symbols.LParen);
232
- const distinctToken = OPTION(() => CONSUME(l.distinct));
233
- const expressionVal = OR([
234
- { ALT: () => {
235
- const starToken = CONSUME(l.symbols.star);
236
- return ACTION(() => C.astFactory.wildcard(C.astFactory.sourceLocation(starToken)));
237
- } },
238
- { ALT: () => SUBRULE(import_expression.expression) }
239
- ]);
240
- const closeToken = CONSUME(l.symbols.RParen);
241
- return ACTION(() => {
242
- const F = C.astFactory;
243
- if (C.astFactory.isWildcard(expressionVal)) {
244
- return F.aggregate(operatorToken.image, Boolean(distinctToken), expressionVal, void 0, C.astFactory.sourceLocation(operatorToken, closeToken));
245
- }
246
- return F.aggregate(operatorToken.image, Boolean(distinctToken), expressionVal, void 0, C.astFactory.sourceLocation(operatorToken, closeToken));
247
- });
248
- }
167
+ /**
168
+ * [[122]](https://www.w3.org/TR/sparql11-query/#rBuiltInCall)
169
+ */
170
+ exports.regexExpression = (0, expressionHelpers_js_1.funcExpr2or3)(l.builtIn.regex);
171
+ /**
172
+ * [[123]](https://www.w3.org/TR/sparql11-query/#rBuiltInCall)
173
+ */
174
+ exports.substringExpression = (0, expressionHelpers_js_1.funcExpr2or3)(l.builtIn.substr);
175
+ /**
176
+ * [[124]](https://www.w3.org/TR/sparql11-query/#rBuiltInCall)
177
+ */
178
+ exports.strReplaceExpression = (0, expressionHelpers_js_1.funcExpr3or4)(l.builtIn.replace);
179
+ /**
180
+ * [[125]](https://www.w3.org/TR/sparql11-query/#rBuiltInCall)
181
+ */
182
+ exports.existsFunc = (0, expressionHelpers_js_1.funcGroupGraphPattern)(l.builtIn.exists);
183
+ /**
184
+ * [[126]](https://www.w3.org/TR/sparql11-query/#rBuiltInCall)
185
+ */
186
+ exports.notExistsFunc = (0, expressionHelpers_js_1.funcGroupGraphPattern)(l.builtIn.notexists);
187
+ exports.aggregateCount = {
188
+ name: (0, core_1.unCapitalize)(l.builtIn.count.name),
189
+ impl: ({ ACTION, CONSUME, SUBRULE, OR, OPTION }) => (C) => {
190
+ const operatorToken = CONSUME(l.builtIn.count);
191
+ CONSUME(l.symbols.LParen);
192
+ const distinctToken = OPTION(() => CONSUME(l.distinct));
193
+ const expressionVal = OR([
194
+ { ALT: () => {
195
+ const starToken = CONSUME(l.symbols.star);
196
+ return ACTION(() => C.astFactory.wildcard(C.astFactory.sourceLocation(starToken)));
197
+ } },
198
+ { ALT: () => SUBRULE(expression_js_1.expression) },
199
+ ]);
200
+ const closeToken = CONSUME(l.symbols.RParen);
201
+ return ACTION(() => {
202
+ const F = C.astFactory;
203
+ if (C.astFactory.isWildcard(expressionVal)) {
204
+ return F.aggregate(operatorToken.image, Boolean(distinctToken), expressionVal, undefined, C.astFactory.sourceLocation(operatorToken, closeToken));
205
+ }
206
+ return F.aggregate(operatorToken.image, Boolean(distinctToken), expressionVal, undefined, C.astFactory.sourceLocation(operatorToken, closeToken));
207
+ });
208
+ },
249
209
  };
250
- const aggregateSum = (0, import_expressionHelpers.baseAggregateFunc)(l.builtIn.sum);
251
- const aggregateMin = (0, import_expressionHelpers.baseAggregateFunc)(l.builtIn.min);
252
- const aggregateMax = (0, import_expressionHelpers.baseAggregateFunc)(l.builtIn.max);
253
- const aggregateAvg = (0, import_expressionHelpers.baseAggregateFunc)(l.builtIn.avg);
254
- const aggregateSample = (0, import_expressionHelpers.baseAggregateFunc)(l.builtIn.sample);
255
- const aggregateGroup_concat = {
256
- name: (0, import_core.unCapitalize)(l.builtIn.groupConcat.name),
257
- impl: ({ ACTION, CONSUME, OPTION1, SUBRULE, OPTION2 }) => (C) => {
258
- const operatorToken = CONSUME(l.builtIn.groupConcat);
259
- CONSUME(l.symbols.LParen);
260
- const distinctToken = OPTION1(() => CONSUME(l.distinct));
261
- const expr = SUBRULE(import_expression.expression);
262
- const sep = OPTION2(() => {
263
- CONSUME(l.symbols.semi);
264
- CONSUME(l.separator);
265
- CONSUME(l.symbols.equal);
266
- return SUBRULE(import_literals.string);
267
- });
268
- const closeToken = CONSUME(l.symbols.RParen);
269
- return ACTION(() => {
270
- const F = C.astFactory;
271
- return F.aggregate(operatorToken.image, Boolean(distinctToken), expr, sep?.value ?? " ", F.sourceLocation(operatorToken, closeToken));
272
- });
273
- }
210
+ exports.aggregateSum = (0, expressionHelpers_js_1.baseAggregateFunc)(l.builtIn.sum);
211
+ exports.aggregateMin = (0, expressionHelpers_js_1.baseAggregateFunc)(l.builtIn.min);
212
+ exports.aggregateMax = (0, expressionHelpers_js_1.baseAggregateFunc)(l.builtIn.max);
213
+ exports.aggregateAvg = (0, expressionHelpers_js_1.baseAggregateFunc)(l.builtIn.avg);
214
+ exports.aggregateSample = (0, expressionHelpers_js_1.baseAggregateFunc)(l.builtIn.sample);
215
+ exports.aggregateGroup_concat = {
216
+ name: (0, core_1.unCapitalize)(l.builtIn.groupConcat.name),
217
+ impl: ({ ACTION, CONSUME, OPTION1, SUBRULE, OPTION2 }) => (C) => {
218
+ const operatorToken = CONSUME(l.builtIn.groupConcat);
219
+ CONSUME(l.symbols.LParen);
220
+ const distinctToken = OPTION1(() => CONSUME(l.distinct));
221
+ const expr = SUBRULE(expression_js_1.expression);
222
+ const sep = OPTION2(() => {
223
+ CONSUME(l.symbols.semi);
224
+ CONSUME(l.separator);
225
+ CONSUME(l.symbols.equal);
226
+ return SUBRULE(literals_js_1.string);
227
+ });
228
+ const closeToken = CONSUME(l.symbols.RParen);
229
+ return ACTION(() => {
230
+ const F = C.astFactory;
231
+ return F.aggregate(operatorToken.image, Boolean(distinctToken), expr, sep?.value ?? ' ', F.sourceLocation(operatorToken, closeToken));
232
+ });
233
+ },
274
234
  };
275
- const aggregate = {
276
- name: "aggregate",
277
- impl: ({ ACTION, SUBRULE, OR }) => (C) => {
278
- const wasInAggregate = ACTION(() => C.parseMode.has("inAggregate"));
279
- ACTION(() => C.parseMode.add("inAggregate"));
280
- const result = OR([
281
- { ALT: () => SUBRULE(aggregateCount) },
282
- { ALT: () => SUBRULE(aggregateSum) },
283
- { ALT: () => SUBRULE(aggregateMin) },
284
- { ALT: () => SUBRULE(aggregateMax) },
285
- { ALT: () => SUBRULE(aggregateAvg) },
286
- { ALT: () => SUBRULE(aggregateSample) },
287
- { ALT: () => SUBRULE(aggregateGroup_concat) }
288
- ]);
289
- ACTION(() => !wasInAggregate && C.parseMode.delete("inAggregate"));
290
- ACTION(() => {
291
- if (!C.parseMode.has("canParseAggregate")) {
292
- throw new Error("Aggregates are only allowed in SELECT, HAVING, and ORDER BY clauses.");
293
- }
294
- if (C.parseMode.has("inAggregate")) {
295
- throw new Error("An aggregate function is not allowed within an aggregate function.");
296
- }
297
- });
298
- return result;
299
- },
300
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F }) => {
301
- F.printFilter(ast, () => {
302
- PRINT_WORD(ast.aggregation.toUpperCase(), "(");
303
- if (ast.distinct) {
304
- PRINT_WORD("DISTINCT");
305
- }
306
- });
307
- const arg = ast.expression[0];
308
- if (F.isWildcard(arg)) {
309
- F.printFilter(ast, () => PRINT_WORD("*"));
310
- } else {
311
- SUBRULE(import_expression.expression, arg);
312
- }
313
- if (F.isExpressionAggregateSeparator(ast)) {
314
- F.printFilter(ast, () => PRINT_WORD(";", "SEPARATOR", "=", (0, import_literals.stringEscapedLexical)(ast.separator)));
315
- }
316
- F.printFilter(ast, () => PRINT_WORD(")"));
317
- }
235
+ /**
236
+ * [[127]](https://www.w3.org/TR/sparql11-query/#rBuiltInCall)
237
+ */
238
+ exports.aggregate = {
239
+ name: 'aggregate',
240
+ impl: ({ ACTION, SUBRULE, OR }) => (C) => {
241
+ // https://www.w3.org/2013/sparql-errata#errata-query-5 - Or note 15 in SPARQL1.2 spec
242
+ // An aggregate function is not allowed within an aggregate function.
243
+ const wasInAggregate = ACTION(() => C.parseMode.has('inAggregate'));
244
+ ACTION(() => C.parseMode.add('inAggregate'));
245
+ const result = OR([
246
+ { ALT: () => SUBRULE(exports.aggregateCount) },
247
+ { ALT: () => SUBRULE(exports.aggregateSum) },
248
+ { ALT: () => SUBRULE(exports.aggregateMin) },
249
+ { ALT: () => SUBRULE(exports.aggregateMax) },
250
+ { ALT: () => SUBRULE(exports.aggregateAvg) },
251
+ { ALT: () => SUBRULE(exports.aggregateSample) },
252
+ { ALT: () => SUBRULE(exports.aggregateGroup_concat) },
253
+ ]);
254
+ ACTION(() => !wasInAggregate && C.parseMode.delete('inAggregate'));
255
+ ACTION(() => {
256
+ if (!C.parseMode.has('canParseAggregate')) {
257
+ throw new Error('Aggregates are only allowed in SELECT, HAVING, and ORDER BY clauses.');
258
+ }
259
+ if (C.parseMode.has('inAggregate')) {
260
+ throw new Error('An aggregate function is not allowed within an aggregate function.');
261
+ }
262
+ });
263
+ return result;
264
+ },
265
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F }) => {
266
+ F.printFilter(ast, () => {
267
+ PRINT_WORD(ast.aggregation.toUpperCase(), '(');
268
+ if (ast.distinct) {
269
+ PRINT_WORD('DISTINCT');
270
+ }
271
+ });
272
+ const arg = ast.expression[0];
273
+ if (F.isWildcard(arg)) {
274
+ F.printFilter(ast, () => PRINT_WORD('*'));
275
+ }
276
+ else {
277
+ SUBRULE(expression_js_1.expression, arg);
278
+ }
279
+ if (F.isExpressionAggregateSeparator(ast)) {
280
+ F.printFilter(ast, () => PRINT_WORD(';', 'SEPARATOR', '=', (0, literals_js_1.stringEscapedLexical)(ast.separator)));
281
+ }
282
+ F.printFilter(ast, () => PRINT_WORD(')'));
283
+ },
318
284
  };
319
- // Annotate the CommonJS export names for ESM import in node:
320
- 0 && (module.exports = {
321
- aggregate,
322
- aggregateAvg,
323
- aggregateCount,
324
- aggregateGroup_concat,
325
- aggregateMax,
326
- aggregateMin,
327
- aggregateSample,
328
- aggregateSum,
329
- builtInAbs,
330
- builtInBnodeSparqlJs,
331
- builtInBound,
332
- builtInCall,
333
- builtInCallList,
334
- builtInCeil,
335
- builtInCoalesce,
336
- builtInConcat,
337
- builtInContains,
338
- builtInDatatype,
339
- builtInDay,
340
- builtInEncode_for_uri,
341
- builtInFloor,
342
- builtInHours,
343
- builtInIf,
344
- builtInIri,
345
- builtInIsblank,
346
- builtInIsiri,
347
- builtInIsliteral,
348
- builtInIsnumeric,
349
- builtInIsuri,
350
- builtInLang,
351
- builtInLangmatches,
352
- builtInLcase,
353
- builtInMd5,
354
- builtInMinutes,
355
- builtInMonth,
356
- builtInNow,
357
- builtInRand,
358
- builtInRound,
359
- builtInSameterm,
360
- builtInSeconds,
361
- builtInSha1,
362
- builtInSha256,
363
- builtInSha384,
364
- builtInSha512,
365
- builtInStr,
366
- builtInStrafter,
367
- builtInStrbefore,
368
- builtInStrdt,
369
- builtInStrends,
370
- builtInStrlang,
371
- builtInStrlen,
372
- builtInStrstarts,
373
- builtInStruuid,
374
- builtInTimezone,
375
- builtInTz,
376
- builtInUcase,
377
- builtInUri,
378
- builtInUuid,
379
- builtInYear,
380
- existsFunc,
381
- notExistsFunc,
382
- regexExpression,
383
- strReplaceExpression,
384
- substringExpression
385
- });
285
+ //# sourceMappingURL=builtIn.js.map