@traqula/rules-sparql-1-2 0.0.16 → 0.0.17
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/index.cjs +259 -150
- package/lib/parserUtils.d.ts +4 -0
- package/lib/parserUtils.js +3 -1
- package/lib/parserUtils.js.map +1 -1
- package/package.json +4 -4
package/lib/index.cjs
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
AstFactory: () => AstFactory2,
|
|
24
|
+
AstTransformer: () => AstTransformer2,
|
|
24
25
|
completeParseContext: () => completeParseContext,
|
|
25
26
|
findPatternBoundedVars: () => findPatternBoundedVars2,
|
|
26
27
|
gram: () => grammar_exports2,
|
|
@@ -9526,6 +9527,11 @@ var LexerBuilder = class _LexerBuilder {
|
|
|
9526
9527
|
|
|
9527
9528
|
// ../core/lib/Transformers.js
|
|
9528
9529
|
var TransformerType = class {
|
|
9530
|
+
clone(obj) {
|
|
9531
|
+
const newObj = Object.create(Object.getPrototypeOf(obj));
|
|
9532
|
+
Object.defineProperties(newObj, Object.getOwnPropertyDescriptors(obj));
|
|
9533
|
+
return newObj;
|
|
9534
|
+
}
|
|
9529
9535
|
safeObjectVisit(value, mapper) {
|
|
9530
9536
|
if (value && typeof value === "object") {
|
|
9531
9537
|
if (Array.isArray(value)) {
|
|
@@ -9535,104 +9541,213 @@ var TransformerType = class {
|
|
|
9535
9541
|
}
|
|
9536
9542
|
return value;
|
|
9537
9543
|
}
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
|
|
9560
|
-
|
|
9544
|
+
/**
|
|
9545
|
+
* Recursively transforms all objects that are not arrays. Mapper is called on deeper objects first.
|
|
9546
|
+
* @param startObject object to start iterating from
|
|
9547
|
+
* @param mapper mapper to transform the various objects - argument is a copy of the original
|
|
9548
|
+
* @param preVisitor callback that is evaluated before iterating deeper.
|
|
9549
|
+
* If continues is false, we do not iterate deeper, current object is still mapped. - default: true
|
|
9550
|
+
* If shortcut is true, we do not iterate deeper, nor do we branch out, this mapper will be the last one called.
|
|
9551
|
+
* - Default false
|
|
9552
|
+
*/
|
|
9553
|
+
transformObject(startObject, mapper, preVisitor = () => ({})) {
|
|
9554
|
+
let didShortCut = false;
|
|
9555
|
+
const recurse = (curObject) => {
|
|
9556
|
+
const copy3 = this.clone(curObject);
|
|
9557
|
+
const context = preVisitor(copy3);
|
|
9558
|
+
didShortCut = context.shortcut ?? false;
|
|
9559
|
+
const continues = context.continue ?? true;
|
|
9560
|
+
if (continues && !didShortCut) {
|
|
9561
|
+
for (const [key, value] of Object.entries(copy3)) {
|
|
9562
|
+
if (didShortCut) {
|
|
9563
|
+
return copy3;
|
|
9564
|
+
}
|
|
9565
|
+
copy3[key] = this.safeObjectVisit(value, (obj) => recurse(obj));
|
|
9566
|
+
}
|
|
9567
|
+
}
|
|
9568
|
+
return mapper(copy3);
|
|
9569
|
+
};
|
|
9570
|
+
return recurse(startObject);
|
|
9561
9571
|
}
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
|
-
|
|
9565
|
-
|
|
9566
|
-
|
|
9567
|
-
|
|
9568
|
-
|
|
9569
|
-
|
|
9570
|
-
|
|
9571
|
-
|
|
9572
|
-
|
|
9573
|
-
|
|
9574
|
-
|
|
9572
|
+
/**
|
|
9573
|
+
* Visitor that visits all objects. Visits deeper objects first.
|
|
9574
|
+
*/
|
|
9575
|
+
visitObject(startObject, visitor, preVisitor = () => ({})) {
|
|
9576
|
+
let didShortCut = false;
|
|
9577
|
+
const recurse = (curObject) => {
|
|
9578
|
+
const context = preVisitor(curObject);
|
|
9579
|
+
didShortCut = context.shortcut ?? false;
|
|
9580
|
+
const continues = context.continue ?? true;
|
|
9581
|
+
if (continues && !didShortCut) {
|
|
9582
|
+
for (const value of Object.values(curObject)) {
|
|
9583
|
+
if (didShortCut) {
|
|
9584
|
+
return;
|
|
9585
|
+
}
|
|
9586
|
+
this.safeObjectVisit(value, (obj) => recurse(obj));
|
|
9587
|
+
}
|
|
9575
9588
|
}
|
|
9576
|
-
|
|
9589
|
+
visitor(curObject);
|
|
9590
|
+
};
|
|
9591
|
+
recurse(startObject);
|
|
9592
|
+
}
|
|
9593
|
+
transformNode(startObject, nodeCallBacks) {
|
|
9594
|
+
const transformWrapper = (curObject) => {
|
|
9595
|
+
const casted = curObject;
|
|
9596
|
+
if (casted.type) {
|
|
9597
|
+
const ogFunc = nodeCallBacks[casted.type]?.transform;
|
|
9598
|
+
if (ogFunc) {
|
|
9599
|
+
return ogFunc(casted);
|
|
9600
|
+
}
|
|
9601
|
+
}
|
|
9602
|
+
return curObject;
|
|
9603
|
+
};
|
|
9604
|
+
const preTransformWrapper = (curObject) => {
|
|
9605
|
+
const casted = curObject;
|
|
9606
|
+
if (casted.type) {
|
|
9607
|
+
const ogFunc = nodeCallBacks[casted.type]?.preVisitor;
|
|
9608
|
+
if (ogFunc) {
|
|
9609
|
+
return ogFunc(casted);
|
|
9610
|
+
}
|
|
9611
|
+
}
|
|
9612
|
+
return {};
|
|
9613
|
+
};
|
|
9614
|
+
return this.transformObject(startObject, transformWrapper, preTransformWrapper);
|
|
9615
|
+
}
|
|
9616
|
+
visitNode(startObject, nodeCallBacks) {
|
|
9617
|
+
const visitWrapper = (curObject) => {
|
|
9618
|
+
const casted = curObject;
|
|
9619
|
+
if (casted.type) {
|
|
9620
|
+
const ogFunc = nodeCallBacks[casted.type]?.visitor;
|
|
9621
|
+
if (ogFunc) {
|
|
9622
|
+
ogFunc(casted);
|
|
9623
|
+
}
|
|
9624
|
+
}
|
|
9625
|
+
};
|
|
9626
|
+
const preVisitWrapper = (curObject) => {
|
|
9627
|
+
const casted = curObject;
|
|
9628
|
+
if (casted.type) {
|
|
9629
|
+
const ogFunc = nodeCallBacks[casted.type]?.preVisitor;
|
|
9630
|
+
if (ogFunc) {
|
|
9631
|
+
return ogFunc(casted);
|
|
9632
|
+
}
|
|
9633
|
+
}
|
|
9634
|
+
return {};
|
|
9635
|
+
};
|
|
9636
|
+
this.visitObject(startObject, visitWrapper, preVisitWrapper);
|
|
9637
|
+
}
|
|
9638
|
+
traverseNodes(currentNode, traverse) {
|
|
9639
|
+
let didShortCut = false;
|
|
9640
|
+
const recurse = (curNode) => {
|
|
9641
|
+
const traverser = traverse[curNode.type];
|
|
9642
|
+
if (traverser) {
|
|
9643
|
+
const { next, shortcut } = traverser(curNode);
|
|
9644
|
+
didShortCut = shortcut ?? false;
|
|
9645
|
+
if (!didShortCut) {
|
|
9646
|
+
for (const node of next ?? []) {
|
|
9647
|
+
if (didShortCut) {
|
|
9648
|
+
return;
|
|
9649
|
+
}
|
|
9650
|
+
recurse(node);
|
|
9651
|
+
}
|
|
9652
|
+
}
|
|
9653
|
+
}
|
|
9654
|
+
};
|
|
9655
|
+
recurse(currentNode);
|
|
9577
9656
|
}
|
|
9578
9657
|
};
|
|
9579
9658
|
var TransformerSubType = class extends TransformerType {
|
|
9580
|
-
|
|
9581
|
-
|
|
9582
|
-
|
|
9583
|
-
|
|
9584
|
-
|
|
9585
|
-
|
|
9586
|
-
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
|
|
9596
|
-
|
|
9597
|
-
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
|
|
9601
|
-
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
|
|
9605
|
-
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
|
|
9610
|
-
return copy3;
|
|
9659
|
+
transformNodeSpecific(startObject, nodeCallBacks, nodeSpecificCallBacks) {
|
|
9660
|
+
const transformWrapper = (curObject) => {
|
|
9661
|
+
let ogTransform;
|
|
9662
|
+
const casted = curObject;
|
|
9663
|
+
if (casted.type && casted.subType) {
|
|
9664
|
+
const specific = nodeSpecificCallBacks[casted.type];
|
|
9665
|
+
if (specific) {
|
|
9666
|
+
ogTransform = specific[casted.subType]?.transform;
|
|
9667
|
+
}
|
|
9668
|
+
if (!ogTransform) {
|
|
9669
|
+
ogTransform = nodeCallBacks[casted.type]?.transform;
|
|
9670
|
+
}
|
|
9671
|
+
}
|
|
9672
|
+
return ogTransform ? ogTransform(casted) : curObject;
|
|
9673
|
+
};
|
|
9674
|
+
const preVisitWrapper = (curObject) => {
|
|
9675
|
+
let ogPreVisit;
|
|
9676
|
+
const casted = curObject;
|
|
9677
|
+
if (casted.type && casted.subType) {
|
|
9678
|
+
const specific = nodeSpecificCallBacks[casted.type];
|
|
9679
|
+
if (specific) {
|
|
9680
|
+
ogPreVisit = specific[casted.subType]?.preVisitor;
|
|
9681
|
+
}
|
|
9682
|
+
if (!ogPreVisit) {
|
|
9683
|
+
ogPreVisit = nodeCallBacks[casted.type]?.preVisitor;
|
|
9684
|
+
}
|
|
9685
|
+
}
|
|
9686
|
+
return ogPreVisit ? ogPreVisit(casted) : curObject;
|
|
9687
|
+
};
|
|
9688
|
+
return this.transformObject(startObject, transformWrapper, preVisitWrapper);
|
|
9611
9689
|
}
|
|
9612
9690
|
/**
|
|
9613
9691
|
* When both nodeCallBack and NodeSpecific callBack are matched, will only look at nodeSpecifCallback
|
|
9614
9692
|
*/
|
|
9615
|
-
visitNodeSpecific(
|
|
9616
|
-
|
|
9617
|
-
|
|
9618
|
-
|
|
9619
|
-
|
|
9620
|
-
|
|
9621
|
-
|
|
9693
|
+
visitNodeSpecific(startObject, nodeCallBacks, nodeSpecificCallBacks) {
|
|
9694
|
+
const visitWrapper = (curObject) => {
|
|
9695
|
+
let ogTransform;
|
|
9696
|
+
const casted = curObject;
|
|
9697
|
+
if (casted.type && casted.subType) {
|
|
9698
|
+
const specific = nodeSpecificCallBacks[casted.type];
|
|
9699
|
+
if (specific) {
|
|
9700
|
+
ogTransform = specific[casted.subType]?.visitor;
|
|
9701
|
+
}
|
|
9702
|
+
if (!ogTransform) {
|
|
9703
|
+
ogTransform = nodeCallBacks[casted.type]?.visitor;
|
|
9704
|
+
}
|
|
9622
9705
|
}
|
|
9623
|
-
|
|
9624
|
-
|
|
9625
|
-
callback = nodeCallBacks[curObject.type];
|
|
9626
|
-
}
|
|
9627
|
-
let shouldIterate = true;
|
|
9628
|
-
if (callback) {
|
|
9629
|
-
shouldIterate = callback(curObject) ?? true;
|
|
9630
|
-
}
|
|
9631
|
-
if (shouldIterate) {
|
|
9632
|
-
for (const value of Object.values(curObject)) {
|
|
9633
|
-
this.safeObjectVisit(value, (obj) => this.visitNodeSpecific(obj, nodeCallBacks, nodeSpecificCallBacks));
|
|
9706
|
+
if (ogTransform) {
|
|
9707
|
+
ogTransform(casted);
|
|
9634
9708
|
}
|
|
9635
|
-
}
|
|
9709
|
+
};
|
|
9710
|
+
const preVisitWrapper = (curObject) => {
|
|
9711
|
+
let ogPreVisit;
|
|
9712
|
+
const casted = curObject;
|
|
9713
|
+
if (casted.type && casted.subType) {
|
|
9714
|
+
const specific = nodeSpecificCallBacks[casted.type];
|
|
9715
|
+
if (specific) {
|
|
9716
|
+
ogPreVisit = specific[casted.subType]?.preVisitor;
|
|
9717
|
+
}
|
|
9718
|
+
if (!ogPreVisit) {
|
|
9719
|
+
ogPreVisit = nodeCallBacks[casted.type]?.preVisitor;
|
|
9720
|
+
}
|
|
9721
|
+
}
|
|
9722
|
+
return ogPreVisit ? ogPreVisit(casted) : curObject;
|
|
9723
|
+
};
|
|
9724
|
+
this.visitObject(startObject, visitWrapper, preVisitWrapper);
|
|
9725
|
+
}
|
|
9726
|
+
traverseSubNodes(currentNode, traverseNode, traverseSubNode) {
|
|
9727
|
+
let didShortCut = false;
|
|
9728
|
+
const recurse = (curNode) => {
|
|
9729
|
+
let traverser;
|
|
9730
|
+
const subObj = traverseSubNode[curNode.type];
|
|
9731
|
+
if (subObj) {
|
|
9732
|
+
traverser = subObj[curNode.subType];
|
|
9733
|
+
}
|
|
9734
|
+
if (!traverser) {
|
|
9735
|
+
traverser = traverseNode[curNode.type];
|
|
9736
|
+
}
|
|
9737
|
+
if (traverser) {
|
|
9738
|
+
const { next, shortcut } = traverser(curNode);
|
|
9739
|
+
didShortCut = shortcut ?? false;
|
|
9740
|
+
if (!didShortCut) {
|
|
9741
|
+
for (const node of next ?? []) {
|
|
9742
|
+
if (didShortCut) {
|
|
9743
|
+
return;
|
|
9744
|
+
}
|
|
9745
|
+
recurse(node);
|
|
9746
|
+
}
|
|
9747
|
+
}
|
|
9748
|
+
}
|
|
9749
|
+
};
|
|
9750
|
+
recurse(currentNode);
|
|
9636
9751
|
}
|
|
9637
9752
|
};
|
|
9638
9753
|
|
|
@@ -11128,12 +11243,12 @@ var CommonIRIs;
|
|
|
11128
11243
|
CommonIRIs2["NIL"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil";
|
|
11129
11244
|
CommonIRIs2["TYPE"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
|
|
11130
11245
|
})(CommonIRIs || (CommonIRIs = {}));
|
|
11131
|
-
var
|
|
11246
|
+
var AstTransformer = class extends TransformerSubType {
|
|
11132
11247
|
};
|
|
11133
11248
|
|
|
11134
11249
|
// ../rules-sparql-1-1/lib/validation/validators.js
|
|
11135
11250
|
var F = new AstFactory();
|
|
11136
|
-
var transformer = new
|
|
11251
|
+
var transformer = new AstTransformer();
|
|
11137
11252
|
function getAggregatesOfExpression(expression2) {
|
|
11138
11253
|
if (F.isExpressionAggregate(expression2)) {
|
|
11139
11254
|
return [expression2];
|
|
@@ -11212,77 +11327,69 @@ function queryIsGood(query2) {
|
|
|
11212
11327
|
}
|
|
11213
11328
|
}
|
|
11214
11329
|
}
|
|
11330
|
+
function notUndefined(some2) {
|
|
11331
|
+
return some2 !== void 0;
|
|
11332
|
+
}
|
|
11215
11333
|
function findPatternBoundedVars(iter, boundedVars) {
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
|
|
11220
|
-
|
|
11221
|
-
|
|
11222
|
-
|
|
11223
|
-
|
|
11224
|
-
|
|
11225
|
-
|
|
11226
|
-
|
|
11227
|
-
|
|
11228
|
-
|
|
11229
|
-
|
|
11230
|
-
|
|
11231
|
-
|
|
11232
|
-
|
|
11233
|
-
|
|
11234
|
-
|
|
11235
|
-
|
|
11334
|
+
transformer.traverseSubNodes(iter, {
|
|
11335
|
+
query: (op) => ({ next: [
|
|
11336
|
+
op.solutionModifiers.group
|
|
11337
|
+
].filter(notUndefined) }),
|
|
11338
|
+
triple: (op) => ({ next: [op.subject, op.predicate, op.object] }),
|
|
11339
|
+
path: (op) => ({ next: op.items }),
|
|
11340
|
+
tripleCollection: (op) => ({ next: [op.identifier, ...op.triples] })
|
|
11341
|
+
}, {
|
|
11342
|
+
query: {
|
|
11343
|
+
select: (op) => ({ next: [
|
|
11344
|
+
...op.variables.some((x) => F.isWildcard(x)) ? [op.where] : op.variables,
|
|
11345
|
+
op.solutionModifiers.group,
|
|
11346
|
+
op.values
|
|
11347
|
+
].filter(notUndefined) }),
|
|
11348
|
+
describe: (op) => ({ next: [
|
|
11349
|
+
...op.variables.some((x) => F.isWildcard(x)) ? [op.where] : op.variables,
|
|
11350
|
+
op.solutionModifiers.group,
|
|
11351
|
+
op.values
|
|
11352
|
+
].filter(notUndefined) })
|
|
11353
|
+
},
|
|
11354
|
+
solutionModifier: {
|
|
11355
|
+
group: (op) => ({
|
|
11356
|
+
next: op.groupings.filter((g) => "variable" in g).map((x) => x.variable)
|
|
11357
|
+
}),
|
|
11358
|
+
having: (op) => ({ next: op.having }),
|
|
11359
|
+
order: (op) => ({ next: op.orderDefs.map((x) => x.expression) })
|
|
11360
|
+
},
|
|
11361
|
+
pattern: {
|
|
11362
|
+
values: (op) => {
|
|
11363
|
+
for (const v of Object.keys(op.values.at(0) ?? {})) {
|
|
11236
11364
|
boundedVars.add(v);
|
|
11237
11365
|
}
|
|
11366
|
+
return {};
|
|
11367
|
+
},
|
|
11368
|
+
bgp: (op) => ({ next: op.triples }),
|
|
11369
|
+
group: (op) => ({ next: op.patterns }),
|
|
11370
|
+
union: (op) => ({ next: op.patterns }),
|
|
11371
|
+
optional: (op) => ({ next: op.patterns }),
|
|
11372
|
+
service: (op) => ({ next: [op.name, ...op.patterns] }),
|
|
11373
|
+
bind: (op) => ({ next: [op.variable] }),
|
|
11374
|
+
graph: (op) => ({ next: [op.name, ...op.patterns] }),
|
|
11375
|
+
minus: (op) => ({ next: op.patterns.slice(0, 1) })
|
|
11376
|
+
},
|
|
11377
|
+
term: {
|
|
11378
|
+
variable: (op) => {
|
|
11379
|
+
boundedVars.add(op.value);
|
|
11380
|
+
return {};
|
|
11238
11381
|
}
|
|
11239
11382
|
}
|
|
11240
|
-
}
|
|
11241
|
-
if (F.isTermVariable(iter)) {
|
|
11242
|
-
boundedVars.add(iter.value);
|
|
11243
|
-
}
|
|
11244
|
-
} else if (F.isTriple(iter)) {
|
|
11245
|
-
findPatternBoundedVars(iter.subject, boundedVars);
|
|
11246
|
-
findPatternBoundedVars(iter.predicate, boundedVars);
|
|
11247
|
-
findPatternBoundedVars(iter.object, boundedVars);
|
|
11248
|
-
} else if (F.isPath(iter)) {
|
|
11249
|
-
if (!F.isTerm(iter)) {
|
|
11250
|
-
for (const item of iter.items) {
|
|
11251
|
-
findPatternBoundedVars(item, boundedVars);
|
|
11252
|
-
}
|
|
11253
|
-
}
|
|
11254
|
-
} else if (F.isTripleCollection(iter) || F.isPatternBgp(iter)) {
|
|
11255
|
-
for (const triple of iter.triples) {
|
|
11256
|
-
findPatternBoundedVars(triple, boundedVars);
|
|
11257
|
-
}
|
|
11258
|
-
} else if (F.isPatternGroup(iter) || F.isPatternUnion(iter) || F.isPatternOptional(iter) || F.isPatternService(iter)) {
|
|
11259
|
-
for (const pattern of iter.patterns) {
|
|
11260
|
-
findPatternBoundedVars(pattern, boundedVars);
|
|
11261
|
-
}
|
|
11262
|
-
if (F.isPatternService(iter)) {
|
|
11263
|
-
findPatternBoundedVars(iter.name, boundedVars);
|
|
11264
|
-
}
|
|
11265
|
-
} else if (F.isPatternBind(iter)) {
|
|
11266
|
-
findPatternBoundedVars(iter.variable, boundedVars);
|
|
11267
|
-
} else if (F.isPatternValues(iter)) {
|
|
11268
|
-
for (const variable of Object.keys(iter.values.at(0) ?? {})) {
|
|
11269
|
-
boundedVars.add(variable);
|
|
11270
|
-
}
|
|
11271
|
-
} else if (F.isPatternGraph(iter)) {
|
|
11272
|
-
findPatternBoundedVars(iter.name, boundedVars);
|
|
11273
|
-
for (const pattern of iter.patterns) {
|
|
11274
|
-
findPatternBoundedVars(pattern, boundedVars);
|
|
11275
|
-
}
|
|
11276
|
-
}
|
|
11383
|
+
});
|
|
11277
11384
|
}
|
|
11278
11385
|
function checkNote13(patterns) {
|
|
11279
11386
|
for (const [index, pattern] of patterns.entries()) {
|
|
11280
11387
|
if (F.isPatternBind(pattern) && index > 0 && F.isPatternBgp(patterns[index - 1])) {
|
|
11281
11388
|
const bgp = patterns[index - 1];
|
|
11282
11389
|
const variables = [];
|
|
11283
|
-
transformer.visitNodeSpecific(bgp, {}, { term: { variable: (var_2) => {
|
|
11390
|
+
transformer.visitNodeSpecific(bgp, {}, { term: { variable: { visitor: (var_2) => {
|
|
11284
11391
|
variables.push(var_2);
|
|
11285
|
-
} } });
|
|
11392
|
+
} } } });
|
|
11286
11393
|
if (variables.some((var_2) => var_2.value === pattern.variable.value)) {
|
|
11287
11394
|
throw new Error(`Variable used to bind is already bound (?${pattern.variable.value})`);
|
|
11288
11395
|
}
|
|
@@ -11308,12 +11415,12 @@ function updateNoReuseBlankNodeLabels(updateQuery) {
|
|
|
11308
11415
|
const operation = update2.operation;
|
|
11309
11416
|
if (operation.subType === "insertdata") {
|
|
11310
11417
|
const blankNodesHere = /* @__PURE__ */ new Set();
|
|
11311
|
-
transformer.visitNodeSpecific(operation, {}, { term: { blankNode: (blankNode2) => {
|
|
11418
|
+
transformer.visitNodeSpecific(operation, {}, { term: { blankNode: { visitor: (blankNode2) => {
|
|
11312
11419
|
blankNodesHere.add(blankNode2.label);
|
|
11313
11420
|
if (blankLabelsUsedInInsertData.has(blankNode2.label)) {
|
|
11314
11421
|
throw new Error("Detected reuse blank node across different INSERT DATA clauses");
|
|
11315
11422
|
}
|
|
11316
|
-
} } });
|
|
11423
|
+
} } } });
|
|
11317
11424
|
for (const blankNode2 of blankNodesHere) {
|
|
11318
11425
|
blankLabelsUsedInInsertData.add(blankNode2);
|
|
11319
11426
|
}
|
|
@@ -15018,6 +15125,8 @@ function completeParseContext(context) {
|
|
|
15018
15125
|
[traqulaIndentation]: context[traqulaIndentation] ?? 0
|
|
15019
15126
|
};
|
|
15020
15127
|
}
|
|
15128
|
+
var AstTransformer2 = class extends TransformerSubType {
|
|
15129
|
+
};
|
|
15021
15130
|
/*! Bundled license information:
|
|
15022
15131
|
|
|
15023
15132
|
lodash-es/lodash.js:
|
package/lib/parserUtils.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { TransformerSubType } from '@traqula/core';
|
|
1
2
|
import type { SparqlContext, SparqlGeneratorContext } from './sparql12HelperTypes.js';
|
|
3
|
+
import type { Sparql12Nodes } from './sparql12Types.js';
|
|
2
4
|
export declare function completeParseContext(context: Partial<SparqlContext & SparqlGeneratorContext & {
|
|
3
5
|
origSource: string;
|
|
4
6
|
offset?: number;
|
|
@@ -6,3 +8,5 @@ export declare function completeParseContext(context: Partial<SparqlContext & Sp
|
|
|
6
8
|
origSource: string;
|
|
7
9
|
offset?: number;
|
|
8
10
|
};
|
|
11
|
+
export declare class AstTransformer extends TransformerSubType<Sparql12Nodes> {
|
|
12
|
+
}
|
package/lib/parserUtils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { traqulaIndentation } from '@traqula/core';
|
|
1
|
+
import { TransformerSubType, traqulaIndentation } from '@traqula/core';
|
|
2
2
|
import { AstFactory } from './AstFactory.js';
|
|
3
3
|
export function completeParseContext(context) {
|
|
4
4
|
return {
|
|
@@ -13,4 +13,6 @@ export function completeParseContext(context) {
|
|
|
13
13
|
[traqulaIndentation]: context[traqulaIndentation] ?? 0,
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
+
export class AstTransformer extends TransformerSubType {
|
|
17
|
+
}
|
|
16
18
|
//# sourceMappingURL=parserUtils.js.map
|
package/lib/parserUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parserUtils.js","sourceRoot":"","sources":["parserUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"parserUtils.js","sourceRoot":"","sources":["parserUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C,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,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,CAAC;QACjC,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC;KACvD,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,cAAe,SAAQ,kBAAiC;CAAG","sourcesContent":["import { TransformerSubType, traqulaIndentation } from '@traqula/core';\nimport { AstFactory } from './AstFactory.js';\nimport type { SparqlContext, SparqlGeneratorContext } from './sparql12HelperTypes.js';\nimport type { Sparql12Nodes } from './sparql12Types.js';\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 indentInc: context.indentInc ?? 2,\n [traqulaIndentation]: context[traqulaIndentation] ?? 0,\n };\n}\n\nexport class AstTransformer extends TransformerSubType<Sparql12Nodes> {}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@traqula/rules-sparql-1-2",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.17",
|
|
5
5
|
"description": "Traqula Lexer and Grammar Rules for sparql 1.2",
|
|
6
6
|
"lsd:module": true,
|
|
7
7
|
"license": "MIT",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"build:transpile": " node \"../../node_modules/esbuild/bin/esbuild\" --format=cjs --bundle --log-level=error --outfile=lib/index.cjs lib/index.ts"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@traqula/core": "^0.0.
|
|
46
|
-
"@traqula/rules-sparql-1-1": "^0.0.
|
|
45
|
+
"@traqula/core": "^0.0.17",
|
|
46
|
+
"@traqula/rules-sparql-1-1": "^0.0.17"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "e4c1ef096da34d42ff86ac01d9affd428754c0b1"
|
|
49
49
|
}
|