@traqula/generator-sparql-1-1 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 +256 -150
- package/lib/index.d.ts +14 -14
- package/package.json +6 -6
package/lib/index.cjs
CHANGED
|
@@ -9718,6 +9718,11 @@ var LexerBuilder = class _LexerBuilder {
|
|
|
9718
9718
|
|
|
9719
9719
|
// ../../packages/core/lib/Transformers.js
|
|
9720
9720
|
var TransformerType = class {
|
|
9721
|
+
clone(obj) {
|
|
9722
|
+
const newObj = Object.create(Object.getPrototypeOf(obj));
|
|
9723
|
+
Object.defineProperties(newObj, Object.getOwnPropertyDescriptors(obj));
|
|
9724
|
+
return newObj;
|
|
9725
|
+
}
|
|
9721
9726
|
safeObjectVisit(value, mapper) {
|
|
9722
9727
|
if (value && typeof value === "object") {
|
|
9723
9728
|
if (Array.isArray(value)) {
|
|
@@ -9727,104 +9732,213 @@ var TransformerType = class {
|
|
|
9727
9732
|
}
|
|
9728
9733
|
return value;
|
|
9729
9734
|
}
|
|
9730
|
-
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
9741
|
-
|
|
9742
|
-
|
|
9743
|
-
|
|
9744
|
-
|
|
9745
|
-
|
|
9746
|
-
|
|
9747
|
-
|
|
9748
|
-
|
|
9749
|
-
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
|
|
9735
|
+
/**
|
|
9736
|
+
* Recursively transforms all objects that are not arrays. Mapper is called on deeper objects first.
|
|
9737
|
+
* @param startObject object to start iterating from
|
|
9738
|
+
* @param mapper mapper to transform the various objects - argument is a copy of the original
|
|
9739
|
+
* @param preVisitor callback that is evaluated before iterating deeper.
|
|
9740
|
+
* If continues is false, we do not iterate deeper, current object is still mapped. - default: true
|
|
9741
|
+
* If shortcut is true, we do not iterate deeper, nor do we branch out, this mapper will be the last one called.
|
|
9742
|
+
* - Default false
|
|
9743
|
+
*/
|
|
9744
|
+
transformObject(startObject, mapper, preVisitor = () => ({})) {
|
|
9745
|
+
let didShortCut = false;
|
|
9746
|
+
const recurse = (curObject) => {
|
|
9747
|
+
const copy3 = this.clone(curObject);
|
|
9748
|
+
const context = preVisitor(copy3);
|
|
9749
|
+
didShortCut = context.shortcut ?? false;
|
|
9750
|
+
const continues = context.continue ?? true;
|
|
9751
|
+
if (continues && !didShortCut) {
|
|
9752
|
+
for (const [key, value] of Object.entries(copy3)) {
|
|
9753
|
+
if (didShortCut) {
|
|
9754
|
+
return copy3;
|
|
9755
|
+
}
|
|
9756
|
+
copy3[key] = this.safeObjectVisit(value, (obj) => recurse(obj));
|
|
9757
|
+
}
|
|
9758
|
+
}
|
|
9759
|
+
return mapper(copy3);
|
|
9760
|
+
};
|
|
9761
|
+
return recurse(startObject);
|
|
9753
9762
|
}
|
|
9754
|
-
|
|
9755
|
-
|
|
9756
|
-
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9761
|
-
|
|
9762
|
-
|
|
9763
|
-
|
|
9764
|
-
|
|
9765
|
-
|
|
9766
|
-
|
|
9763
|
+
/**
|
|
9764
|
+
* Visitor that visits all objects. Visits deeper objects first.
|
|
9765
|
+
*/
|
|
9766
|
+
visitObject(startObject, visitor, preVisitor = () => ({})) {
|
|
9767
|
+
let didShortCut = false;
|
|
9768
|
+
const recurse = (curObject) => {
|
|
9769
|
+
const context = preVisitor(curObject);
|
|
9770
|
+
didShortCut = context.shortcut ?? false;
|
|
9771
|
+
const continues = context.continue ?? true;
|
|
9772
|
+
if (continues && !didShortCut) {
|
|
9773
|
+
for (const value of Object.values(curObject)) {
|
|
9774
|
+
if (didShortCut) {
|
|
9775
|
+
return;
|
|
9776
|
+
}
|
|
9777
|
+
this.safeObjectVisit(value, (obj) => recurse(obj));
|
|
9778
|
+
}
|
|
9767
9779
|
}
|
|
9768
|
-
|
|
9780
|
+
visitor(curObject);
|
|
9781
|
+
};
|
|
9782
|
+
recurse(startObject);
|
|
9783
|
+
}
|
|
9784
|
+
transformNode(startObject, nodeCallBacks) {
|
|
9785
|
+
const transformWrapper = (curObject) => {
|
|
9786
|
+
const casted = curObject;
|
|
9787
|
+
if (casted.type) {
|
|
9788
|
+
const ogFunc = nodeCallBacks[casted.type]?.transform;
|
|
9789
|
+
if (ogFunc) {
|
|
9790
|
+
return ogFunc(casted);
|
|
9791
|
+
}
|
|
9792
|
+
}
|
|
9793
|
+
return curObject;
|
|
9794
|
+
};
|
|
9795
|
+
const preTransformWrapper = (curObject) => {
|
|
9796
|
+
const casted = curObject;
|
|
9797
|
+
if (casted.type) {
|
|
9798
|
+
const ogFunc = nodeCallBacks[casted.type]?.preVisitor;
|
|
9799
|
+
if (ogFunc) {
|
|
9800
|
+
return ogFunc(casted);
|
|
9801
|
+
}
|
|
9802
|
+
}
|
|
9803
|
+
return {};
|
|
9804
|
+
};
|
|
9805
|
+
return this.transformObject(startObject, transformWrapper, preTransformWrapper);
|
|
9806
|
+
}
|
|
9807
|
+
visitNode(startObject, nodeCallBacks) {
|
|
9808
|
+
const visitWrapper = (curObject) => {
|
|
9809
|
+
const casted = curObject;
|
|
9810
|
+
if (casted.type) {
|
|
9811
|
+
const ogFunc = nodeCallBacks[casted.type]?.visitor;
|
|
9812
|
+
if (ogFunc) {
|
|
9813
|
+
ogFunc(casted);
|
|
9814
|
+
}
|
|
9815
|
+
}
|
|
9816
|
+
};
|
|
9817
|
+
const preVisitWrapper = (curObject) => {
|
|
9818
|
+
const casted = curObject;
|
|
9819
|
+
if (casted.type) {
|
|
9820
|
+
const ogFunc = nodeCallBacks[casted.type]?.preVisitor;
|
|
9821
|
+
if (ogFunc) {
|
|
9822
|
+
return ogFunc(casted);
|
|
9823
|
+
}
|
|
9824
|
+
}
|
|
9825
|
+
return {};
|
|
9826
|
+
};
|
|
9827
|
+
this.visitObject(startObject, visitWrapper, preVisitWrapper);
|
|
9828
|
+
}
|
|
9829
|
+
traverseNodes(currentNode, traverse) {
|
|
9830
|
+
let didShortCut = false;
|
|
9831
|
+
const recurse = (curNode) => {
|
|
9832
|
+
const traverser = traverse[curNode.type];
|
|
9833
|
+
if (traverser) {
|
|
9834
|
+
const { next, shortcut } = traverser(curNode);
|
|
9835
|
+
didShortCut = shortcut ?? false;
|
|
9836
|
+
if (!didShortCut) {
|
|
9837
|
+
for (const node of next ?? []) {
|
|
9838
|
+
if (didShortCut) {
|
|
9839
|
+
return;
|
|
9840
|
+
}
|
|
9841
|
+
recurse(node);
|
|
9842
|
+
}
|
|
9843
|
+
}
|
|
9844
|
+
}
|
|
9845
|
+
};
|
|
9846
|
+
recurse(currentNode);
|
|
9769
9847
|
}
|
|
9770
9848
|
};
|
|
9771
9849
|
var TransformerSubType = class extends TransformerType {
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
|
|
9775
|
-
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
|
|
9783
|
-
|
|
9784
|
-
|
|
9785
|
-
|
|
9786
|
-
|
|
9787
|
-
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
|
|
9794
|
-
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
|
|
9798
|
-
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
return copy3;
|
|
9850
|
+
transformNodeSpecific(startObject, nodeCallBacks, nodeSpecificCallBacks) {
|
|
9851
|
+
const transformWrapper = (curObject) => {
|
|
9852
|
+
let ogTransform;
|
|
9853
|
+
const casted = curObject;
|
|
9854
|
+
if (casted.type && casted.subType) {
|
|
9855
|
+
const specific = nodeSpecificCallBacks[casted.type];
|
|
9856
|
+
if (specific) {
|
|
9857
|
+
ogTransform = specific[casted.subType]?.transform;
|
|
9858
|
+
}
|
|
9859
|
+
if (!ogTransform) {
|
|
9860
|
+
ogTransform = nodeCallBacks[casted.type]?.transform;
|
|
9861
|
+
}
|
|
9862
|
+
}
|
|
9863
|
+
return ogTransform ? ogTransform(casted) : curObject;
|
|
9864
|
+
};
|
|
9865
|
+
const preVisitWrapper = (curObject) => {
|
|
9866
|
+
let ogPreVisit;
|
|
9867
|
+
const casted = curObject;
|
|
9868
|
+
if (casted.type && casted.subType) {
|
|
9869
|
+
const specific = nodeSpecificCallBacks[casted.type];
|
|
9870
|
+
if (specific) {
|
|
9871
|
+
ogPreVisit = specific[casted.subType]?.preVisitor;
|
|
9872
|
+
}
|
|
9873
|
+
if (!ogPreVisit) {
|
|
9874
|
+
ogPreVisit = nodeCallBacks[casted.type]?.preVisitor;
|
|
9875
|
+
}
|
|
9876
|
+
}
|
|
9877
|
+
return ogPreVisit ? ogPreVisit(casted) : curObject;
|
|
9878
|
+
};
|
|
9879
|
+
return this.transformObject(startObject, transformWrapper, preVisitWrapper);
|
|
9803
9880
|
}
|
|
9804
9881
|
/**
|
|
9805
9882
|
* When both nodeCallBack and NodeSpecific callBack are matched, will only look at nodeSpecifCallback
|
|
9806
9883
|
*/
|
|
9807
|
-
visitNodeSpecific(
|
|
9808
|
-
|
|
9809
|
-
|
|
9810
|
-
|
|
9811
|
-
|
|
9812
|
-
|
|
9813
|
-
|
|
9884
|
+
visitNodeSpecific(startObject, nodeCallBacks, nodeSpecificCallBacks) {
|
|
9885
|
+
const visitWrapper = (curObject) => {
|
|
9886
|
+
let ogTransform;
|
|
9887
|
+
const casted = curObject;
|
|
9888
|
+
if (casted.type && casted.subType) {
|
|
9889
|
+
const specific = nodeSpecificCallBacks[casted.type];
|
|
9890
|
+
if (specific) {
|
|
9891
|
+
ogTransform = specific[casted.subType]?.visitor;
|
|
9892
|
+
}
|
|
9893
|
+
if (!ogTransform) {
|
|
9894
|
+
ogTransform = nodeCallBacks[casted.type]?.visitor;
|
|
9895
|
+
}
|
|
9814
9896
|
}
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
callback = nodeCallBacks[curObject.type];
|
|
9818
|
-
}
|
|
9819
|
-
let shouldIterate = true;
|
|
9820
|
-
if (callback) {
|
|
9821
|
-
shouldIterate = callback(curObject) ?? true;
|
|
9822
|
-
}
|
|
9823
|
-
if (shouldIterate) {
|
|
9824
|
-
for (const value of Object.values(curObject)) {
|
|
9825
|
-
this.safeObjectVisit(value, (obj) => this.visitNodeSpecific(obj, nodeCallBacks, nodeSpecificCallBacks));
|
|
9897
|
+
if (ogTransform) {
|
|
9898
|
+
ogTransform(casted);
|
|
9826
9899
|
}
|
|
9827
|
-
}
|
|
9900
|
+
};
|
|
9901
|
+
const preVisitWrapper = (curObject) => {
|
|
9902
|
+
let ogPreVisit;
|
|
9903
|
+
const casted = curObject;
|
|
9904
|
+
if (casted.type && casted.subType) {
|
|
9905
|
+
const specific = nodeSpecificCallBacks[casted.type];
|
|
9906
|
+
if (specific) {
|
|
9907
|
+
ogPreVisit = specific[casted.subType]?.preVisitor;
|
|
9908
|
+
}
|
|
9909
|
+
if (!ogPreVisit) {
|
|
9910
|
+
ogPreVisit = nodeCallBacks[casted.type]?.preVisitor;
|
|
9911
|
+
}
|
|
9912
|
+
}
|
|
9913
|
+
return ogPreVisit ? ogPreVisit(casted) : curObject;
|
|
9914
|
+
};
|
|
9915
|
+
this.visitObject(startObject, visitWrapper, preVisitWrapper);
|
|
9916
|
+
}
|
|
9917
|
+
traverseSubNodes(currentNode, traverseNode, traverseSubNode) {
|
|
9918
|
+
let didShortCut = false;
|
|
9919
|
+
const recurse = (curNode) => {
|
|
9920
|
+
let traverser;
|
|
9921
|
+
const subObj = traverseSubNode[curNode.type];
|
|
9922
|
+
if (subObj) {
|
|
9923
|
+
traverser = subObj[curNode.subType];
|
|
9924
|
+
}
|
|
9925
|
+
if (!traverser) {
|
|
9926
|
+
traverser = traverseNode[curNode.type];
|
|
9927
|
+
}
|
|
9928
|
+
if (traverser) {
|
|
9929
|
+
const { next, shortcut } = traverser(curNode);
|
|
9930
|
+
didShortCut = shortcut ?? false;
|
|
9931
|
+
if (!didShortCut) {
|
|
9932
|
+
for (const node of next ?? []) {
|
|
9933
|
+
if (didShortCut) {
|
|
9934
|
+
return;
|
|
9935
|
+
}
|
|
9936
|
+
recurse(node);
|
|
9937
|
+
}
|
|
9938
|
+
}
|
|
9939
|
+
}
|
|
9940
|
+
};
|
|
9941
|
+
recurse(currentNode);
|
|
9828
9942
|
}
|
|
9829
9943
|
};
|
|
9830
9944
|
|
|
@@ -11261,12 +11375,12 @@ var CommonIRIs;
|
|
|
11261
11375
|
CommonIRIs2["NIL"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil";
|
|
11262
11376
|
CommonIRIs2["TYPE"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
|
|
11263
11377
|
})(CommonIRIs || (CommonIRIs = {}));
|
|
11264
|
-
var
|
|
11378
|
+
var AstTransformer = class extends TransformerSubType {
|
|
11265
11379
|
};
|
|
11266
11380
|
|
|
11267
11381
|
// ../../packages/rules-sparql-1-1/lib/validation/validators.js
|
|
11268
11382
|
var F = new AstFactory();
|
|
11269
|
-
var transformer = new
|
|
11383
|
+
var transformer = new AstTransformer();
|
|
11270
11384
|
function getAggregatesOfExpression(expression2) {
|
|
11271
11385
|
if (F.isExpressionAggregate(expression2)) {
|
|
11272
11386
|
return [expression2];
|
|
@@ -11345,77 +11459,69 @@ function queryIsGood(query2) {
|
|
|
11345
11459
|
}
|
|
11346
11460
|
}
|
|
11347
11461
|
}
|
|
11462
|
+
function notUndefined(some2) {
|
|
11463
|
+
return some2 !== void 0;
|
|
11464
|
+
}
|
|
11348
11465
|
function findPatternBoundedVars(iter, boundedVars) {
|
|
11349
|
-
|
|
11350
|
-
|
|
11351
|
-
|
|
11352
|
-
|
|
11353
|
-
|
|
11354
|
-
|
|
11355
|
-
|
|
11356
|
-
|
|
11357
|
-
|
|
11358
|
-
|
|
11359
|
-
|
|
11360
|
-
|
|
11361
|
-
|
|
11362
|
-
|
|
11363
|
-
|
|
11364
|
-
|
|
11365
|
-
|
|
11366
|
-
|
|
11367
|
-
|
|
11368
|
-
|
|
11466
|
+
transformer.traverseSubNodes(iter, {
|
|
11467
|
+
query: (op) => ({ next: [
|
|
11468
|
+
op.solutionModifiers.group
|
|
11469
|
+
].filter(notUndefined) }),
|
|
11470
|
+
triple: (op) => ({ next: [op.subject, op.predicate, op.object] }),
|
|
11471
|
+
path: (op) => ({ next: op.items }),
|
|
11472
|
+
tripleCollection: (op) => ({ next: [op.identifier, ...op.triples] })
|
|
11473
|
+
}, {
|
|
11474
|
+
query: {
|
|
11475
|
+
select: (op) => ({ next: [
|
|
11476
|
+
...op.variables.some((x) => F.isWildcard(x)) ? [op.where] : op.variables,
|
|
11477
|
+
op.solutionModifiers.group,
|
|
11478
|
+
op.values
|
|
11479
|
+
].filter(notUndefined) }),
|
|
11480
|
+
describe: (op) => ({ next: [
|
|
11481
|
+
...op.variables.some((x) => F.isWildcard(x)) ? [op.where] : op.variables,
|
|
11482
|
+
op.solutionModifiers.group,
|
|
11483
|
+
op.values
|
|
11484
|
+
].filter(notUndefined) })
|
|
11485
|
+
},
|
|
11486
|
+
solutionModifier: {
|
|
11487
|
+
group: (op) => ({
|
|
11488
|
+
next: op.groupings.filter((g) => "variable" in g).map((x) => x.variable)
|
|
11489
|
+
}),
|
|
11490
|
+
having: (op) => ({ next: op.having }),
|
|
11491
|
+
order: (op) => ({ next: op.orderDefs.map((x) => x.expression) })
|
|
11492
|
+
},
|
|
11493
|
+
pattern: {
|
|
11494
|
+
values: (op) => {
|
|
11495
|
+
for (const v of Object.keys(op.values.at(0) ?? {})) {
|
|
11369
11496
|
boundedVars.add(v);
|
|
11370
11497
|
}
|
|
11498
|
+
return {};
|
|
11499
|
+
},
|
|
11500
|
+
bgp: (op) => ({ next: op.triples }),
|
|
11501
|
+
group: (op) => ({ next: op.patterns }),
|
|
11502
|
+
union: (op) => ({ next: op.patterns }),
|
|
11503
|
+
optional: (op) => ({ next: op.patterns }),
|
|
11504
|
+
service: (op) => ({ next: [op.name, ...op.patterns] }),
|
|
11505
|
+
bind: (op) => ({ next: [op.variable] }),
|
|
11506
|
+
graph: (op) => ({ next: [op.name, ...op.patterns] }),
|
|
11507
|
+
minus: (op) => ({ next: op.patterns.slice(0, 1) })
|
|
11508
|
+
},
|
|
11509
|
+
term: {
|
|
11510
|
+
variable: (op) => {
|
|
11511
|
+
boundedVars.add(op.value);
|
|
11512
|
+
return {};
|
|
11371
11513
|
}
|
|
11372
11514
|
}
|
|
11373
|
-
}
|
|
11374
|
-
if (F.isTermVariable(iter)) {
|
|
11375
|
-
boundedVars.add(iter.value);
|
|
11376
|
-
}
|
|
11377
|
-
} else if (F.isTriple(iter)) {
|
|
11378
|
-
findPatternBoundedVars(iter.subject, boundedVars);
|
|
11379
|
-
findPatternBoundedVars(iter.predicate, boundedVars);
|
|
11380
|
-
findPatternBoundedVars(iter.object, boundedVars);
|
|
11381
|
-
} else if (F.isPath(iter)) {
|
|
11382
|
-
if (!F.isTerm(iter)) {
|
|
11383
|
-
for (const item of iter.items) {
|
|
11384
|
-
findPatternBoundedVars(item, boundedVars);
|
|
11385
|
-
}
|
|
11386
|
-
}
|
|
11387
|
-
} else if (F.isTripleCollection(iter) || F.isPatternBgp(iter)) {
|
|
11388
|
-
for (const triple of iter.triples) {
|
|
11389
|
-
findPatternBoundedVars(triple, boundedVars);
|
|
11390
|
-
}
|
|
11391
|
-
} else if (F.isPatternGroup(iter) || F.isPatternUnion(iter) || F.isPatternOptional(iter) || F.isPatternService(iter)) {
|
|
11392
|
-
for (const pattern of iter.patterns) {
|
|
11393
|
-
findPatternBoundedVars(pattern, boundedVars);
|
|
11394
|
-
}
|
|
11395
|
-
if (F.isPatternService(iter)) {
|
|
11396
|
-
findPatternBoundedVars(iter.name, boundedVars);
|
|
11397
|
-
}
|
|
11398
|
-
} else if (F.isPatternBind(iter)) {
|
|
11399
|
-
findPatternBoundedVars(iter.variable, boundedVars);
|
|
11400
|
-
} else if (F.isPatternValues(iter)) {
|
|
11401
|
-
for (const variable of Object.keys(iter.values.at(0) ?? {})) {
|
|
11402
|
-
boundedVars.add(variable);
|
|
11403
|
-
}
|
|
11404
|
-
} else if (F.isPatternGraph(iter)) {
|
|
11405
|
-
findPatternBoundedVars(iter.name, boundedVars);
|
|
11406
|
-
for (const pattern of iter.patterns) {
|
|
11407
|
-
findPatternBoundedVars(pattern, boundedVars);
|
|
11408
|
-
}
|
|
11409
|
-
}
|
|
11515
|
+
});
|
|
11410
11516
|
}
|
|
11411
11517
|
function checkNote13(patterns) {
|
|
11412
11518
|
for (const [index, pattern] of patterns.entries()) {
|
|
11413
11519
|
if (F.isPatternBind(pattern) && index > 0 && F.isPatternBgp(patterns[index - 1])) {
|
|
11414
11520
|
const bgp = patterns[index - 1];
|
|
11415
11521
|
const variables = [];
|
|
11416
|
-
transformer.visitNodeSpecific(bgp, {}, { term: { variable: (var_2) => {
|
|
11522
|
+
transformer.visitNodeSpecific(bgp, {}, { term: { variable: { visitor: (var_2) => {
|
|
11417
11523
|
variables.push(var_2);
|
|
11418
|
-
} } });
|
|
11524
|
+
} } } });
|
|
11419
11525
|
if (variables.some((var_2) => var_2.value === pattern.variable.value)) {
|
|
11420
11526
|
throw new Error(`Variable used to bind is already bound (?${pattern.variable.value})`);
|
|
11421
11527
|
}
|
|
@@ -11441,12 +11547,12 @@ function updateNoReuseBlankNodeLabels(updateQuery) {
|
|
|
11441
11547
|
const operation = update2.operation;
|
|
11442
11548
|
if (operation.subType === "insertdata") {
|
|
11443
11549
|
const blankNodesHere = /* @__PURE__ */ new Set();
|
|
11444
|
-
transformer.visitNodeSpecific(operation, {}, { term: { blankNode: (blankNode2) => {
|
|
11550
|
+
transformer.visitNodeSpecific(operation, {}, { term: { blankNode: { visitor: (blankNode2) => {
|
|
11445
11551
|
blankNodesHere.add(blankNode2.label);
|
|
11446
11552
|
if (blankLabelsUsedInInsertData.has(blankNode2.label)) {
|
|
11447
11553
|
throw new Error("Detected reuse blank node across different INSERT DATA clauses");
|
|
11448
11554
|
}
|
|
11449
|
-
} } });
|
|
11555
|
+
} } } });
|
|
11450
11556
|
for (const blankNode2 of blankNodesHere) {
|
|
11451
11557
|
blankLabelsUsedInInsertData.add(blankNode2);
|
|
11452
11558
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { GeneratorBuilder } from '@traqula/core';
|
|
2
2
|
import type * as T11 from '@traqula/rules-sparql-1-1';
|
|
3
|
-
export declare const sparql11GeneratorBuilder: GeneratorBuilder<T11.SparqlGeneratorContext, "
|
|
4
|
-
|
|
3
|
+
export declare const sparql11GeneratorBuilder: GeneratorBuilder<T11.SparqlGeneratorContext, "expression" | "aggregate" | "graphRef" | "path" | "filter" | "bind" | "query" | "solutionModifier" | "blankNode" | "load" | "clear" | "drop" | "create" | "add" | "move" | "copy" | "modify" | "update" | "datasetClauses" | "queryOrUpdate" | "selectQuery" | "constructQuery" | "describeQuery" | "askQuery" | "selectClause" | "update1" | "insertData" | "deleteData" | "deleteWhere" | "graphRefAll" | "quads" | "quadsNotTriples" | "usingClauses" | "argList" | "iriOrFunction" | "prologue" | "prefixDecl" | "baseDecl" | "varOrTerm" | "var" | "graphTerm" | "rdfLiteral" | "iri" | "iriFull" | "prefixedName" | "groupClause" | "havingClause" | "orderClause" | "limitOffsetClauses" | "triplesBlock" | "collectionPath" | "blankNodePropertyListPath" | "triplesNodePath" | "graphNodePath" | "whereClause" | "generatePattern" | "groupGraphPattern" | "graphPatternNotTriples" | "optionalGraphPattern" | "graphGraphPattern" | "serviceGraphPattern" | "inlineData" | "minusGraphPattern" | "groupOrUnionGraphPattern", {
|
|
4
|
+
expression: import("@traqula/core").GeneratorRule<any, "expression"> & T11.SparqlGrammarRule<"expression", T11.Expression, []> & T11.SparqlGeneratorRule<"expression", T11.Expression, []>;
|
|
5
|
+
aggregate: import("@traqula/core").GeneratorRule<T11.SparqlGeneratorContext, "aggregate", T11.ExpressionAggregate, []>;
|
|
5
6
|
graphRef: import("@traqula/core").GeneratorRule<any, "graphRef"> & T11.SparqlGrammarRule<"graphRef", T11.GraphRefSpecific, []> & T11.SparqlGeneratorRule<"graphRef", T11.GraphRefSpecific, []>;
|
|
7
|
+
path: import("@traqula/core").GeneratorRule<T11.SparqlGeneratorContext, "path", T11.Path, [boolean | undefined]>;
|
|
8
|
+
filter: import("@traqula/core").GeneratorRule<any, "filter"> & T11.SparqlGrammarRule<"filter", T11.PatternFilter, []> & T11.SparqlGeneratorRule<"filter", T11.PatternFilter, []>;
|
|
9
|
+
bind: import("@traqula/core").GeneratorRule<any, "bind"> & T11.SparqlGrammarRule<"bind", T11.PatternBind, []> & T11.SparqlGeneratorRule<"bind", T11.PatternBind, []>;
|
|
10
|
+
query: import("@traqula/core").GeneratorRule<any, "query"> & T11.SparqlGrammarRule<"query", T11.Query, []> & T11.SparqlGeneratorRule<"query", T11.Query, []>;
|
|
11
|
+
solutionModifier: import("@traqula/core").GeneratorRule<any, "solutionModifier"> & T11.SparqlGrammarRule<"solutionModifier", T11.SolutionModifiers, []> & T11.SparqlGeneratorRule<"solutionModifier", T11.SolutionModifiers, []>;
|
|
12
|
+
blankNode: import("@traqula/core").GeneratorRule<any, "blankNode"> & T11.SparqlGrammarRule<"blankNode", T11.TermBlank, []> & T11.SparqlGeneratorRule<"blankNode", T11.TermBlank, []>;
|
|
6
13
|
load: import("@traqula/core").GeneratorRule<any, "load"> & T11.SparqlGrammarRule<"load", T11.UpdateOperationLoad, []> & T11.SparqlGeneratorRule<"load", T11.UpdateOperationLoad, []>;
|
|
7
14
|
clear: import("@traqula/core").GeneratorRule<any, "clear"> & T11.SparqlGrammarRule<"clear", T11.UpdateOperationClear | T11.UpdateOperationDrop, []> & T11.SparqlGeneratorRule<"clear", T11.UpdateOperationClear | T11.UpdateOperationDrop, []>;
|
|
8
15
|
drop: import("@traqula/core").GeneratorRule<any, "drop"> & T11.SparqlGrammarRule<"drop", T11.UpdateOperationClear | T11.UpdateOperationDrop, []> & T11.SparqlGeneratorRule<"drop", T11.UpdateOperationClear | T11.UpdateOperationDrop, []>;
|
|
@@ -12,19 +19,13 @@ export declare const sparql11GeneratorBuilder: GeneratorBuilder<T11.SparqlGenera
|
|
|
12
19
|
copy: import("@traqula/core").GeneratorRule<any, "copy"> & T11.SparqlGrammarRule<"copy", T11.UpdateOperationAdd | T11.UpdateOperationMove | T11.UpdateOperationCopy, []> & T11.SparqlGeneratorRule<"copy", T11.UpdateOperationAdd | T11.UpdateOperationMove | T11.UpdateOperationCopy, []>;
|
|
13
20
|
modify: import("@traqula/core").GeneratorRule<any, "modify"> & T11.SparqlGrammarRule<"modify", T11.UpdateOperationModify, []> & T11.SparqlGeneratorRule<"modify", T11.UpdateOperationModify, []>;
|
|
14
21
|
update: import("@traqula/core").GeneratorRule<any, "update"> & T11.SparqlGrammarRule<"update", T11.Update, []> & T11.SparqlGeneratorRule<"update", T11.Update, []>;
|
|
15
|
-
query: import("@traqula/core").GeneratorRule<any, "query"> & T11.SparqlGrammarRule<"query", T11.Query, []> & T11.SparqlGeneratorRule<"query", T11.Query, []>;
|
|
16
22
|
datasetClauses: import("@traqula/core").GeneratorRule<any, "datasetClauses"> & T11.SparqlGrammarRule<"datasetClauses", T11.DatasetClauses, []> & T11.SparqlGeneratorRule<"datasetClauses", T11.DatasetClauses, []>;
|
|
17
|
-
|
|
18
|
-
solutionModifier: import("@traqula/core").GeneratorRule<any, "solutionModifier"> & T11.SparqlGrammarRule<"solutionModifier", T11.SolutionModifiers, []> & T11.SparqlGeneratorRule<"solutionModifier", T11.SolutionModifiers, []>;
|
|
19
|
-
expression: import("@traqula/core").GeneratorRule<any, "expression"> & T11.SparqlGrammarRule<"expression", T11.Expression, []> & T11.SparqlGeneratorRule<"expression", T11.Expression, []>;
|
|
20
|
-
aggregate: import("@traqula/core").GeneratorRule<T11.SparqlGeneratorContext, "aggregate", T11.ExpressionAggregate, []>;
|
|
21
|
-
path: import("@traqula/core").GeneratorRule<T11.SparqlGeneratorContext, "path", T11.Path, [boolean | undefined]>;
|
|
22
|
-
blankNode: import("@traqula/core").GeneratorRule<any, "blankNode"> & T11.SparqlGrammarRule<"blankNode", T11.TermBlank, []> & T11.SparqlGeneratorRule<"blankNode", T11.TermBlank, []>;
|
|
23
|
+
queryOrUpdate: import("@traqula/core").GeneratorRule<any, "queryOrUpdate"> & T11.SparqlGrammarRule<"queryOrUpdate", T11.SparqlQuery, []> & T11.SparqlGeneratorRule<"queryOrUpdate", T11.SparqlQuery, []>;
|
|
23
24
|
selectQuery: import("@traqula/core").GeneratorRule<any, "selectQuery"> & T11.SparqlGrammarRule<"selectQuery", Omit<T11.QuerySelect, T11.gram.HandledByBase>, []> & T11.SparqlGeneratorRule<"selectQuery", Omit<T11.QuerySelect, T11.gram.HandledByBase>, []>;
|
|
24
|
-
selectClause: import("@traqula/core").GeneratorRule<any, "selectClause"> & T11.SparqlGrammarRule<"selectClause", import("@traqula/core").Wrap<Pick<T11.QuerySelect, "variables" | "distinct" | "reduced">>, []> & T11.SparqlGeneratorRule<"selectClause", import("@traqula/core").Wrap<Pick<T11.QuerySelect, "variables" | "distinct" | "reduced">>, []>;
|
|
25
25
|
constructQuery: import("@traqula/core").GeneratorRule<any, "constructQuery"> & T11.SparqlGrammarRule<"constructQuery", Omit<T11.QueryConstruct, T11.gram.HandledByBase>, []> & T11.SparqlGeneratorRule<"constructQuery", Omit<T11.QueryConstruct, T11.gram.HandledByBase>, []>;
|
|
26
26
|
describeQuery: import("@traqula/core").GeneratorRule<any, "describeQuery"> & T11.SparqlGrammarRule<"describeQuery", Omit<T11.QueryDescribe, T11.gram.HandledByBase>, []> & T11.SparqlGeneratorRule<"describeQuery", Omit<T11.QueryDescribe, T11.gram.HandledByBase>, []>;
|
|
27
27
|
askQuery: import("@traqula/core").GeneratorRule<any, "askQuery"> & T11.SparqlGrammarRule<"askQuery", Omit<T11.QueryAsk, T11.gram.HandledByBase>, []> & T11.SparqlGeneratorRule<"askQuery", Omit<T11.QueryAsk, T11.gram.HandledByBase>, []>;
|
|
28
|
+
selectClause: import("@traqula/core").GeneratorRule<any, "selectClause"> & T11.SparqlGrammarRule<"selectClause", import("@traqula/core").Wrap<Pick<T11.QuerySelect, "variables" | "distinct" | "reduced">>, []> & T11.SparqlGeneratorRule<"selectClause", import("@traqula/core").Wrap<Pick<T11.QuerySelect, "variables" | "distinct" | "reduced">>, []>;
|
|
28
29
|
update1: import("@traqula/core").GeneratorRule<any, "update1"> & T11.SparqlGrammarRule<"update1", T11.UpdateOperation, []> & T11.SparqlGeneratorRule<"update1", T11.UpdateOperation, []>;
|
|
29
30
|
insertData: import("@traqula/core").GeneratorRule<any, "insertData"> & T11.SparqlGrammarRule<"insertData", T11.UpdateOperationInsertData | T11.UpdateOperationDeleteData | T11.UpdateOperationDeleteWhere, []> & T11.SparqlGeneratorRule<"insertData", T11.UpdateOperationInsertData | T11.UpdateOperationDeleteData | T11.UpdateOperationDeleteWhere, []>;
|
|
30
31
|
deleteData: import("@traqula/core").GeneratorRule<any, "deleteData"> & T11.SparqlGrammarRule<"deleteData", T11.UpdateOperationInsertData | T11.UpdateOperationDeleteData | T11.UpdateOperationDeleteWhere, []> & T11.SparqlGeneratorRule<"deleteData", T11.UpdateOperationInsertData | T11.UpdateOperationDeleteData | T11.UpdateOperationDeleteWhere, []>;
|
|
@@ -36,8 +37,8 @@ export declare const sparql11GeneratorBuilder: GeneratorBuilder<T11.SparqlGenera
|
|
|
36
37
|
argList: import("@traqula/core").GeneratorRule<any, "argList"> & T11.SparqlGrammarRule<"argList", import("@traqula/core").Wrap<T11.gram.IArgList>, []> & T11.SparqlGeneratorRule<"argList", import("@traqula/core").Wrap<T11.gram.IArgList>, []>;
|
|
37
38
|
iriOrFunction: import("@traqula/core").GeneratorRule<any, "iriOrFunction"> & T11.SparqlGrammarRule<"iriOrFunction", T11.ExpressionFunctionCall | T11.TermIri, []> & T11.SparqlGeneratorRule<"iriOrFunction", T11.ExpressionFunctionCall | T11.TermIri, []>;
|
|
38
39
|
prologue: import("@traqula/core").GeneratorRule<any, "prologue"> & T11.SparqlGrammarRule<"prologue", T11.ContextDefinition[], []> & T11.SparqlGeneratorRule<"prologue", T11.ContextDefinition[], []>;
|
|
39
|
-
baseDecl: import("@traqula/core").GeneratorRule<any, "baseDecl"> & T11.SparqlGrammarRule<"baseDecl", T11.ContextDefinitionBase, []> & T11.SparqlGeneratorRule<"baseDecl", T11.ContextDefinitionBase, []>;
|
|
40
40
|
prefixDecl: import("@traqula/core").GeneratorRule<any, "prefixDecl"> & T11.SparqlGrammarRule<"prefixDecl", T11.ContextDefinitionPrefix, []> & T11.SparqlGeneratorRule<"prefixDecl", T11.ContextDefinitionPrefix, []>;
|
|
41
|
+
baseDecl: import("@traqula/core").GeneratorRule<any, "baseDecl"> & T11.SparqlGrammarRule<"baseDecl", T11.ContextDefinitionBase, []> & T11.SparqlGeneratorRule<"baseDecl", T11.ContextDefinitionBase, []>;
|
|
41
42
|
varOrTerm: import("@traqula/core").GeneratorRule<any, "varOrTerm"> & T11.SparqlGrammarRule<"varOrTerm", T11.Term, []> & T11.SparqlGeneratorRule<"varOrTerm", T11.Term, []>;
|
|
42
43
|
var: import("@traqula/core").GeneratorRule<any, "var"> & T11.SparqlGrammarRule<"var", T11.TermVariable, []> & T11.SparqlGeneratorRule<"var", T11.TermVariable, []>;
|
|
43
44
|
graphTerm: import("@traqula/core").GeneratorRule<any, "graphTerm"> & T11.SparqlGrammarRule<"graphTerm", T11.GraphTerm, []> & T11.SparqlGeneratorRule<"graphTerm", T11.GraphTerm, []>;
|
|
@@ -51,12 +52,12 @@ export declare const sparql11GeneratorBuilder: GeneratorBuilder<T11.SparqlGenera
|
|
|
51
52
|
limitOffsetClauses: import("@traqula/core").GeneratorRule<any, "limitOffsetClauses"> & T11.SparqlGrammarRule<"limitOffsetClauses", T11.SolutionModifierLimitOffset, []> & T11.SparqlGeneratorRule<"limitOffsetClauses", T11.SolutionModifierLimitOffset, []>;
|
|
52
53
|
triplesBlock: import("@traqula/core").GeneratorRule<any, "triplesBlock"> & T11.SparqlGrammarRule<"triplesBlock", T11.PatternBgp, []> & T11.SparqlGeneratorRule<"triplesBlock", T11.PatternBgp, []>;
|
|
53
54
|
collectionPath: import("@traqula/core").GeneratorRule<any, "collectionPath"> & T11.SparqlGrammarRule<"collectionPath", T11.TripleCollectionList, []> & T11.SparqlGeneratorRule<"collectionPath", T11.TripleCollectionList, []>;
|
|
54
|
-
triplesNodePath: import("@traqula/core").GeneratorRule<any, "triplesNodePath"> & T11.SparqlGrammarRule<"triplesNodePath", T11.TripleCollection, []> & T11.SparqlGeneratorRule<"triplesNodePath", T11.TripleCollection, []>;
|
|
55
55
|
blankNodePropertyListPath: import("@traqula/core").GeneratorRule<any, "blankNodePropertyListPath"> & T11.SparqlGrammarRule<"blankNodePropertyListPath", T11.TripleCollectionBlankNodeProperties, []> & T11.SparqlGeneratorRule<"blankNodePropertyListPath", T11.TripleCollectionBlankNodeProperties, []>;
|
|
56
|
+
triplesNodePath: import("@traqula/core").GeneratorRule<any, "triplesNodePath"> & T11.SparqlGrammarRule<"triplesNodePath", T11.TripleCollection, []> & T11.SparqlGeneratorRule<"triplesNodePath", T11.TripleCollection, []>;
|
|
56
57
|
graphNodePath: import("@traqula/core").GeneratorRule<any, "graphNodePath"> & T11.SparqlGrammarRule<"graphNodePath", T11.TripleCollection | T11.Term, []> & T11.SparqlGeneratorRule<"graphNodePath", T11.TripleCollection | T11.Term, []>;
|
|
57
58
|
whereClause: import("@traqula/core").GeneratorRule<any, "whereClause"> & T11.SparqlGrammarRule<"whereClause", import("@traqula/core").Wrap<T11.PatternGroup>, []> & T11.SparqlGeneratorRule<"whereClause", import("@traqula/core").Wrap<T11.PatternGroup>, []>;
|
|
58
|
-
groupGraphPattern: import("@traqula/core").GeneratorRule<any, "groupGraphPattern"> & T11.SparqlGrammarRule<"groupGraphPattern", T11.PatternGroup, []> & T11.SparqlGeneratorRule<"groupGraphPattern", T11.PatternGroup, []>;
|
|
59
59
|
generatePattern: import("@traqula/core").GeneratorRule<any, "generatePattern"> & T11.SparqlGeneratorRule<"generatePattern", T11.Pattern>;
|
|
60
|
+
groupGraphPattern: import("@traqula/core").GeneratorRule<any, "groupGraphPattern"> & T11.SparqlGrammarRule<"groupGraphPattern", T11.PatternGroup, []> & T11.SparqlGeneratorRule<"groupGraphPattern", T11.PatternGroup, []>;
|
|
60
61
|
graphPatternNotTriples: import("@traqula/core").GeneratorRule<any, "graphPatternNotTriples"> & T11.SparqlGrammarRule<"graphPatternNotTriples", T11.PatternGroup | T11.PatternUnion | T11.PatternOptional | T11.PatternMinus | T11.PatternGraph | T11.PatternService | T11.PatternFilter | T11.PatternBind | T11.PatternValues, []> & T11.SparqlGeneratorRule<"graphPatternNotTriples", T11.PatternGroup | T11.PatternUnion | T11.PatternOptional | T11.PatternMinus | T11.PatternGraph | T11.PatternService | T11.PatternFilter | T11.PatternBind | T11.PatternValues, []>;
|
|
61
62
|
optionalGraphPattern: import("@traqula/core").GeneratorRule<any, "optionalGraphPattern"> & T11.SparqlGrammarRule<"optionalGraphPattern", T11.PatternOptional, []> & T11.SparqlGeneratorRule<"optionalGraphPattern", T11.PatternOptional, []>;
|
|
62
63
|
graphGraphPattern: import("@traqula/core").GeneratorRule<any, "graphGraphPattern"> & T11.SparqlGrammarRule<"graphGraphPattern", T11.PatternGraph, []> & T11.SparqlGeneratorRule<"graphGraphPattern", T11.PatternGraph, []>;
|
|
@@ -64,7 +65,6 @@ export declare const sparql11GeneratorBuilder: GeneratorBuilder<T11.SparqlGenera
|
|
|
64
65
|
inlineData: import("@traqula/core").GeneratorRule<any, "inlineData"> & T11.SparqlGrammarRule<"inlineData", T11.PatternValues, []> & T11.SparqlGeneratorRule<"inlineData", T11.PatternValues, []>;
|
|
65
66
|
minusGraphPattern: import("@traqula/core").GeneratorRule<any, "minusGraphPattern"> & T11.SparqlGrammarRule<"minusGraphPattern", T11.PatternMinus, []> & T11.SparqlGeneratorRule<"minusGraphPattern", T11.PatternMinus, []>;
|
|
66
67
|
groupOrUnionGraphPattern: import("@traqula/core").GeneratorRule<any, "groupOrUnionGraphPattern"> & T11.SparqlGrammarRule<"groupOrUnionGraphPattern", T11.PatternGroup | T11.PatternUnion, []> & T11.SparqlGeneratorRule<"groupOrUnionGraphPattern", T11.PatternGroup | T11.PatternUnion, []>;
|
|
67
|
-
queryOrUpdate: import("@traqula/core").GeneratorRule<any, "queryOrUpdate"> & T11.SparqlGrammarRule<"queryOrUpdate", T11.SparqlQuery, []> & T11.SparqlGeneratorRule<"queryOrUpdate", T11.SparqlQuery, []>;
|
|
68
68
|
}>;
|
|
69
69
|
export type SparqlGenerator = ReturnType<typeof sparql11GeneratorBuilder.build>;
|
|
70
70
|
export declare class Generator {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@traqula/generator-sparql-1-1",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.17",
|
|
5
5
|
"description": "SPARQL 1.1 generator",
|
|
6
6
|
"lsd:module": true,
|
|
7
7
|
"license": "MIT",
|
|
@@ -42,12 +42,12 @@
|
|
|
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
48
|
"devDependencies": {
|
|
49
|
-
"@traqula/parser-sparql-1-1": "^0.0.
|
|
50
|
-
"@traqula/test-utils": "^0.0.
|
|
49
|
+
"@traqula/parser-sparql-1-1": "^0.0.17",
|
|
50
|
+
"@traqula/test-utils": "^0.0.17"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "e4c1ef096da34d42ff86ac01d9affd428754c0b1"
|
|
53
53
|
}
|