@traqula/rules-sparql-1-1 0.0.21 → 0.0.22
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/dist/cjs/lib/MinimalSparqlParser.js +64 -0
- package/dist/cjs/lib/Sparql11types.js +16 -0
- package/dist/cjs/lib/astFactory.js +121 -0
- package/dist/cjs/lib/expressionHelpers.js +215 -0
- package/dist/cjs/lib/factoryMixins/ContextFactory.js +55 -0
- package/dist/cjs/lib/factoryMixins/ExpressionFactory.js +105 -0
- package/dist/cjs/lib/factoryMixins/GraphRefFactory.js +76 -0
- package/dist/cjs/lib/factoryMixins/PathFactory.js +90 -0
- package/dist/cjs/lib/factoryMixins/Patternfactory.js +123 -0
- package/dist/cjs/lib/factoryMixins/QueryFactory.js +68 -0
- package/dist/cjs/lib/factoryMixins/SolutionModifiersFactory.js +80 -0
- package/dist/cjs/lib/factoryMixins/TermFactory.js +105 -0
- package/dist/cjs/lib/factoryMixins/UpdateOperationFactory.js +150 -0
- package/dist/cjs/lib/factoryMixins/mixins.js +43 -0
- package/dist/cjs/lib/grammar/builtIn.js +385 -0
- package/dist/cjs/lib/grammar/dataSetClause.js +118 -0
- package/dist/cjs/lib/grammar/expression.js +384 -0
- package/dist/cjs/lib/grammar/general.js +168 -0
- package/dist/cjs/lib/grammar/index.js +115 -0
- package/dist/cjs/lib/grammar/literals.js +282 -0
- package/dist/cjs/lib/grammar/propertyPaths.js +206 -0
- package/dist/cjs/lib/grammar/queryUnit.js +390 -0
- package/dist/cjs/lib/grammar/solutionModifier.js +280 -0
- package/dist/cjs/lib/grammar/tripleBlock.js +384 -0
- package/dist/cjs/lib/grammar/updateUnit.js +546 -0
- package/dist/cjs/lib/grammar/whereClause.js +483 -0
- package/dist/cjs/lib/index.js +56 -0
- package/dist/cjs/lib/lexer/BuiltInCalls.js +337 -0
- package/dist/cjs/lib/lexer/graph.js +41 -0
- package/dist/cjs/lib/lexer/index.js +50 -0
- package/dist/cjs/lib/lexer/lexer.js +199 -0
- package/dist/cjs/lib/lexer/lexerPatterns.js +133 -0
- package/dist/cjs/lib/lexer/symbols.js +107 -0
- package/dist/cjs/lib/lexer/terminals.js +103 -0
- package/dist/cjs/lib/sparql11HelperTypes.js +16 -0
- package/dist/cjs/lib/utils.js +64 -0
- package/dist/cjs/lib/validation/validators.js +214 -0
- package/dist/esm/lib/MinimalSparqlParser.js.map +1 -0
- package/dist/esm/lib/Sparql11types.js.map +1 -0
- package/dist/esm/lib/astFactory.js.map +1 -0
- package/{lib → dist/esm/lib}/expressionHelpers.d.ts +1 -1
- package/dist/esm/lib/expressionHelpers.js.map +1 -0
- package/dist/esm/lib/factoryMixins/ContextFactory.js.map +1 -0
- package/dist/esm/lib/factoryMixins/ExpressionFactory.js.map +1 -0
- package/dist/esm/lib/factoryMixins/GraphRefFactory.js.map +1 -0
- package/dist/esm/lib/factoryMixins/PathFactory.js.map +1 -0
- package/dist/esm/lib/factoryMixins/Patternfactory.js.map +1 -0
- package/dist/esm/lib/factoryMixins/QueryFactory.js.map +1 -0
- package/dist/esm/lib/factoryMixins/SolutionModifiersFactory.js.map +1 -0
- package/dist/esm/lib/factoryMixins/TermFactory.js.map +1 -0
- package/dist/esm/lib/factoryMixins/UpdateOperationFactory.js.map +1 -0
- package/dist/esm/lib/factoryMixins/mixins.js.map +1 -0
- package/{lib → dist/esm/lib}/grammar/builtIn.d.ts +1 -1
- package/dist/esm/lib/grammar/builtIn.js.map +1 -0
- package/{lib → dist/esm/lib}/grammar/dataSetClause.d.ts +1 -1
- package/dist/esm/lib/grammar/dataSetClause.js.map +1 -0
- package/dist/esm/lib/grammar/expression.js.map +1 -0
- package/dist/esm/lib/grammar/general.js.map +1 -0
- package/dist/esm/lib/grammar/index.js.map +1 -0
- package/dist/esm/lib/grammar/literals.js.map +1 -0
- package/{lib → dist/esm/lib}/grammar/propertyPaths.d.ts +3 -3
- package/dist/esm/lib/grammar/propertyPaths.js.map +1 -0
- package/dist/esm/lib/grammar/queryUnit.js.map +1 -0
- package/dist/esm/lib/grammar/solutionModifier.js.map +1 -0
- package/{lib → dist/esm/lib}/grammar/tripleBlock.d.ts +4 -4
- package/dist/esm/lib/grammar/tripleBlock.js.map +1 -0
- package/dist/esm/lib/grammar/updateUnit.js.map +1 -0
- package/dist/esm/lib/grammar/whereClause.js.map +1 -0
- package/dist/esm/lib/index.js.map +1 -0
- package/{lib → dist/esm/lib}/lexer/BuiltInCalls.d.ts +1 -1
- package/dist/esm/lib/lexer/BuiltInCalls.js.map +1 -0
- package/{lib → dist/esm/lib}/lexer/graph.d.ts +1 -1
- package/dist/esm/lib/lexer/graph.js.map +1 -0
- package/dist/esm/lib/lexer/index.js.map +1 -0
- package/{lib → dist/esm/lib}/lexer/lexer.d.ts +2 -2
- package/dist/esm/lib/lexer/lexer.js.map +1 -0
- package/dist/esm/lib/lexer/lexerPatterns.js.map +1 -0
- package/{lib → dist/esm/lib}/lexer/symbols.d.ts +1 -1
- package/dist/esm/lib/lexer/symbols.js.map +1 -0
- package/{lib → dist/esm/lib}/lexer/terminals.d.ts +1 -1
- package/{lib → dist/esm/lib}/lexer/terminals.js +1 -1
- package/dist/esm/lib/lexer/terminals.js.map +1 -0
- package/dist/esm/lib/sparql11HelperTypes.js.map +1 -0
- package/dist/esm/lib/utils.js.map +1 -0
- package/dist/esm/lib/validation/validators.js.map +1 -0
- package/package.json +13 -18
- package/lib/MinimalSparqlParser.js.map +0 -1
- package/lib/Sparql11types.js.map +0 -1
- package/lib/astFactory.js.map +0 -1
- package/lib/expressionHelpers.js.map +0 -1
- package/lib/factoryMixins/ContextFactory.js.map +0 -1
- package/lib/factoryMixins/ExpressionFactory.js.map +0 -1
- package/lib/factoryMixins/GraphRefFactory.js.map +0 -1
- package/lib/factoryMixins/PathFactory.js.map +0 -1
- package/lib/factoryMixins/Patternfactory.js.map +0 -1
- package/lib/factoryMixins/QueryFactory.js.map +0 -1
- package/lib/factoryMixins/SolutionModifiersFactory.js.map +0 -1
- package/lib/factoryMixins/TermFactory.js.map +0 -1
- package/lib/factoryMixins/UpdateOperationFactory.js.map +0 -1
- package/lib/factoryMixins/mixins.js.map +0 -1
- package/lib/grammar/builtIn.js.map +0 -1
- package/lib/grammar/dataSetClause.js.map +0 -1
- package/lib/grammar/expression.js.map +0 -1
- package/lib/grammar/general.js.map +0 -1
- package/lib/grammar/index.js.map +0 -1
- package/lib/grammar/literals.js.map +0 -1
- package/lib/grammar/propertyPaths.js.map +0 -1
- package/lib/grammar/queryUnit.js.map +0 -1
- package/lib/grammar/solutionModifier.js.map +0 -1
- package/lib/grammar/tripleBlock.js.map +0 -1
- package/lib/grammar/updateUnit.js.map +0 -1
- package/lib/grammar/whereClause.js.map +0 -1
- package/lib/index.cjs +0 -14673
- package/lib/index.js.map +0 -1
- package/lib/lexer/BuiltInCalls.js.map +0 -1
- package/lib/lexer/graph.js.map +0 -1
- package/lib/lexer/index.js.map +0 -1
- package/lib/lexer/lexer.js.map +0 -1
- package/lib/lexer/lexerPatterns.js.map +0 -1
- package/lib/lexer/symbols.js.map +0 -1
- package/lib/lexer/terminals.js.map +0 -1
- package/lib/sparql11HelperTypes.js.map +0 -1
- package/lib/utils.js.map +0 -1
- package/lib/validation/validators.js.map +0 -1
- /package/{lib → dist/esm/lib}/MinimalSparqlParser.d.ts +0 -0
- /package/{lib → dist/esm/lib}/MinimalSparqlParser.js +0 -0
- /package/{lib → dist/esm/lib}/Sparql11types.d.ts +0 -0
- /package/{lib → dist/esm/lib}/Sparql11types.js +0 -0
- /package/{lib → dist/esm/lib}/astFactory.d.ts +0 -0
- /package/{lib → dist/esm/lib}/astFactory.js +0 -0
- /package/{lib → dist/esm/lib}/expressionHelpers.js +0 -0
- /package/{lib → dist/esm/lib}/factoryMixins/ContextFactory.d.ts +0 -0
- /package/{lib → dist/esm/lib}/factoryMixins/ContextFactory.js +0 -0
- /package/{lib → dist/esm/lib}/factoryMixins/ExpressionFactory.d.ts +0 -0
- /package/{lib → dist/esm/lib}/factoryMixins/ExpressionFactory.js +0 -0
- /package/{lib → dist/esm/lib}/factoryMixins/GraphRefFactory.d.ts +0 -0
- /package/{lib → dist/esm/lib}/factoryMixins/GraphRefFactory.js +0 -0
- /package/{lib → dist/esm/lib}/factoryMixins/PathFactory.d.ts +0 -0
- /package/{lib → dist/esm/lib}/factoryMixins/PathFactory.js +0 -0
- /package/{lib → dist/esm/lib}/factoryMixins/Patternfactory.d.ts +0 -0
- /package/{lib → dist/esm/lib}/factoryMixins/Patternfactory.js +0 -0
- /package/{lib → dist/esm/lib}/factoryMixins/QueryFactory.d.ts +0 -0
- /package/{lib → dist/esm/lib}/factoryMixins/QueryFactory.js +0 -0
- /package/{lib → dist/esm/lib}/factoryMixins/SolutionModifiersFactory.d.ts +0 -0
- /package/{lib → dist/esm/lib}/factoryMixins/SolutionModifiersFactory.js +0 -0
- /package/{lib → dist/esm/lib}/factoryMixins/TermFactory.d.ts +0 -0
- /package/{lib → dist/esm/lib}/factoryMixins/TermFactory.js +0 -0
- /package/{lib → dist/esm/lib}/factoryMixins/UpdateOperationFactory.d.ts +0 -0
- /package/{lib → dist/esm/lib}/factoryMixins/UpdateOperationFactory.js +0 -0
- /package/{lib → dist/esm/lib}/factoryMixins/mixins.d.ts +0 -0
- /package/{lib → dist/esm/lib}/factoryMixins/mixins.js +0 -0
- /package/{lib → dist/esm/lib}/grammar/builtIn.js +0 -0
- /package/{lib → dist/esm/lib}/grammar/dataSetClause.js +0 -0
- /package/{lib → dist/esm/lib}/grammar/expression.d.ts +0 -0
- /package/{lib → dist/esm/lib}/grammar/expression.js +0 -0
- /package/{lib → dist/esm/lib}/grammar/general.d.ts +0 -0
- /package/{lib → dist/esm/lib}/grammar/general.js +0 -0
- /package/{lib → dist/esm/lib}/grammar/index.d.ts +0 -0
- /package/{lib → dist/esm/lib}/grammar/index.js +0 -0
- /package/{lib → dist/esm/lib}/grammar/literals.d.ts +0 -0
- /package/{lib → dist/esm/lib}/grammar/literals.js +0 -0
- /package/{lib → dist/esm/lib}/grammar/propertyPaths.js +0 -0
- /package/{lib → dist/esm/lib}/grammar/queryUnit.d.ts +0 -0
- /package/{lib → dist/esm/lib}/grammar/queryUnit.js +0 -0
- /package/{lib → dist/esm/lib}/grammar/solutionModifier.d.ts +0 -0
- /package/{lib → dist/esm/lib}/grammar/solutionModifier.js +0 -0
- /package/{lib → dist/esm/lib}/grammar/tripleBlock.js +0 -0
- /package/{lib → dist/esm/lib}/grammar/updateUnit.d.ts +0 -0
- /package/{lib → dist/esm/lib}/grammar/updateUnit.js +0 -0
- /package/{lib → dist/esm/lib}/grammar/whereClause.d.ts +0 -0
- /package/{lib → dist/esm/lib}/grammar/whereClause.js +0 -0
- /package/{lib → dist/esm/lib}/index.d.ts +0 -0
- /package/{lib → dist/esm/lib}/index.js +0 -0
- /package/{lib → dist/esm/lib}/lexer/BuiltInCalls.js +0 -0
- /package/{lib → dist/esm/lib}/lexer/graph.js +0 -0
- /package/{lib → dist/esm/lib}/lexer/index.d.ts +0 -0
- /package/{lib → dist/esm/lib}/lexer/index.js +0 -0
- /package/{lib → dist/esm/lib}/lexer/lexer.js +0 -0
- /package/{lib → dist/esm/lib}/lexer/lexerPatterns.d.ts +0 -0
- /package/{lib → dist/esm/lib}/lexer/lexerPatterns.js +0 -0
- /package/{lib → dist/esm/lib}/lexer/symbols.js +0 -0
- /package/{lib → dist/esm/lib}/sparql11HelperTypes.d.ts +0 -0
- /package/{lib → dist/esm/lib}/sparql11HelperTypes.js +0 -0
- /package/{lib → dist/esm/lib}/utils.d.ts +0 -0
- /package/{lib → dist/esm/lib}/utils.js +0 -0
- /package/{lib → dist/esm/lib}/validation/validators.d.ts +0 -0
- /package/{lib → dist/esm/lib}/validation/validators.js +0 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var lexerPatterns_exports = {};
|
|
20
|
+
__export(lexerPatterns_exports, {
|
|
21
|
+
anonPattern: () => anonPattern,
|
|
22
|
+
atLeastOneBlankPattern: () => atLeastOneBlankPattern,
|
|
23
|
+
blankNodeLabelPattern: () => blankNodeLabelPattern,
|
|
24
|
+
commentPattern: () => commentPattern,
|
|
25
|
+
decimalNegativePattern: () => decimalNegativePattern,
|
|
26
|
+
decimalPattern: () => decimalPattern,
|
|
27
|
+
decimalPositivePattern: () => decimalPositivePattern,
|
|
28
|
+
doubleNegativePattern: () => doubleNegativePattern,
|
|
29
|
+
doublePattern: () => doublePattern,
|
|
30
|
+
doublePositivePattern: () => doublePositivePattern,
|
|
31
|
+
echarPattern: () => echarPattern,
|
|
32
|
+
exponentPattern: () => exponentPattern,
|
|
33
|
+
integerNegativePattern: () => integerNegativePattern,
|
|
34
|
+
integerPattern: () => integerPattern,
|
|
35
|
+
interferePositivePattern: () => interferePositivePattern,
|
|
36
|
+
iriRefPattern: () => iriRefPattern,
|
|
37
|
+
langTagPattern: () => langTagPattern,
|
|
38
|
+
nilPattern: () => nilPattern,
|
|
39
|
+
pNameLnPattern: () => pNameLnPattern,
|
|
40
|
+
pNameNsPattern: () => pNameNsPattern,
|
|
41
|
+
percentPattern: () => percentPattern,
|
|
42
|
+
plxPattern: () => plxPattern,
|
|
43
|
+
pnCharsBasePattern: () => pnCharsBasePattern,
|
|
44
|
+
pnCharsPattern: () => pnCharsPattern,
|
|
45
|
+
pnCharsUPattern: () => pnCharsUPattern,
|
|
46
|
+
pnLocalEscPattern: () => pnLocalEscPattern,
|
|
47
|
+
pnLocalPattern: () => pnLocalPattern,
|
|
48
|
+
pnPrefixPattern: () => pnPrefixPattern,
|
|
49
|
+
stringLiteral1Pattern: () => stringLiteral1Pattern,
|
|
50
|
+
stringLiteral2Pattern: () => stringLiteral2Pattern,
|
|
51
|
+
stringLiteralLong1Pattern: () => stringLiteralLong1Pattern,
|
|
52
|
+
stringLiteralLong2Pattern: () => stringLiteralLong2Pattern,
|
|
53
|
+
var1Pattern: () => var1Pattern,
|
|
54
|
+
var2Pattern: () => var2Pattern,
|
|
55
|
+
varNamePattern: () => varNamePattern,
|
|
56
|
+
wsPattern: () => wsPattern
|
|
57
|
+
});
|
|
58
|
+
module.exports = __toCommonJS(lexerPatterns_exports);
|
|
59
|
+
const pnCharsBasePattern = /[A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF]/;
|
|
60
|
+
const pnCharsUPattern = new RegExp(`${pnCharsBasePattern.source}|_`);
|
|
61
|
+
const varNamePattern = new RegExp(`((${pnCharsUPattern.source})|[0-9])((${pnCharsUPattern.source})|[0-9]|[\xB7\u0300-\u036F\u203F-\u2040])*`);
|
|
62
|
+
const iriRefPattern = /<([^\u0000-\u0020"<>\\^`{|}])*>/;
|
|
63
|
+
const pnCharsPattern = new RegExp(`(${pnCharsUPattern.source})|[\\-0-9\xB7\u0300-\u036F\u203F-\u2040]`);
|
|
64
|
+
const pnPrefixPattern = new RegExp(`(${pnCharsBasePattern.source})(((${pnCharsPattern.source})|\\.)*(${pnCharsPattern.source}))?`);
|
|
65
|
+
const pNameNsPattern = new RegExp(`(${pnPrefixPattern.source})?:`);
|
|
66
|
+
const percentPattern = /%[\dA-Fa-f]{2}/;
|
|
67
|
+
const pnLocalEscPattern = /\\[!#$%&'()*+,./;=?@\\_~-]/;
|
|
68
|
+
const plxPattern = new RegExp(`(${percentPattern.source})|(${pnLocalEscPattern.source})`);
|
|
69
|
+
const pnLocalPattern = new RegExp(`((${pnCharsUPattern.source})|:|[0-9]|(${plxPattern.source}))(((${pnCharsPattern.source})|\\.|:|(${plxPattern.source}))*((${pnCharsPattern.source})|:|(${plxPattern.source})))?`);
|
|
70
|
+
const pNameLnPattern = new RegExp(`(${pNameNsPattern.source})(${pnLocalPattern.source})`);
|
|
71
|
+
const blankNodeLabelPattern = new RegExp(`_:((${pnCharsUPattern.source})|[0-9])(((${pnCharsPattern.source})|\\.)*(${pnCharsPattern.source}))?`);
|
|
72
|
+
const var1Pattern = new RegExp(`\\?(${varNamePattern.source})`);
|
|
73
|
+
const var2Pattern = new RegExp(`\\$(${varNamePattern.source})`);
|
|
74
|
+
const langTagPattern = /@[A-Za-z]+(-[\dA-Za-z]+)*/;
|
|
75
|
+
const integerPattern = /\d+/;
|
|
76
|
+
const decimalPattern = /\d+\.\d+/;
|
|
77
|
+
const exponentPattern = /[Ee][+-]?\d+/;
|
|
78
|
+
const doublePattern = new RegExp(`([0-9]+\\.[0-9]*(${exponentPattern.source}))|(\\.[0-9]+(${exponentPattern.source}))|([0-9]+(${exponentPattern.source}))`);
|
|
79
|
+
const interferePositivePattern = new RegExp(`\\+${integerPattern.source}`);
|
|
80
|
+
const decimalPositivePattern = new RegExp(`\\+${decimalPattern.source}`);
|
|
81
|
+
const doublePositivePattern = new RegExp(`\\+${doublePattern.source}`);
|
|
82
|
+
const integerNegativePattern = new RegExp(`-${integerPattern.source}`);
|
|
83
|
+
const decimalNegativePattern = new RegExp(`-${decimalPattern.source}`);
|
|
84
|
+
const doubleNegativePattern = new RegExp(`-${doublePattern.source}`);
|
|
85
|
+
const echarPattern = /\\[\\"'bfnrt]/u;
|
|
86
|
+
const stringLiteral1Pattern = new RegExp(`'(([^\\u0027\\u005C\\u000A\r])|(${echarPattern.source}))*'`);
|
|
87
|
+
const stringLiteral2Pattern = new RegExp(`"(([^\\u0022\\u005C\\u000A\\u000D])|(${echarPattern.source}))*"`);
|
|
88
|
+
const stringLiteralLong1Pattern = new RegExp(`'''(('|(''))?([^'\\\\]|(${echarPattern.source})))*'''`);
|
|
89
|
+
const stringLiteralLong2Pattern = new RegExp(`"""(("|(""))?([^"\\\\]|(${echarPattern.source})))*"""`);
|
|
90
|
+
const wsPattern = /[\u0009\u000A\u000D ]/;
|
|
91
|
+
const nilPattern = new RegExp(`\\((${wsPattern.source})*\\)`);
|
|
92
|
+
const anonPattern = new RegExp(`\\[(${wsPattern.source})*\\]`);
|
|
93
|
+
const commentPattern = /#[^\n]*\n/;
|
|
94
|
+
const atLeastOneBlankPattern = new RegExp(`((${wsPattern.source}+)|(${commentPattern.source}))+`);
|
|
95
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
96
|
+
0 && (module.exports = {
|
|
97
|
+
anonPattern,
|
|
98
|
+
atLeastOneBlankPattern,
|
|
99
|
+
blankNodeLabelPattern,
|
|
100
|
+
commentPattern,
|
|
101
|
+
decimalNegativePattern,
|
|
102
|
+
decimalPattern,
|
|
103
|
+
decimalPositivePattern,
|
|
104
|
+
doubleNegativePattern,
|
|
105
|
+
doublePattern,
|
|
106
|
+
doublePositivePattern,
|
|
107
|
+
echarPattern,
|
|
108
|
+
exponentPattern,
|
|
109
|
+
integerNegativePattern,
|
|
110
|
+
integerPattern,
|
|
111
|
+
interferePositivePattern,
|
|
112
|
+
iriRefPattern,
|
|
113
|
+
langTagPattern,
|
|
114
|
+
nilPattern,
|
|
115
|
+
pNameLnPattern,
|
|
116
|
+
pNameNsPattern,
|
|
117
|
+
percentPattern,
|
|
118
|
+
plxPattern,
|
|
119
|
+
pnCharsBasePattern,
|
|
120
|
+
pnCharsPattern,
|
|
121
|
+
pnCharsUPattern,
|
|
122
|
+
pnLocalEscPattern,
|
|
123
|
+
pnLocalPattern,
|
|
124
|
+
pnPrefixPattern,
|
|
125
|
+
stringLiteral1Pattern,
|
|
126
|
+
stringLiteral2Pattern,
|
|
127
|
+
stringLiteralLong1Pattern,
|
|
128
|
+
stringLiteralLong2Pattern,
|
|
129
|
+
var1Pattern,
|
|
130
|
+
var2Pattern,
|
|
131
|
+
varNamePattern,
|
|
132
|
+
wsPattern
|
|
133
|
+
});
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var symbols_exports = {};
|
|
20
|
+
__export(symbols_exports, {
|
|
21
|
+
LCurly: () => LCurly,
|
|
22
|
+
LParen: () => LParen,
|
|
23
|
+
LSquare: () => LSquare,
|
|
24
|
+
RCurly: () => RCurly,
|
|
25
|
+
RParen: () => RParen,
|
|
26
|
+
RSquare: () => RSquare,
|
|
27
|
+
allSymbols: () => allSymbols,
|
|
28
|
+
comma: () => comma,
|
|
29
|
+
dot: () => dot,
|
|
30
|
+
equal: () => equal,
|
|
31
|
+
exclamation: () => exclamation,
|
|
32
|
+
greaterThan: () => greaterThan,
|
|
33
|
+
greaterThanEqual: () => greaterThanEqual,
|
|
34
|
+
hat: () => hat,
|
|
35
|
+
hathat: () => hathat,
|
|
36
|
+
lessThan: () => lessThan,
|
|
37
|
+
lessThanEqual: () => lessThanEqual,
|
|
38
|
+
logicAnd: () => logicAnd,
|
|
39
|
+
logicOr: () => logicOr,
|
|
40
|
+
notEqual: () => notEqual,
|
|
41
|
+
opMinus: () => opMinus,
|
|
42
|
+
opPlus: () => opPlus,
|
|
43
|
+
pipe: () => pipe,
|
|
44
|
+
question: () => question,
|
|
45
|
+
semi: () => semi,
|
|
46
|
+
slash: () => slash,
|
|
47
|
+
star: () => star
|
|
48
|
+
});
|
|
49
|
+
module.exports = __toCommonJS(symbols_exports);
|
|
50
|
+
var import_core = require("@traqula/core");
|
|
51
|
+
const LCurly = (0, import_core.createToken)({ name: "LCurly", pattern: "{", label: "{" });
|
|
52
|
+
const RCurly = (0, import_core.createToken)({ name: "RCurly", pattern: "}", label: "}" });
|
|
53
|
+
const dot = (0, import_core.createToken)({ name: "Dot", pattern: ".", label: "." });
|
|
54
|
+
const comma = (0, import_core.createToken)({ name: "Comma", pattern: ",", label: "," });
|
|
55
|
+
const semi = (0, import_core.createToken)({ name: "Semi", pattern: ";", label: ";" });
|
|
56
|
+
const LParen = (0, import_core.createToken)({ name: "LParen", pattern: "(", label: "(" });
|
|
57
|
+
const RParen = (0, import_core.createToken)({ name: "RParen", pattern: ")", label: ")" });
|
|
58
|
+
const LSquare = (0, import_core.createToken)({ name: "LSquare", pattern: "[", label: "[" });
|
|
59
|
+
const RSquare = (0, import_core.createToken)({ name: "RSquare", pattern: "]", label: "]" });
|
|
60
|
+
const pipe = (0, import_core.createToken)({ name: "Pipe", pattern: "|", label: "|" });
|
|
61
|
+
const slash = (0, import_core.createToken)({ name: "Slash", pattern: "/", label: "/" });
|
|
62
|
+
const hat = (0, import_core.createToken)({ name: "Hat", pattern: "^", label: "^" });
|
|
63
|
+
const question = (0, import_core.createToken)({ name: "Question", pattern: "?", label: "?" });
|
|
64
|
+
const star = (0, import_core.createToken)({ name: "Star", pattern: "*", label: "*" });
|
|
65
|
+
const opPlus = (0, import_core.createToken)({ name: "OpPlus", pattern: "+", label: "+" });
|
|
66
|
+
const opMinus = (0, import_core.createToken)({ name: "OpMinus", pattern: "-", label: "-" });
|
|
67
|
+
const exclamation = (0, import_core.createToken)({ name: "Exclamation", pattern: "!", label: "!" });
|
|
68
|
+
const logicAnd = (0, import_core.createToken)({ name: "LogicAnd", pattern: "&&", label: "&&" });
|
|
69
|
+
const logicOr = (0, import_core.createToken)({ name: "LogicOr", pattern: "||", label: "||" });
|
|
70
|
+
const equal = (0, import_core.createToken)({ name: "Equal", pattern: "=", label: "=" });
|
|
71
|
+
const notEqual = (0, import_core.createToken)({ name: "NotEqual", pattern: "!=", label: "!=" });
|
|
72
|
+
const lessThan = (0, import_core.createToken)({ name: "LessThan", pattern: "<", label: "<" });
|
|
73
|
+
const greaterThan = (0, import_core.createToken)({ name: "GreaterThan", pattern: ">", label: ">" });
|
|
74
|
+
const lessThanEqual = (0, import_core.createToken)({ name: "LessThanEqual", pattern: "<=", label: "<=" });
|
|
75
|
+
const greaterThanEqual = (0, import_core.createToken)({ name: "GreaterThanEqual", pattern: ">=", label: ">=" });
|
|
76
|
+
const hathat = (0, import_core.createToken)({ name: "Hathat", pattern: "^^", label: "^^" });
|
|
77
|
+
const allSymbols = import_core.LexerBuilder.create().add(logicAnd, logicOr, notEqual, lessThanEqual, greaterThanEqual, LCurly, RCurly, dot, comma, semi, LParen, RParen, LSquare, RSquare, pipe, slash, hathat, hat, question, star, opPlus, opMinus, exclamation, equal, lessThan, greaterThan);
|
|
78
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
79
|
+
0 && (module.exports = {
|
|
80
|
+
LCurly,
|
|
81
|
+
LParen,
|
|
82
|
+
LSquare,
|
|
83
|
+
RCurly,
|
|
84
|
+
RParen,
|
|
85
|
+
RSquare,
|
|
86
|
+
allSymbols,
|
|
87
|
+
comma,
|
|
88
|
+
dot,
|
|
89
|
+
equal,
|
|
90
|
+
exclamation,
|
|
91
|
+
greaterThan,
|
|
92
|
+
greaterThanEqual,
|
|
93
|
+
hat,
|
|
94
|
+
hathat,
|
|
95
|
+
lessThan,
|
|
96
|
+
lessThanEqual,
|
|
97
|
+
logicAnd,
|
|
98
|
+
logicOr,
|
|
99
|
+
notEqual,
|
|
100
|
+
opMinus,
|
|
101
|
+
opPlus,
|
|
102
|
+
pipe,
|
|
103
|
+
question,
|
|
104
|
+
semi,
|
|
105
|
+
slash,
|
|
106
|
+
star
|
|
107
|
+
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var terminals_exports = {};
|
|
20
|
+
__export(terminals_exports, {
|
|
21
|
+
allTerminals: () => allTerminals,
|
|
22
|
+
anon: () => anon,
|
|
23
|
+
blankNodeLabel: () => blankNodeLabel,
|
|
24
|
+
comment: () => comment,
|
|
25
|
+
decimal: () => decimal,
|
|
26
|
+
decimalNegative: () => decimalNegative,
|
|
27
|
+
decimalPositive: () => decimalPositive,
|
|
28
|
+
double: () => double,
|
|
29
|
+
doubleNegative: () => doubleNegative,
|
|
30
|
+
doublePositive: () => doublePositive,
|
|
31
|
+
integer: () => integer,
|
|
32
|
+
integerNegative: () => integerNegative,
|
|
33
|
+
integerPositive: () => integerPositive,
|
|
34
|
+
iriRef: () => iriRef,
|
|
35
|
+
langTag: () => langTag,
|
|
36
|
+
nil: () => nil,
|
|
37
|
+
pNameLn: () => pNameLn,
|
|
38
|
+
pNameNs: () => pNameNs,
|
|
39
|
+
stringLiteral1: () => stringLiteral1,
|
|
40
|
+
stringLiteral2: () => stringLiteral2,
|
|
41
|
+
stringLiteralLong1: () => stringLiteralLong1,
|
|
42
|
+
stringLiteralLong2: () => stringLiteralLong2,
|
|
43
|
+
var1: () => var1,
|
|
44
|
+
var2: () => var2,
|
|
45
|
+
ws: () => ws
|
|
46
|
+
});
|
|
47
|
+
module.exports = __toCommonJS(terminals_exports);
|
|
48
|
+
var import_chevrotain = require("@traqula/chevrotain");
|
|
49
|
+
var import_core = require("@traqula/core");
|
|
50
|
+
var import_lexerPatterns = require("./lexerPatterns.js");
|
|
51
|
+
const iriRef = (0, import_core.createToken)({ name: "IriRef", pattern: import_lexerPatterns.iriRefPattern });
|
|
52
|
+
const pNameLn = (0, import_core.createToken)({ name: "PNameLn", pattern: import_lexerPatterns.pNameLnPattern });
|
|
53
|
+
const pNameNs = (0, import_core.createToken)({ name: "PNameNs", pattern: import_lexerPatterns.pNameNsPattern, longer_alt: [pNameLn] });
|
|
54
|
+
const blankNodeLabel = (0, import_core.createToken)({ name: "BlankNodeLabel", pattern: import_lexerPatterns.blankNodeLabelPattern });
|
|
55
|
+
const var1 = (0, import_core.createToken)({ name: "Var1", pattern: import_lexerPatterns.var1Pattern });
|
|
56
|
+
const var2 = (0, import_core.createToken)({ name: "Var2", pattern: import_lexerPatterns.var2Pattern });
|
|
57
|
+
const langTag = (0, import_core.createToken)({ name: "LangTag", pattern: import_lexerPatterns.langTagPattern });
|
|
58
|
+
const integer = (0, import_core.createToken)({ name: "Integer", pattern: import_lexerPatterns.integerPattern });
|
|
59
|
+
const decimal = (0, import_core.createToken)({ name: "Decimal", pattern: import_lexerPatterns.decimalPattern });
|
|
60
|
+
const double = (0, import_core.createToken)({ name: "Double", pattern: import_lexerPatterns.doublePattern });
|
|
61
|
+
const integerPositive = (0, import_core.createToken)({ name: "InterferePositive", pattern: import_lexerPatterns.interferePositivePattern });
|
|
62
|
+
const decimalPositive = (0, import_core.createToken)({ name: "DecimalPositive", pattern: import_lexerPatterns.decimalPositivePattern });
|
|
63
|
+
const doublePositive = (0, import_core.createToken)({ name: "DoublePositive", pattern: import_lexerPatterns.doublePositivePattern });
|
|
64
|
+
const integerNegative = (0, import_core.createToken)({ name: "IntegerNegative", pattern: import_lexerPatterns.integerNegativePattern });
|
|
65
|
+
const decimalNegative = (0, import_core.createToken)({ name: "DecimalNegative", pattern: import_lexerPatterns.decimalNegativePattern });
|
|
66
|
+
const doubleNegative = (0, import_core.createToken)({ name: "DoubleNegative", pattern: import_lexerPatterns.doubleNegativePattern });
|
|
67
|
+
const stringLiteral1 = (0, import_core.createToken)({ name: "StringLiteral1", pattern: import_lexerPatterns.stringLiteral1Pattern });
|
|
68
|
+
const stringLiteral2 = (0, import_core.createToken)({ name: "StringLiteral2", pattern: import_lexerPatterns.stringLiteral2Pattern });
|
|
69
|
+
const stringLiteralLong1 = (0, import_core.createToken)({ name: "StringLiteralLong1", pattern: import_lexerPatterns.stringLiteralLong1Pattern });
|
|
70
|
+
const stringLiteralLong2 = (0, import_core.createToken)({ name: "StringLiteralLong2", pattern: import_lexerPatterns.stringLiteralLong2Pattern });
|
|
71
|
+
const ws = (0, import_core.createToken)({ name: "Ws", pattern: import_lexerPatterns.wsPattern, group: import_chevrotain.Lexer.SKIPPED });
|
|
72
|
+
const comment = (0, import_core.createToken)({ name: "Comment", pattern: import_lexerPatterns.commentPattern, group: import_chevrotain.Lexer.SKIPPED });
|
|
73
|
+
const nil = (0, import_core.createToken)({ name: "Nil", pattern: import_lexerPatterns.nilPattern });
|
|
74
|
+
const anon = (0, import_core.createToken)({ name: "Anon", pattern: import_lexerPatterns.anonPattern });
|
|
75
|
+
const allTerminals = import_core.LexerBuilder.create().add(iriRef, pNameNs, pNameLn, blankNodeLabel, var1, var2, langTag, double, decimal, integer, integerPositive, decimalPositive, doublePositive, integerNegative, decimalNegative, doubleNegative, stringLiteralLong1, stringLiteralLong2, stringLiteral1, stringLiteral2, ws, comment, nil, anon);
|
|
76
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
77
|
+
0 && (module.exports = {
|
|
78
|
+
allTerminals,
|
|
79
|
+
anon,
|
|
80
|
+
blankNodeLabel,
|
|
81
|
+
comment,
|
|
82
|
+
decimal,
|
|
83
|
+
decimalNegative,
|
|
84
|
+
decimalPositive,
|
|
85
|
+
double,
|
|
86
|
+
doubleNegative,
|
|
87
|
+
doublePositive,
|
|
88
|
+
integer,
|
|
89
|
+
integerNegative,
|
|
90
|
+
integerPositive,
|
|
91
|
+
iriRef,
|
|
92
|
+
langTag,
|
|
93
|
+
nil,
|
|
94
|
+
pNameLn,
|
|
95
|
+
pNameNs,
|
|
96
|
+
stringLiteral1,
|
|
97
|
+
stringLiteral2,
|
|
98
|
+
stringLiteralLong1,
|
|
99
|
+
stringLiteralLong2,
|
|
100
|
+
var1,
|
|
101
|
+
var2,
|
|
102
|
+
ws
|
|
103
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var sparql11HelperTypes_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(sparql11HelperTypes_exports);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var utils_exports = {};
|
|
20
|
+
__export(utils_exports, {
|
|
21
|
+
AstTransformer: () => AstTransformer,
|
|
22
|
+
CommonIRIs: () => CommonIRIs,
|
|
23
|
+
sparqlCodepointEscape: () => sparqlCodepointEscape
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(utils_exports);
|
|
26
|
+
var import_core = require("@traqula/core");
|
|
27
|
+
function sparqlCodepointEscape(input) {
|
|
28
|
+
const sanitizedInput = input.replaceAll(/\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{8})/gu, (_, unicode4, unicode8) => {
|
|
29
|
+
if (unicode4) {
|
|
30
|
+
const charCode2 = Number.parseInt(unicode4, 16);
|
|
31
|
+
return String.fromCodePoint(charCode2);
|
|
32
|
+
}
|
|
33
|
+
const charCode = Number.parseInt(unicode8, 16);
|
|
34
|
+
if (charCode < 65535) {
|
|
35
|
+
return String.fromCodePoint(charCode);
|
|
36
|
+
}
|
|
37
|
+
const substractedCharCode = charCode - 65536;
|
|
38
|
+
return String.fromCodePoint(55296 + (substractedCharCode >> 10), 56320 + (substractedCharCode & 1023));
|
|
39
|
+
});
|
|
40
|
+
if (/[\uD800-\uDBFF](?:[^\uDC00-\uDFFF]|$)/u.test(sanitizedInput)) {
|
|
41
|
+
throw new Error(`Invalid unicode codepoint of surrogate pair without corresponding codepoint`);
|
|
42
|
+
}
|
|
43
|
+
return sanitizedInput;
|
|
44
|
+
}
|
|
45
|
+
var CommonIRIs;
|
|
46
|
+
(function(CommonIRIs2) {
|
|
47
|
+
CommonIRIs2["BOOLEAN"] = "http://www.w3.org/2001/XMLSchema#boolean";
|
|
48
|
+
CommonIRIs2["INTEGER"] = "http://www.w3.org/2001/XMLSchema#integer";
|
|
49
|
+
CommonIRIs2["DECIMAL"] = "http://www.w3.org/2001/XMLSchema#decimal";
|
|
50
|
+
CommonIRIs2["DOUBLE"] = "http://www.w3.org/2001/XMLSchema#double";
|
|
51
|
+
CommonIRIs2["STRING"] = "http://www.w3.org/2001/XMLSchema#string";
|
|
52
|
+
CommonIRIs2["FIRST"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#first";
|
|
53
|
+
CommonIRIs2["REST"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest";
|
|
54
|
+
CommonIRIs2["NIL"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil";
|
|
55
|
+
CommonIRIs2["TYPE"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
|
|
56
|
+
})(CommonIRIs || (CommonIRIs = {}));
|
|
57
|
+
class AstTransformer extends import_core.TransformerSubTyped {
|
|
58
|
+
}
|
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
+
0 && (module.exports = {
|
|
61
|
+
AstTransformer,
|
|
62
|
+
CommonIRIs,
|
|
63
|
+
sparqlCodepointEscape
|
|
64
|
+
});
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var validators_exports = {};
|
|
20
|
+
__export(validators_exports, {
|
|
21
|
+
checkNote13: () => checkNote13,
|
|
22
|
+
findPatternBoundedVars: () => findPatternBoundedVars,
|
|
23
|
+
queryIsGood: () => queryIsGood,
|
|
24
|
+
updateNoReuseBlankNodeLabels: () => updateNoReuseBlankNodeLabels
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(validators_exports);
|
|
27
|
+
var import_astFactory = require("../astFactory.js");
|
|
28
|
+
var import_utils = require("../utils.js");
|
|
29
|
+
const F = new import_astFactory.AstFactory();
|
|
30
|
+
const transformer = new import_utils.AstTransformer();
|
|
31
|
+
function getAggregatesOfExpression(expression) {
|
|
32
|
+
if (F.isExpressionAggregate(expression)) {
|
|
33
|
+
return [expression];
|
|
34
|
+
}
|
|
35
|
+
if (F.isExpressionOperator(expression)) {
|
|
36
|
+
const aggregates = [];
|
|
37
|
+
for (const arg of expression.args) {
|
|
38
|
+
aggregates.push(...getAggregatesOfExpression(arg));
|
|
39
|
+
}
|
|
40
|
+
return aggregates;
|
|
41
|
+
}
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
function getExpressionId(expression) {
|
|
45
|
+
if (F.isTerm(expression) && F.isTermVariable(expression)) {
|
|
46
|
+
return expression.value;
|
|
47
|
+
}
|
|
48
|
+
if (F.isExpression(expression)) {
|
|
49
|
+
if (F.isExpressionAggregate(expression) && F.isTermVariable(expression.expression[0])) {
|
|
50
|
+
return expression.expression[0].value;
|
|
51
|
+
}
|
|
52
|
+
return void 0;
|
|
53
|
+
}
|
|
54
|
+
return expression.variable.value;
|
|
55
|
+
}
|
|
56
|
+
function getVariablesFromExpression(expression, variables) {
|
|
57
|
+
if (F.isExpressionOperator(expression)) {
|
|
58
|
+
for (const expr of expression.args) {
|
|
59
|
+
getVariablesFromExpression(expr, variables);
|
|
60
|
+
}
|
|
61
|
+
} else if (F.isTerm(expression) && F.isTermVariable(expression)) {
|
|
62
|
+
variables.add(expression.value);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function queryIsGood(query) {
|
|
66
|
+
if (query.variables.length === 1 && F.isWildcard(query.variables[0])) {
|
|
67
|
+
if (query.solutionModifiers.group !== void 0) {
|
|
68
|
+
throw new Error("GROUP BY not allowed with wildcard");
|
|
69
|
+
}
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const variables = query.variables;
|
|
73
|
+
const hasCountAggregate = variables.flatMap((varVal) => F.isTerm(varVal) ? [] : getAggregatesOfExpression(varVal.expression)).some((agg) => agg.aggregation === "count" && !agg.expression.some((arg) => F.isWildcard(arg)));
|
|
74
|
+
const groupBy = query.solutionModifiers.group;
|
|
75
|
+
if (hasCountAggregate || groupBy) {
|
|
76
|
+
for (const selectVar of variables) {
|
|
77
|
+
if (F.isTerm(selectVar)) {
|
|
78
|
+
if (!groupBy || !groupBy.groupings.map((groupvar) => getExpressionId(groupvar)).includes(getExpressionId(selectVar))) {
|
|
79
|
+
throw new Error("Variable not allowed in projection");
|
|
80
|
+
}
|
|
81
|
+
} else if (getAggregatesOfExpression(selectVar.expression).length === 0) {
|
|
82
|
+
const usedvars = /* @__PURE__ */ new Set();
|
|
83
|
+
getVariablesFromExpression(selectVar.expression, usedvars);
|
|
84
|
+
for (const usedvar of usedvars) {
|
|
85
|
+
if (!groupBy || !groupBy.groupings.map((groupVar) => getExpressionId(groupVar)).includes(usedvar)) {
|
|
86
|
+
throw new Error(`Use of ungrouped variable in projection of operation (?${usedvar})`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const subqueries = query.where.patterns.filter((pattern) => pattern.type === "query");
|
|
93
|
+
if (subqueries.length > 0) {
|
|
94
|
+
const selectBoundedVars = /* @__PURE__ */ new Set();
|
|
95
|
+
for (const variable of variables) {
|
|
96
|
+
if ("variable" in variable) {
|
|
97
|
+
selectBoundedVars.add(variable.variable.value);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const vars = subqueries.flatMap((sub) => sub.variables).map((v) => F.isTerm(v) ? v.value : F.isWildcard(v) ? "*" : v.variable.value);
|
|
101
|
+
const subqueryIds = new Set(vars);
|
|
102
|
+
for (const selectedVarId of selectBoundedVars) {
|
|
103
|
+
if (subqueryIds.has(selectedVarId)) {
|
|
104
|
+
throw new Error(`Target id of 'AS' (?${selectedVarId}) already used in subquery`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function notUndefined(some) {
|
|
110
|
+
return some !== void 0;
|
|
111
|
+
}
|
|
112
|
+
function findPatternBoundedVars(iter, boundedVars) {
|
|
113
|
+
transformer.traverseSubNodes(iter, {
|
|
114
|
+
query: (op) => ({ next: [
|
|
115
|
+
op.solutionModifiers.group
|
|
116
|
+
].filter(notUndefined) }),
|
|
117
|
+
triple: (op) => ({ next: [op.subject, op.predicate, op.object] }),
|
|
118
|
+
path: (op) => ({ next: op.items }),
|
|
119
|
+
tripleCollection: (op) => ({ next: [op.identifier, ...op.triples] })
|
|
120
|
+
}, {
|
|
121
|
+
query: {
|
|
122
|
+
select: (op) => ({ next: [
|
|
123
|
+
...op.variables.some((x) => F.isWildcard(x)) ? [op.where] : op.variables,
|
|
124
|
+
op.solutionModifiers.group,
|
|
125
|
+
op.values
|
|
126
|
+
].filter(notUndefined) }),
|
|
127
|
+
describe: (op) => ({ next: [
|
|
128
|
+
...op.variables.some((x) => F.isWildcard(x)) ? [op.where] : op.variables,
|
|
129
|
+
op.solutionModifiers.group,
|
|
130
|
+
op.values
|
|
131
|
+
].filter(notUndefined) })
|
|
132
|
+
},
|
|
133
|
+
solutionModifier: {
|
|
134
|
+
group: (op) => ({
|
|
135
|
+
next: op.groupings.filter((g) => "variable" in g).map((x) => x.variable)
|
|
136
|
+
}),
|
|
137
|
+
having: (op) => ({ next: op.having }),
|
|
138
|
+
order: (op) => ({ next: op.orderDefs.map((x) => x.expression) })
|
|
139
|
+
},
|
|
140
|
+
pattern: {
|
|
141
|
+
values: (op) => {
|
|
142
|
+
for (const v of Object.keys(op.values.at(0) ?? {})) {
|
|
143
|
+
boundedVars.add(v);
|
|
144
|
+
}
|
|
145
|
+
return {};
|
|
146
|
+
},
|
|
147
|
+
bgp: (op) => ({ next: op.triples }),
|
|
148
|
+
group: (op) => ({ next: op.patterns }),
|
|
149
|
+
union: (op) => ({ next: op.patterns }),
|
|
150
|
+
optional: (op) => ({ next: op.patterns }),
|
|
151
|
+
service: (op) => ({ next: [op.name, ...op.patterns] }),
|
|
152
|
+
bind: (op) => ({ next: [op.variable] }),
|
|
153
|
+
graph: (op) => ({ next: [op.name, ...op.patterns] })
|
|
154
|
+
},
|
|
155
|
+
term: {
|
|
156
|
+
variable: (op) => {
|
|
157
|
+
boundedVars.add(op.value);
|
|
158
|
+
return {};
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function checkNote13(patterns) {
|
|
164
|
+
for (const [index, pattern] of patterns.entries()) {
|
|
165
|
+
if (F.isPatternBind(pattern) && index > 0 && F.isPatternBgp(patterns[index - 1])) {
|
|
166
|
+
const bgp = patterns[index - 1];
|
|
167
|
+
const variables = [];
|
|
168
|
+
transformer.visitNodeSpecific(bgp, {}, { term: { variable: { visitor: (var_) => {
|
|
169
|
+
variables.push(var_);
|
|
170
|
+
} } } });
|
|
171
|
+
if (variables.some((var_) => var_.value === pattern.variable.value)) {
|
|
172
|
+
throw new Error(`Variable used to bind is already bound (?${pattern.variable.value})`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const boundedVars = /* @__PURE__ */ new Set();
|
|
177
|
+
for (const pattern of patterns) {
|
|
178
|
+
if (F.isPatternBind(pattern)) {
|
|
179
|
+
if (boundedVars.has(pattern.variable.value)) {
|
|
180
|
+
throw new Error(`Variable used to bind is already bound (?${pattern.variable.value})`);
|
|
181
|
+
}
|
|
182
|
+
} else {
|
|
183
|
+
findPatternBoundedVars(pattern, boundedVars);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function updateNoReuseBlankNodeLabels(updateQuery) {
|
|
188
|
+
const blankLabelsUsedInInsertData = /* @__PURE__ */ new Set();
|
|
189
|
+
for (const update of updateQuery.updates) {
|
|
190
|
+
if (!update.operation) {
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
const operation = update.operation;
|
|
194
|
+
if (operation.subType === "insertdata") {
|
|
195
|
+
const blankNodesHere = /* @__PURE__ */ new Set();
|
|
196
|
+
transformer.visitNodeSpecific(operation, {}, { term: { blankNode: { visitor: (blankNode) => {
|
|
197
|
+
blankNodesHere.add(blankNode.label);
|
|
198
|
+
if (blankLabelsUsedInInsertData.has(blankNode.label)) {
|
|
199
|
+
throw new Error("Detected reuse blank node across different INSERT DATA clauses");
|
|
200
|
+
}
|
|
201
|
+
} } } });
|
|
202
|
+
for (const blankNode of blankNodesHere) {
|
|
203
|
+
blankLabelsUsedInInsertData.add(blankNode);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
209
|
+
0 && (module.exports = {
|
|
210
|
+
checkNote13,
|
|
211
|
+
findPatternBoundedVars,
|
|
212
|
+
queryIsGood,
|
|
213
|
+
updateNoReuseBlankNodeLabels
|
|
214
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MinimalSparqlParser.js","sourceRoot":"","sources":["../../../lib/MinimalSparqlParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAS7C,MAAM,UAAU,oBAAoB,CAClC,OAAkG;IAElG,OAAO;QACL,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI,UAAU,EAAE;QAClD,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE;QACjC,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,EAAE;QACpC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAE,cAAc,EAAE,qBAAqB,CAAE,CAAC;QAC9G,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,KAAK;QAC/C,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC;QACtD,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,CAAC;KAClC,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,mBAAmB;IACM;IAApC,YAAoC,MAAwB;QAAxB,WAAM,GAAN,MAAM,CAAkB;IAAG,CAAC;IAC/C,CAAC,GAAG,IAAI,UAAU,EAAE,CAAC;IAE/B,KAAK,CAAC,KAAa,EAAE,UAAkC,EAAE;QAC9D,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC;IACzE,CAAC;IAEM,SAAS,CAAC,KAAa,EAAE,UAAkC,EAAE;QAElE,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC;QACtE,IAAI,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YAC9B,OAAO;gBACL,GAAG,MAAM;gBACT,QAAQ,EAAE,EAAE;aACb,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import { traqulaIndentation } from '@traqula/core';\nimport { AstFactory } from './astFactory.js';\nimport type { SparqlContext, SparqlGeneratorContext } from './sparql11HelperTypes.js';\nimport type { Path, TermIri } from './Sparql11types.js';\n\ninterface Parser<ParseRet> {\n queryOrUpdate: (input: string, context: SparqlContext) => ParseRet;\n path: (input: string, context: SparqlContext) => TermIri | Path;\n}\n\nexport function completeParseContext(\n context: Partial<SparqlContext & SparqlGeneratorContext & { origSource: string; offset?: number }>,\n): SparqlContext & SparqlGeneratorContext & { origSource: string; offset?: number } {\n return {\n astFactory: context.astFactory ?? new AstFactory(),\n baseIRI: context.baseIRI,\n prefixes: { ...context.prefixes },\n origSource: context.origSource ?? '',\n offset: context.offset,\n parseMode: context.parseMode ? new Set(context.parseMode) : new Set([ 'canParseVars', 'canCreateBlankNodes' ]),\n skipValidation: context.skipValidation ?? false,\n [traqulaIndentation]: context[traqulaIndentation] ?? 0,\n indentInc: context.indentInc ?? 2,\n };\n}\n\nexport class MinimalSparqlParser<ParseRet> {\n public constructor(private readonly parser: Parser<ParseRet>) {}\n private readonly F = new AstFactory();\n\n public parse(query: string, context: Partial<SparqlContext> = {}): ParseRet {\n return this.parser.queryOrUpdate(query, completeParseContext(context));\n }\n\n public parsePath(query: string, context: Partial<SparqlContext> = {}):\n (Path & { prefixes: object }) | TermIri {\n const result = this.parser.path(query, completeParseContext(context));\n if (this.F.isPathPure(result)) {\n return {\n ...result,\n prefixes: {},\n };\n }\n return result;\n }\n}\n"]}
|