@traqula/parser-sparql-1-1-adjust 0.0.18 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Parser.d.ts +118 -118
- package/lib/index.cjs +407 -192
- package/package.json +7 -7
package/lib/index.cjs
CHANGED
|
@@ -43,7 +43,7 @@ var AstCoreFactory = class {
|
|
|
43
43
|
if (filtered.length === 0) {
|
|
44
44
|
return this.gen();
|
|
45
45
|
}
|
|
46
|
-
const first2 = filtered
|
|
46
|
+
const first2 = filtered.at(0);
|
|
47
47
|
const last2 = filtered.at(-1);
|
|
48
48
|
return {
|
|
49
49
|
sourceLocationType: "source",
|
|
@@ -9604,10 +9604,10 @@ var ParserBuilder = class _ParserBuilder {
|
|
|
9604
9604
|
* If a builder is provided, a new copy will be created.
|
|
9605
9605
|
*/
|
|
9606
9606
|
static create(start) {
|
|
9607
|
-
if (start
|
|
9608
|
-
return new _ParserBuilder(
|
|
9607
|
+
if (Array.isArray(start)) {
|
|
9608
|
+
return new _ParserBuilder(listToRuleDefMap(start));
|
|
9609
9609
|
}
|
|
9610
|
-
return new _ParserBuilder(
|
|
9610
|
+
return new _ParserBuilder({ ...start.rules });
|
|
9611
9611
|
}
|
|
9612
9612
|
rules;
|
|
9613
9613
|
constructor(startRules) {
|
|
@@ -9656,6 +9656,9 @@ var ParserBuilder = class _ParserBuilder {
|
|
|
9656
9656
|
delete this.rules[ruleName];
|
|
9657
9657
|
return this;
|
|
9658
9658
|
}
|
|
9659
|
+
getRule(ruleName) {
|
|
9660
|
+
return this.rules[ruleName];
|
|
9661
|
+
}
|
|
9659
9662
|
/**
|
|
9660
9663
|
* Merge this grammar builder with another.
|
|
9661
9664
|
* It is best to merge the bigger grammar with the smaller one.
|
|
@@ -9742,21 +9745,31 @@ ${firstError.message}`);
|
|
|
9742
9745
|
}
|
|
9743
9746
|
};
|
|
9744
9747
|
|
|
9745
|
-
// ../../packages/core/lib/
|
|
9746
|
-
var
|
|
9747
|
-
|
|
9748
|
-
|
|
9749
|
-
|
|
9750
|
-
|
|
9748
|
+
// ../../packages/core/lib/TransformerObject.js
|
|
9749
|
+
var TransformerObject = class {
|
|
9750
|
+
defaultContext;
|
|
9751
|
+
maxStackSize = 1e6;
|
|
9752
|
+
/**
|
|
9753
|
+
* Creates stateless transformer.
|
|
9754
|
+
* @param defaultContext
|
|
9755
|
+
*/
|
|
9756
|
+
constructor(defaultContext = {}) {
|
|
9757
|
+
this.defaultContext = defaultContext;
|
|
9751
9758
|
}
|
|
9752
|
-
|
|
9753
|
-
|
|
9754
|
-
|
|
9755
|
-
|
|
9756
|
-
|
|
9757
|
-
|
|
9759
|
+
/**
|
|
9760
|
+
* Function to shallow clone any type.
|
|
9761
|
+
* @param obj
|
|
9762
|
+
* @protected
|
|
9763
|
+
*/
|
|
9764
|
+
clone(obj) {
|
|
9765
|
+
if (obj === null || typeof obj !== "object") {
|
|
9766
|
+
return obj;
|
|
9758
9767
|
}
|
|
9759
|
-
|
|
9768
|
+
const proto = Object.getPrototypeOf(obj);
|
|
9769
|
+
if (proto === Object.prototype || proto === null) {
|
|
9770
|
+
return { ...obj };
|
|
9771
|
+
}
|
|
9772
|
+
return Object.assign(Object.create(proto), obj);
|
|
9760
9773
|
}
|
|
9761
9774
|
/**
|
|
9762
9775
|
* Recursively transforms all objects that are not arrays. Mapper is called on deeper objects first.
|
|
@@ -9768,90 +9781,228 @@ var TransformerType = class {
|
|
|
9768
9781
|
* - Default false
|
|
9769
9782
|
*/
|
|
9770
9783
|
transformObject(startObject, mapper, preVisitor = () => ({})) {
|
|
9784
|
+
const defaults2 = this.defaultContext;
|
|
9785
|
+
const defaultCopyFlag = defaults2.copy ?? true;
|
|
9786
|
+
const defaultContinues = defaults2.continue ?? true;
|
|
9787
|
+
const defaultIgnoreKeys = defaults2.ignoreKeys;
|
|
9788
|
+
const defaultShallowKeys = defaults2.shallowKeys;
|
|
9789
|
+
const defaultDidShortCut = defaults2.shortcut ?? false;
|
|
9771
9790
|
let didShortCut = false;
|
|
9772
|
-
const
|
|
9773
|
-
|
|
9774
|
-
|
|
9775
|
-
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
|
|
9791
|
+
const resultWrap = { res: startObject };
|
|
9792
|
+
const stack = [startObject];
|
|
9793
|
+
const stackParent = [resultWrap];
|
|
9794
|
+
const stackParentKey = ["res"];
|
|
9795
|
+
const handleMapperOnLen = [];
|
|
9796
|
+
const mapperCopyStack = [];
|
|
9797
|
+
const mapperOrigStack = [];
|
|
9798
|
+
const mapperParent = [];
|
|
9799
|
+
const mapperParentKey = [];
|
|
9800
|
+
function handleMapper() {
|
|
9801
|
+
while (stack.length === handleMapperOnLen.at(-1)) {
|
|
9802
|
+
handleMapperOnLen.pop();
|
|
9803
|
+
const copyToMap = mapperCopyStack.pop();
|
|
9804
|
+
const origToMap = mapperOrigStack.pop();
|
|
9805
|
+
const parent = mapperParent.pop();
|
|
9806
|
+
const parentKey = mapperParentKey.pop();
|
|
9807
|
+
parent[parentKey] = mapper(copyToMap, origToMap);
|
|
9808
|
+
}
|
|
9809
|
+
}
|
|
9810
|
+
while (stack.length > 0 && stack.length < this.maxStackSize) {
|
|
9811
|
+
const curObject = stack.pop();
|
|
9812
|
+
const curParent = stackParent.pop();
|
|
9813
|
+
const curKey = stackParentKey.pop();
|
|
9814
|
+
if (!didShortCut) {
|
|
9815
|
+
if (Array.isArray(curObject)) {
|
|
9816
|
+
const newArr = [...curObject];
|
|
9817
|
+
handleMapperOnLen.push(stack.length);
|
|
9818
|
+
mapperCopyStack.push(newArr);
|
|
9819
|
+
mapperOrigStack.push(curObject);
|
|
9820
|
+
mapperParent.push(curParent);
|
|
9821
|
+
mapperParentKey.push(curKey);
|
|
9822
|
+
for (let index = curObject.length - 1; index >= 0; index--) {
|
|
9823
|
+
const val = curObject[index];
|
|
9824
|
+
if (val !== null && typeof val === "object") {
|
|
9825
|
+
stack.push(val);
|
|
9826
|
+
stackParent.push(newArr);
|
|
9827
|
+
stackParentKey.push(index.toString());
|
|
9828
|
+
}
|
|
9829
|
+
}
|
|
9830
|
+
handleMapper();
|
|
9831
|
+
continue;
|
|
9832
|
+
}
|
|
9833
|
+
const context = preVisitor(curObject);
|
|
9834
|
+
const copyFlag = context.copy ?? defaultCopyFlag;
|
|
9835
|
+
const continues = context.continue ?? defaultContinues;
|
|
9836
|
+
const ignoreKeys = context.ignoreKeys ?? defaultIgnoreKeys;
|
|
9837
|
+
const shallowKeys = context.shallowKeys ?? defaultShallowKeys;
|
|
9838
|
+
didShortCut = context.shortcut ?? defaultDidShortCut;
|
|
9839
|
+
const copy3 = copyFlag ? this.clone(curObject) : curObject;
|
|
9840
|
+
handleMapperOnLen.push(stack.length);
|
|
9841
|
+
mapperCopyStack.push(copy3);
|
|
9842
|
+
mapperOrigStack.push(curObject);
|
|
9843
|
+
mapperParent.push(curParent);
|
|
9844
|
+
mapperParentKey.push(curKey);
|
|
9845
|
+
if (continues && !didShortCut) {
|
|
9846
|
+
for (const key in copy3) {
|
|
9847
|
+
if (!Object.hasOwn(copy3, key)) {
|
|
9848
|
+
continue;
|
|
9849
|
+
}
|
|
9850
|
+
const val = copy3[key];
|
|
9851
|
+
const onlyShallow = shallowKeys && shallowKeys?.has(key);
|
|
9852
|
+
if (onlyShallow) {
|
|
9853
|
+
copy3[key] = this.clone(val);
|
|
9854
|
+
}
|
|
9855
|
+
if (ignoreKeys && ignoreKeys.has(key)) {
|
|
9856
|
+
continue;
|
|
9857
|
+
}
|
|
9858
|
+
if (!onlyShallow && val !== null && typeof val === "object") {
|
|
9859
|
+
stack.push(val);
|
|
9860
|
+
stackParentKey.push(key);
|
|
9861
|
+
stackParent.push(copy3);
|
|
9862
|
+
}
|
|
9781
9863
|
}
|
|
9782
|
-
copy3[key] = this.safeObjectVisit(value, (obj) => recurse(obj));
|
|
9783
9864
|
}
|
|
9784
9865
|
}
|
|
9785
|
-
|
|
9786
|
-
}
|
|
9787
|
-
|
|
9866
|
+
handleMapper();
|
|
9867
|
+
}
|
|
9868
|
+
if (stack.length >= this.maxStackSize) {
|
|
9869
|
+
throw new Error("Transform object stack overflowed");
|
|
9870
|
+
}
|
|
9871
|
+
handleMapper();
|
|
9872
|
+
return resultWrap.res;
|
|
9788
9873
|
}
|
|
9789
9874
|
/**
|
|
9790
9875
|
* Visitor that visits all objects. Visits deeper objects first.
|
|
9791
9876
|
*/
|
|
9792
9877
|
visitObject(startObject, visitor, preVisitor = () => ({})) {
|
|
9878
|
+
const defaults2 = this.defaultContext;
|
|
9879
|
+
const defaultContinues = defaults2.continue ?? true;
|
|
9880
|
+
const defaultIgnoreKeys = defaults2.ignoreKeys;
|
|
9881
|
+
const defaultShortcut = defaults2.shortcut ?? false;
|
|
9793
9882
|
let didShortCut = false;
|
|
9794
|
-
const
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
|
|
9798
|
-
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
9883
|
+
const stack = [startObject];
|
|
9884
|
+
const handleVisitorOnLen = [];
|
|
9885
|
+
const visitorStack = [];
|
|
9886
|
+
function handleVisitor() {
|
|
9887
|
+
while (stack.length === handleVisitorOnLen.at(-1)) {
|
|
9888
|
+
handleVisitorOnLen.pop();
|
|
9889
|
+
const toVisit = visitorStack.pop();
|
|
9890
|
+
visitor(toVisit);
|
|
9891
|
+
}
|
|
9892
|
+
}
|
|
9893
|
+
while (stack.length > 0 && stack.length < this.maxStackSize) {
|
|
9894
|
+
const curObject = stack.pop();
|
|
9895
|
+
if (!didShortCut) {
|
|
9896
|
+
if (Array.isArray(curObject)) {
|
|
9897
|
+
for (let i = curObject.length - 1; i >= 0; i--) {
|
|
9898
|
+
stack.push(curObject[i]);
|
|
9899
|
+
}
|
|
9900
|
+
handleVisitor();
|
|
9901
|
+
continue;
|
|
9902
|
+
}
|
|
9903
|
+
const context = preVisitor(curObject);
|
|
9904
|
+
didShortCut = context.shortcut ?? defaultShortcut;
|
|
9905
|
+
const continues = context.continue ?? defaultContinues;
|
|
9906
|
+
const ignoreKeys = context.ignoreKeys ?? defaultIgnoreKeys;
|
|
9907
|
+
handleVisitorOnLen.push(stack.length);
|
|
9908
|
+
visitorStack.push(curObject);
|
|
9909
|
+
if (continues && !didShortCut) {
|
|
9910
|
+
for (const key in curObject) {
|
|
9911
|
+
if (!Object.hasOwn(curObject, key)) {
|
|
9912
|
+
continue;
|
|
9913
|
+
}
|
|
9914
|
+
if (ignoreKeys && ignoreKeys.has(key)) {
|
|
9915
|
+
continue;
|
|
9916
|
+
}
|
|
9917
|
+
const val = curObject[key];
|
|
9918
|
+
if (val && typeof val === "object") {
|
|
9919
|
+
stack.push(val);
|
|
9920
|
+
}
|
|
9802
9921
|
}
|
|
9803
|
-
this.safeObjectVisit(value, (obj) => recurse(obj));
|
|
9804
9922
|
}
|
|
9805
9923
|
}
|
|
9806
|
-
|
|
9807
|
-
}
|
|
9808
|
-
|
|
9924
|
+
handleVisitor();
|
|
9925
|
+
}
|
|
9926
|
+
if (stack.length >= this.maxStackSize) {
|
|
9927
|
+
throw new Error("Transform object stack overflowed");
|
|
9928
|
+
}
|
|
9929
|
+
handleVisitor();
|
|
9930
|
+
}
|
|
9931
|
+
};
|
|
9932
|
+
|
|
9933
|
+
// ../../packages/core/lib/TransformerTyped.js
|
|
9934
|
+
var TransformerTyped = class extends TransformerObject {
|
|
9935
|
+
defaultNodePreVisitor;
|
|
9936
|
+
constructor(defaultContext = {}, defaultNodePreVisitor = {}) {
|
|
9937
|
+
super(defaultContext);
|
|
9938
|
+
this.defaultNodePreVisitor = defaultNodePreVisitor;
|
|
9809
9939
|
}
|
|
9940
|
+
/**
|
|
9941
|
+
* Transform a single node.
|
|
9942
|
+
* The transformation calls the preVisitor from starting from the startObject.
|
|
9943
|
+
* The preVisitor can dictate whether transformation should be stopped.
|
|
9944
|
+
* Note that stopping the transformation also prevets further copying.
|
|
9945
|
+
* The transformer itself transforms object starting with the deepest one that can be visited.
|
|
9946
|
+
* The transformer callback is performed on a copy of the original.
|
|
9947
|
+
* @param startObject
|
|
9948
|
+
* @param nodeCallBacks
|
|
9949
|
+
*/
|
|
9810
9950
|
transformNode(startObject, nodeCallBacks) {
|
|
9811
|
-
const transformWrapper = (
|
|
9812
|
-
|
|
9951
|
+
const transformWrapper = (copy3, orig) => {
|
|
9952
|
+
let ogTransform;
|
|
9953
|
+
const casted = copy3;
|
|
9813
9954
|
if (casted.type) {
|
|
9814
|
-
|
|
9815
|
-
if (ogFunc) {
|
|
9816
|
-
return ogFunc(casted);
|
|
9817
|
-
}
|
|
9955
|
+
ogTransform = nodeCallBacks[casted.type]?.transform;
|
|
9818
9956
|
}
|
|
9819
|
-
return
|
|
9957
|
+
return ogTransform ? ogTransform(casted, orig) : copy3;
|
|
9820
9958
|
};
|
|
9821
|
-
const
|
|
9959
|
+
const nodeDefaults = this.defaultNodePreVisitor;
|
|
9960
|
+
const preVisitWrapper = (curObject) => {
|
|
9961
|
+
let ogPreVisit;
|
|
9962
|
+
let nodeContext = {};
|
|
9822
9963
|
const casted = curObject;
|
|
9823
9964
|
if (casted.type) {
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
return ogFunc(casted);
|
|
9827
|
-
}
|
|
9965
|
+
ogPreVisit = nodeCallBacks[casted.type]?.preVisitor;
|
|
9966
|
+
nodeContext = nodeDefaults[casted.type] ?? nodeContext;
|
|
9828
9967
|
}
|
|
9829
|
-
return {};
|
|
9968
|
+
return ogPreVisit ? { ...nodeContext, ...ogPreVisit(casted) } : nodeContext;
|
|
9830
9969
|
};
|
|
9831
|
-
return this.transformObject(startObject, transformWrapper,
|
|
9970
|
+
return this.transformObject(startObject, transformWrapper, preVisitWrapper);
|
|
9832
9971
|
}
|
|
9972
|
+
/**
|
|
9973
|
+
* Similar to {@link this.transformNode}, but without copying the startObject.
|
|
9974
|
+
* The pre-visitor visits starting from the root, going deeper, while the actual visitor goes in reverse.
|
|
9975
|
+
* @param startObject
|
|
9976
|
+
* @param nodeCallBacks
|
|
9977
|
+
*/
|
|
9833
9978
|
visitNode(startObject, nodeCallBacks) {
|
|
9834
|
-
const
|
|
9979
|
+
const visitorWrapper = (curObject) => {
|
|
9835
9980
|
const casted = curObject;
|
|
9836
9981
|
if (casted.type) {
|
|
9837
|
-
const
|
|
9838
|
-
if (
|
|
9839
|
-
|
|
9982
|
+
const ogTransform = nodeCallBacks[casted.type]?.visitor;
|
|
9983
|
+
if (ogTransform) {
|
|
9984
|
+
ogTransform(casted);
|
|
9840
9985
|
}
|
|
9841
9986
|
}
|
|
9842
9987
|
};
|
|
9988
|
+
const nodeDefaults = this.defaultNodePreVisitor;
|
|
9843
9989
|
const preVisitWrapper = (curObject) => {
|
|
9990
|
+
let ogPreVisit;
|
|
9991
|
+
let nodeContext = {};
|
|
9844
9992
|
const casted = curObject;
|
|
9845
9993
|
if (casted.type) {
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
return ogFunc(casted);
|
|
9849
|
-
}
|
|
9994
|
+
ogPreVisit = nodeCallBacks[casted.type]?.preVisitor;
|
|
9995
|
+
nodeContext = nodeDefaults[casted.type] ?? nodeContext;
|
|
9850
9996
|
}
|
|
9851
|
-
return {};
|
|
9997
|
+
return ogPreVisit ? { ...nodeContext, ...ogPreVisit(casted) } : nodeContext;
|
|
9852
9998
|
};
|
|
9853
|
-
this.visitObject(startObject,
|
|
9999
|
+
return this.visitObject(startObject, visitorWrapper, preVisitWrapper);
|
|
9854
10000
|
}
|
|
10001
|
+
/**
|
|
10002
|
+
* Traverses only selected nodes as returned by the function.
|
|
10003
|
+
* @param currentNode
|
|
10004
|
+
* @param traverse
|
|
10005
|
+
*/
|
|
9855
10006
|
traverseNodes(currentNode, traverse) {
|
|
9856
10007
|
let didShortCut = false;
|
|
9857
10008
|
const recurse = (curNode) => {
|
|
@@ -9872,11 +10023,24 @@ var TransformerType = class {
|
|
|
9872
10023
|
recurse(currentNode);
|
|
9873
10024
|
}
|
|
9874
10025
|
};
|
|
9875
|
-
|
|
10026
|
+
|
|
10027
|
+
// ../../packages/core/lib/TransformerSubTyped.js
|
|
10028
|
+
var TransformerSubTyped = class extends TransformerTyped {
|
|
10029
|
+
constructor(defaultContext = {}, defaultNodePreVisitor = {}) {
|
|
10030
|
+
super(defaultContext, defaultNodePreVisitor);
|
|
10031
|
+
}
|
|
10032
|
+
/**
|
|
10033
|
+
* Shares the functionality and first two arguments with {@link this.transformNode}.
|
|
10034
|
+
* The third argument allows you to also transform based on the subType of objects.
|
|
10035
|
+
* Note that when a callback for the subtype is provided, the callback for the general type is **NOT** executed.
|
|
10036
|
+
* @param startObject
|
|
10037
|
+
* @param nodeCallBacks
|
|
10038
|
+
* @param nodeSpecificCallBacks
|
|
10039
|
+
*/
|
|
9876
10040
|
transformNodeSpecific(startObject, nodeCallBacks, nodeSpecificCallBacks) {
|
|
9877
|
-
const transformWrapper = (
|
|
10041
|
+
const transformWrapper = (copy3, orig) => {
|
|
9878
10042
|
let ogTransform;
|
|
9879
|
-
const casted =
|
|
10043
|
+
const casted = copy3;
|
|
9880
10044
|
if (casted.type && casted.subType) {
|
|
9881
10045
|
const specific = nodeSpecificCallBacks[casted.type];
|
|
9882
10046
|
if (specific) {
|
|
@@ -9886,7 +10050,7 @@ var TransformerSubType = class extends TransformerType {
|
|
|
9886
10050
|
ogTransform = nodeCallBacks[casted.type]?.transform;
|
|
9887
10051
|
}
|
|
9888
10052
|
}
|
|
9889
|
-
return ogTransform ? ogTransform(casted) :
|
|
10053
|
+
return ogTransform ? ogTransform(casted, orig) : copy3;
|
|
9890
10054
|
};
|
|
9891
10055
|
const preVisitWrapper = (curObject) => {
|
|
9892
10056
|
let ogPreVisit;
|
|
@@ -9900,12 +10064,13 @@ var TransformerSubType = class extends TransformerType {
|
|
|
9900
10064
|
ogPreVisit = nodeCallBacks[casted.type]?.preVisitor;
|
|
9901
10065
|
}
|
|
9902
10066
|
}
|
|
9903
|
-
return ogPreVisit ? ogPreVisit(casted) :
|
|
10067
|
+
return ogPreVisit ? ogPreVisit(casted) : {};
|
|
9904
10068
|
};
|
|
9905
10069
|
return this.transformObject(startObject, transformWrapper, preVisitWrapper);
|
|
9906
10070
|
}
|
|
9907
10071
|
/**
|
|
9908
|
-
*
|
|
10072
|
+
* Similar to {@link this.visitNode} but also allows you to match based on the subtype of objects.
|
|
10073
|
+
* When both nodeCallBack and NodeSpecific callBack are matched, will only visit nodeSpecifCallback
|
|
9909
10074
|
*/
|
|
9910
10075
|
visitNodeSpecific(startObject, nodeCallBacks, nodeSpecificCallBacks) {
|
|
9911
10076
|
const visitWrapper = (curObject) => {
|
|
@@ -9936,10 +10101,16 @@ var TransformerSubType = class extends TransformerType {
|
|
|
9936
10101
|
ogPreVisit = nodeCallBacks[casted.type]?.preVisitor;
|
|
9937
10102
|
}
|
|
9938
10103
|
}
|
|
9939
|
-
return ogPreVisit ? ogPreVisit(casted) :
|
|
10104
|
+
return ogPreVisit ? ogPreVisit(casted) : {};
|
|
9940
10105
|
};
|
|
9941
10106
|
this.visitObject(startObject, visitWrapper, preVisitWrapper);
|
|
9942
10107
|
}
|
|
10108
|
+
/**
|
|
10109
|
+
* Similar to {@link this.traverseNodes} but also allows you to match based on the subtype of objects.
|
|
10110
|
+
* @param currentNode
|
|
10111
|
+
* @param traverseNode
|
|
10112
|
+
* @param traverseSubNode
|
|
10113
|
+
*/
|
|
9943
10114
|
traverseSubNodes(currentNode, traverseNode, traverseSubNode) {
|
|
9944
10115
|
let didShortCut = false;
|
|
9945
10116
|
const recurse = (curNode) => {
|
|
@@ -11012,8 +11183,8 @@ function PatternFactoryMixin(Base) {
|
|
|
11012
11183
|
isPatternOptional(obj) {
|
|
11013
11184
|
return this.isOfSubType(obj, nodeType5, "optional");
|
|
11014
11185
|
}
|
|
11015
|
-
patternValues(values3, loc) {
|
|
11016
|
-
return { type: nodeType5, subType: "values", values: values3, loc };
|
|
11186
|
+
patternValues(variables, values3, loc) {
|
|
11187
|
+
return { type: nodeType5, subType: "values", variables, values: values3, loc };
|
|
11017
11188
|
}
|
|
11018
11189
|
isPatternValues(obj) {
|
|
11019
11190
|
return this.isOfSubType(obj, nodeType5, "values");
|
|
@@ -11188,7 +11359,7 @@ function TermFactoryMixin(Base) {
|
|
|
11188
11359
|
isTerm(x) {
|
|
11189
11360
|
return this.isOfType(x, "term");
|
|
11190
11361
|
}
|
|
11191
|
-
|
|
11362
|
+
termBlank(label, loc) {
|
|
11192
11363
|
const base = {
|
|
11193
11364
|
type: "term",
|
|
11194
11365
|
subType: "blankNode",
|
|
@@ -11202,7 +11373,7 @@ function TermFactoryMixin(Base) {
|
|
|
11202
11373
|
isTermBlank(obj) {
|
|
11203
11374
|
return this.isOfSubType(obj, nodeType8, "blankNode");
|
|
11204
11375
|
}
|
|
11205
|
-
|
|
11376
|
+
termLiteral(loc, value, langOrIri) {
|
|
11206
11377
|
return {
|
|
11207
11378
|
type: nodeType8,
|
|
11208
11379
|
subType: "literal",
|
|
@@ -11224,7 +11395,7 @@ function TermFactoryMixin(Base) {
|
|
|
11224
11395
|
const casted = obj;
|
|
11225
11396
|
return this.isTermLiteral(obj) && typeof casted.langOrIri === "object" && casted.langOrIri !== null && this.isTermNamed(casted.langOrIri);
|
|
11226
11397
|
}
|
|
11227
|
-
|
|
11398
|
+
termVariable(value, loc) {
|
|
11228
11399
|
return {
|
|
11229
11400
|
type: nodeType8,
|
|
11230
11401
|
subType: "variable",
|
|
@@ -11235,7 +11406,7 @@ function TermFactoryMixin(Base) {
|
|
|
11235
11406
|
isTermVariable(obj) {
|
|
11236
11407
|
return this.isOfSubType(obj, nodeType8, "variable");
|
|
11237
11408
|
}
|
|
11238
|
-
|
|
11409
|
+
termNamed(loc, value, prefix) {
|
|
11239
11410
|
const base = {
|
|
11240
11411
|
type: nodeType8,
|
|
11241
11412
|
subType: "namedNode",
|
|
@@ -11498,7 +11669,7 @@ var CommonIRIs;
|
|
|
11498
11669
|
CommonIRIs2["NIL"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil";
|
|
11499
11670
|
CommonIRIs2["TYPE"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
|
|
11500
11671
|
})(CommonIRIs || (CommonIRIs = {}));
|
|
11501
|
-
var AstTransformer = class extends
|
|
11672
|
+
var AstTransformer = class extends TransformerSubTyped {
|
|
11502
11673
|
};
|
|
11503
11674
|
|
|
11504
11675
|
// ../../packages/rules-sparql-1-1/lib/validation/validators.js
|
|
@@ -11714,17 +11885,20 @@ var rdfLiteral = {
|
|
|
11714
11885
|
return OPTION(() => OR([
|
|
11715
11886
|
{ ALT: () => {
|
|
11716
11887
|
const lang2 = CONSUME(terminals_exports.langTag);
|
|
11717
|
-
return ACTION(() => C.astFactory.
|
|
11888
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(value, lang2), value.value, lang2.image.slice(1).toLowerCase()));
|
|
11718
11889
|
} },
|
|
11719
11890
|
{ ALT: () => {
|
|
11720
11891
|
CONSUME(symbols_exports.hathat);
|
|
11721
11892
|
const iriVal = SUBRULE1(iri2);
|
|
11722
|
-
return ACTION(() => C.astFactory.
|
|
11893
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(value, iriVal), value.value, iriVal));
|
|
11723
11894
|
} }
|
|
11724
11895
|
])) ?? value;
|
|
11725
11896
|
},
|
|
11726
|
-
gImpl: ({ SUBRULE, PRINT,
|
|
11727
|
-
astFactory.printFilter(ast, () =>
|
|
11897
|
+
gImpl: ({ SUBRULE, PRINT, PRINT_WORD }) => (ast, { astFactory }) => {
|
|
11898
|
+
astFactory.printFilter(ast, () => {
|
|
11899
|
+
PRINT_WORD("");
|
|
11900
|
+
PRINT(stringEscapedLexical(ast.value));
|
|
11901
|
+
});
|
|
11728
11902
|
if (ast.langOrIri) {
|
|
11729
11903
|
if (typeof ast.langOrIri === "string") {
|
|
11730
11904
|
astFactory.printFilter(ast, () => PRINT("@", ast.langOrIri));
|
|
@@ -11751,7 +11925,7 @@ var numericLiteralUnsigned = {
|
|
|
11751
11925
|
{ ALT: () => [CONSUME(terminals_exports.decimal), CommonIRIs.DECIMAL] },
|
|
11752
11926
|
{ ALT: () => [CONSUME(terminals_exports.double), CommonIRIs.DOUBLE] }
|
|
11753
11927
|
]);
|
|
11754
|
-
return ACTION(() => C.astFactory.
|
|
11928
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(parsed[0]), parsed[0].image, C.astFactory.termNamed(C.astFactory.sourceLocationNoMaterialize(), parsed[1])));
|
|
11755
11929
|
}
|
|
11756
11930
|
};
|
|
11757
11931
|
var numericLiteralPositive = {
|
|
@@ -11762,7 +11936,7 @@ var numericLiteralPositive = {
|
|
|
11762
11936
|
{ ALT: () => [CONSUME(terminals_exports.decimalPositive), CommonIRIs.DECIMAL] },
|
|
11763
11937
|
{ ALT: () => [CONSUME(terminals_exports.doublePositive), CommonIRIs.DOUBLE] }
|
|
11764
11938
|
]);
|
|
11765
|
-
return ACTION(() => C.astFactory.
|
|
11939
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(parsed[0]), parsed[0].image, C.astFactory.termNamed(C.astFactory.sourceLocationNoMaterialize(), parsed[1])));
|
|
11766
11940
|
}
|
|
11767
11941
|
};
|
|
11768
11942
|
var numericLiteralNegative = {
|
|
@@ -11773,7 +11947,7 @@ var numericLiteralNegative = {
|
|
|
11773
11947
|
{ ALT: () => [CONSUME(terminals_exports.decimalNegative), CommonIRIs.DECIMAL] },
|
|
11774
11948
|
{ ALT: () => [CONSUME(terminals_exports.doubleNegative), CommonIRIs.DOUBLE] }
|
|
11775
11949
|
]);
|
|
11776
|
-
return ACTION(() => C.astFactory.
|
|
11950
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(parsed[0]), parsed[0].image, C.astFactory.termNamed(C.astFactory.sourceLocationNoMaterialize(), parsed[1])));
|
|
11777
11951
|
}
|
|
11778
11952
|
};
|
|
11779
11953
|
var booleanLiteral = {
|
|
@@ -11783,7 +11957,7 @@ var booleanLiteral = {
|
|
|
11783
11957
|
{ ALT: () => CONSUME(true_) },
|
|
11784
11958
|
{ ALT: () => CONSUME(false_) }
|
|
11785
11959
|
]);
|
|
11786
|
-
return ACTION(() => C.astFactory.
|
|
11960
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(token), token.image.toLowerCase(), C.astFactory.termNamed(C.astFactory.sourceLocationNoMaterialize(), CommonIRIs.BOOLEAN)));
|
|
11787
11961
|
}
|
|
11788
11962
|
};
|
|
11789
11963
|
var string = {
|
|
@@ -11825,7 +11999,7 @@ var string = {
|
|
|
11825
11999
|
return char;
|
|
11826
12000
|
}
|
|
11827
12001
|
});
|
|
11828
|
-
return F2.
|
|
12002
|
+
return F2.termLiteral(F2.sourceLocation(x[0]), value);
|
|
11829
12003
|
});
|
|
11830
12004
|
}
|
|
11831
12005
|
};
|
|
@@ -11841,7 +12015,7 @@ var iriFull = {
|
|
|
11841
12015
|
name: "iriFull",
|
|
11842
12016
|
impl: ({ ACTION, CONSUME }) => (C) => {
|
|
11843
12017
|
const iriToken = CONSUME(terminals_exports.iriRef);
|
|
11844
|
-
return ACTION(() => C.astFactory.
|
|
12018
|
+
return ACTION(() => C.astFactory.termNamed(C.astFactory.sourceLocation(iriToken), iriToken.image.slice(1, -1)));
|
|
11845
12019
|
},
|
|
11846
12020
|
gImpl: ({ PRINT }) => (ast, { astFactory: F2 }) => {
|
|
11847
12021
|
F2.printFilter(ast, () => PRINT("<", ast.value, ">"));
|
|
@@ -11854,16 +12028,16 @@ var prefixedName = {
|
|
|
11854
12028
|
const longName = CONSUME(terminals_exports.pNameLn);
|
|
11855
12029
|
return ACTION(() => {
|
|
11856
12030
|
const [prefix, localName] = longName.image.split(":");
|
|
11857
|
-
return C.astFactory.
|
|
12031
|
+
return C.astFactory.termNamed(C.astFactory.sourceLocation(longName), localName, prefix);
|
|
11858
12032
|
});
|
|
11859
12033
|
} },
|
|
11860
12034
|
{ ALT: () => {
|
|
11861
12035
|
const shortName = CONSUME(terminals_exports.pNameNs);
|
|
11862
|
-
return ACTION(() => C.astFactory.
|
|
12036
|
+
return ACTION(() => C.astFactory.termNamed(C.astFactory.sourceLocation(shortName), "", shortName.image.slice(0, -1)));
|
|
11863
12037
|
} }
|
|
11864
12038
|
]),
|
|
11865
|
-
gImpl: ({
|
|
11866
|
-
F2.printFilter(ast, () =>
|
|
12039
|
+
gImpl: ({ PRINT }) => (ast, { astFactory: F2 }) => {
|
|
12040
|
+
F2.printFilter(ast, () => PRINT(ast.prefix, ":", ast.value));
|
|
11867
12041
|
}
|
|
11868
12042
|
};
|
|
11869
12043
|
var canCreateBlankNodes = Symbol("canCreateBlankNodes");
|
|
@@ -11873,11 +12047,11 @@ var blankNode = {
|
|
|
11873
12047
|
const result = OR([
|
|
11874
12048
|
{ ALT: () => {
|
|
11875
12049
|
const labelToken = CONSUME(terminals_exports.blankNodeLabel);
|
|
11876
|
-
return ACTION(() => C.astFactory.
|
|
12050
|
+
return ACTION(() => C.astFactory.termBlank(labelToken.image.slice(2), C.astFactory.sourceLocation(labelToken)));
|
|
11877
12051
|
} },
|
|
11878
12052
|
{ ALT: () => {
|
|
11879
12053
|
const anonToken = CONSUME(terminals_exports.anon);
|
|
11880
|
-
return ACTION(() => C.astFactory.
|
|
12054
|
+
return ACTION(() => C.astFactory.termBlank(void 0, C.astFactory.sourceLocation(anonToken)));
|
|
11881
12055
|
} }
|
|
11882
12056
|
]);
|
|
11883
12057
|
ACTION(() => {
|
|
@@ -11887,15 +12061,15 @@ var blankNode = {
|
|
|
11887
12061
|
});
|
|
11888
12062
|
return result;
|
|
11889
12063
|
},
|
|
11890
|
-
gImpl: ({
|
|
11891
|
-
astFactory.printFilter(ast, () =>
|
|
12064
|
+
gImpl: ({ PRINT }) => (ast, { astFactory }) => {
|
|
12065
|
+
astFactory.printFilter(ast, () => PRINT("_:", ast.label.replace(/^e_/u, "")));
|
|
11892
12066
|
}
|
|
11893
12067
|
};
|
|
11894
12068
|
var verbA = {
|
|
11895
12069
|
name: "VerbA",
|
|
11896
12070
|
impl: ({ ACTION, CONSUME }) => (C) => {
|
|
11897
12071
|
const token = CONSUME(a);
|
|
11898
|
-
return ACTION(() => C.astFactory.
|
|
12072
|
+
return ACTION(() => C.astFactory.termNamed(C.astFactory.sourceLocation(token), CommonIRIs.TYPE, void 0));
|
|
11899
12073
|
}
|
|
11900
12074
|
};
|
|
11901
12075
|
|
|
@@ -11929,10 +12103,10 @@ var baseDecl2 = {
|
|
|
11929
12103
|
const val = SUBRULE(iriFull);
|
|
11930
12104
|
return ACTION(() => C.astFactory.contextDefinitionBase(C.astFactory.sourceLocation(base, val), val));
|
|
11931
12105
|
},
|
|
11932
|
-
gImpl: ({ SUBRULE,
|
|
11933
|
-
F2.printFilter(ast, () =>
|
|
12106
|
+
gImpl: ({ SUBRULE, PRINT_ON_EMPTY, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
12107
|
+
F2.printFilter(ast, () => PRINT_ON_EMPTY("BASE "));
|
|
11934
12108
|
SUBRULE(iri2, ast.value);
|
|
11935
|
-
F2.printFilter(ast, () =>
|
|
12109
|
+
F2.printFilter(ast, () => NEW_LINE());
|
|
11936
12110
|
}
|
|
11937
12111
|
};
|
|
11938
12112
|
var prefixDecl2 = {
|
|
@@ -11943,12 +12117,12 @@ var prefixDecl2 = {
|
|
|
11943
12117
|
const value = SUBRULE(iriFull);
|
|
11944
12118
|
return ACTION(() => C.astFactory.contextDefinitionPrefix(C.astFactory.sourceLocation(prefix, value), name, value));
|
|
11945
12119
|
},
|
|
11946
|
-
gImpl: ({ SUBRULE,
|
|
12120
|
+
gImpl: ({ SUBRULE, PRINT_ON_EMPTY, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
11947
12121
|
F2.printFilter(ast, () => {
|
|
11948
|
-
|
|
12122
|
+
PRINT_ON_EMPTY("PREFIX ", `${ast.key}: `);
|
|
11949
12123
|
});
|
|
11950
12124
|
SUBRULE(iri2, ast.value);
|
|
11951
|
-
F2.printFilter(ast, () =>
|
|
12125
|
+
F2.printFilter(ast, () => NEW_LINE());
|
|
11952
12126
|
}
|
|
11953
12127
|
};
|
|
11954
12128
|
var verb = {
|
|
@@ -11985,10 +12159,10 @@ var var_ = {
|
|
|
11985
12159
|
{ ALT: () => CONSUME(terminals_exports.var1) },
|
|
11986
12160
|
{ ALT: () => CONSUME(terminals_exports.var2) }
|
|
11987
12161
|
]);
|
|
11988
|
-
return ACTION(() => C.astFactory.
|
|
12162
|
+
return ACTION(() => C.astFactory.termVariable(varToken.image.slice(1), C.astFactory.sourceLocation(varToken)));
|
|
11989
12163
|
},
|
|
11990
|
-
gImpl: ({
|
|
11991
|
-
F2.printFilter(ast, () =>
|
|
12164
|
+
gImpl: ({ PRINT }) => (ast, { astFactory: F2 }) => {
|
|
12165
|
+
F2.printFilter(ast, () => PRINT(`?${ast.value}`));
|
|
11992
12166
|
}
|
|
11993
12167
|
};
|
|
11994
12168
|
var graphTerm = {
|
|
@@ -12001,7 +12175,7 @@ var graphTerm = {
|
|
|
12001
12175
|
{ GATE: () => C.parseMode.has("canCreateBlankNodes"), ALT: () => SUBRULE(blankNode) },
|
|
12002
12176
|
{ ALT: () => {
|
|
12003
12177
|
const tokenNil = CONSUME(terminals_exports.nil);
|
|
12004
|
-
return ACTION(() => C.astFactory.
|
|
12178
|
+
return ACTION(() => C.astFactory.termNamed(C.astFactory.sourceLocation(tokenNil), CommonIRIs.NIL));
|
|
12005
12179
|
} }
|
|
12006
12180
|
]),
|
|
12007
12181
|
gImpl: ({ SUBRULE }) => (ast, { astFactory: F2 }) => {
|
|
@@ -12631,13 +12805,16 @@ function triplesDotSeperated(triplesSameSubjectSubrule) {
|
|
|
12631
12805
|
var triplesBlock = {
|
|
12632
12806
|
name: "triplesBlock",
|
|
12633
12807
|
impl: (implArgs) => (C) => triplesDotSeperated(triplesSameSubjectPath)(implArgs)(C),
|
|
12634
|
-
gImpl: ({ SUBRULE, PRINT_WORD, HANDLE_LOC }) => (ast, { astFactory: F2 }) => {
|
|
12808
|
+
gImpl: ({ SUBRULE, PRINT_WORD, HANDLE_LOC, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
12635
12809
|
for (const [index, triple] of ast.triples.entries()) {
|
|
12636
12810
|
HANDLE_LOC(triple, () => {
|
|
12637
12811
|
const nextTriple = ast.triples.at(index);
|
|
12638
12812
|
if (F2.isTripleCollection(triple)) {
|
|
12639
12813
|
SUBRULE(graphNodePath, triple);
|
|
12640
|
-
F2.printFilter(triple, () =>
|
|
12814
|
+
F2.printFilter(triple, () => {
|
|
12815
|
+
PRINT_WORD(".");
|
|
12816
|
+
NEW_LINE();
|
|
12817
|
+
});
|
|
12641
12818
|
} else {
|
|
12642
12819
|
SUBRULE(graphNodePath, triple.subject);
|
|
12643
12820
|
F2.printFilter(triple, () => PRINT_WORD(""));
|
|
@@ -12649,11 +12826,17 @@ var triplesBlock = {
|
|
|
12649
12826
|
F2.printFilter(triple, () => PRINT_WORD(""));
|
|
12650
12827
|
SUBRULE(graphNodePath, triple.object);
|
|
12651
12828
|
if (nextTriple === void 0 || F2.isTripleCollection(nextTriple) || !F2.isSourceLocationNoMaterialize(nextTriple.subject.loc)) {
|
|
12652
|
-
F2.printFilter(ast, () =>
|
|
12829
|
+
F2.printFilter(ast, () => {
|
|
12830
|
+
PRINT_WORD(".");
|
|
12831
|
+
NEW_LINE();
|
|
12832
|
+
});
|
|
12653
12833
|
} else if (F2.isSourceLocationNoMaterialize(nextTriple.predicate.loc)) {
|
|
12654
12834
|
F2.printFilter(ast, () => PRINT_WORD(","));
|
|
12655
12835
|
} else {
|
|
12656
|
-
F2.printFilter(ast, () =>
|
|
12836
|
+
F2.printFilter(ast, () => {
|
|
12837
|
+
PRINT_WORD(";");
|
|
12838
|
+
NEW_LINE();
|
|
12839
|
+
});
|
|
12657
12840
|
}
|
|
12658
12841
|
}
|
|
12659
12842
|
});
|
|
@@ -12786,10 +12969,10 @@ function collectionImpl(name, allowPaths) {
|
|
|
12786
12969
|
return ACTION(() => {
|
|
12787
12970
|
const F2 = C.astFactory;
|
|
12788
12971
|
const triples = [];
|
|
12789
|
-
const predFirst = F2.
|
|
12790
|
-
const predRest = F2.
|
|
12791
|
-
const predNil = F2.
|
|
12792
|
-
const listHead = F2.
|
|
12972
|
+
const predFirst = F2.termNamed(F2.sourceLocationNoMaterialize(), CommonIRIs.FIRST, void 0);
|
|
12973
|
+
const predRest = F2.termNamed(F2.sourceLocationNoMaterialize(), CommonIRIs.REST, void 0);
|
|
12974
|
+
const predNil = F2.termNamed(F2.sourceLocationNoMaterialize(), CommonIRIs.NIL, void 0);
|
|
12975
|
+
const listHead = F2.termBlank(void 0, F2.sourceLocationNoMaterialize());
|
|
12793
12976
|
let iterHead = listHead;
|
|
12794
12977
|
for (const [index, term] of terms.entries()) {
|
|
12795
12978
|
const lastInList = index === terms.length - 1;
|
|
@@ -12799,7 +12982,7 @@ function collectionImpl(name, allowPaths) {
|
|
|
12799
12982
|
const nilTriple = F2.triple(iterHead, predRest, predNil);
|
|
12800
12983
|
triples.push(nilTriple);
|
|
12801
12984
|
} else {
|
|
12802
|
-
const tail = F2.
|
|
12985
|
+
const tail = F2.termBlank(void 0, F2.sourceLocationNoMaterialize());
|
|
12803
12986
|
const linkTriple = F2.triple(iterHead, predRest, tail);
|
|
12804
12987
|
triples.push(linkTriple);
|
|
12805
12988
|
iterHead = tail;
|
|
@@ -12839,16 +13022,17 @@ function blankNodePropertyListImpl(name, allowPaths) {
|
|
|
12839
13022
|
name,
|
|
12840
13023
|
impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
|
|
12841
13024
|
const startToken = CONSUME(symbols_exports.LSquare);
|
|
12842
|
-
const blankNode2 = ACTION(() => C.astFactory.
|
|
13025
|
+
const blankNode2 = ACTION(() => C.astFactory.termBlank(void 0, C.astFactory.sourceLocationNoMaterialize()));
|
|
12843
13026
|
const propList = SUBRULE(propertyPathNotEmptyImpl, blankNode2);
|
|
12844
13027
|
const endToken = CONSUME(symbols_exports.RSquare);
|
|
12845
13028
|
return ACTION(() => C.astFactory.tripleCollectionBlankNodeProperties(blankNode2, propList, C.astFactory.sourceLocation(startToken, endToken)));
|
|
12846
13029
|
},
|
|
12847
|
-
gImpl: ({ SUBRULE, PRINT, PRINT_WORD, HANDLE_LOC, PRINT_ON_EMPTY }) => (ast, c) => {
|
|
13030
|
+
gImpl: ({ SUBRULE, PRINT, PRINT_WORD, HANDLE_LOC, PRINT_ON_EMPTY, NEW_LINE }) => (ast, c) => {
|
|
12848
13031
|
const { astFactory: F2, indentInc } = c;
|
|
12849
13032
|
F2.printFilter(ast, () => {
|
|
12850
13033
|
c[traqulaIndentation] += indentInc;
|
|
12851
|
-
PRINT("[
|
|
13034
|
+
PRINT("[");
|
|
13035
|
+
NEW_LINE();
|
|
12852
13036
|
});
|
|
12853
13037
|
for (const triple of ast.triples) {
|
|
12854
13038
|
HANDLE_LOC(triple, () => {
|
|
@@ -12859,7 +13043,10 @@ function blankNodePropertyListImpl(name, allowPaths) {
|
|
|
12859
13043
|
}
|
|
12860
13044
|
F2.printFilter(triple, () => PRINT_WORD(""));
|
|
12861
13045
|
SUBRULE(graphNodePath, triple.object);
|
|
12862
|
-
F2.printFilter(ast, () =>
|
|
13046
|
+
F2.printFilter(ast, () => {
|
|
13047
|
+
PRINT_WORD(";");
|
|
13048
|
+
NEW_LINE();
|
|
13049
|
+
});
|
|
12863
13050
|
});
|
|
12864
13051
|
}
|
|
12865
13052
|
F2.printFilter(ast, () => {
|
|
@@ -12918,18 +13105,19 @@ var groupGraphPattern = {
|
|
|
12918
13105
|
const close = CONSUME(symbols_exports.RCurly);
|
|
12919
13106
|
return ACTION(() => C.astFactory.patternGroup(patterns, C.astFactory.sourceLocation(open, close)));
|
|
12920
13107
|
},
|
|
12921
|
-
gImpl: ({ SUBRULE, PRINT_WORD,
|
|
13108
|
+
gImpl: ({ SUBRULE, PRINT_WORD, NEW_LINE, PRINT_ON_OWN_LINE }) => (ast, C) => {
|
|
12922
13109
|
const { astFactory: F2, indentInc } = C;
|
|
12923
13110
|
F2.printFilter(ast, () => {
|
|
12924
13111
|
C[traqulaIndentation] += indentInc;
|
|
12925
|
-
PRINT_WORD("{
|
|
13112
|
+
PRINT_WORD("{");
|
|
13113
|
+
NEW_LINE();
|
|
12926
13114
|
});
|
|
12927
13115
|
for (const pattern of ast.patterns) {
|
|
12928
13116
|
SUBRULE(generatePattern, pattern);
|
|
12929
13117
|
}
|
|
12930
13118
|
F2.printFilter(ast, () => {
|
|
12931
13119
|
C[traqulaIndentation] -= indentInc;
|
|
12932
|
-
|
|
13120
|
+
PRINT_ON_OWN_LINE("}");
|
|
12933
13121
|
});
|
|
12934
13122
|
}
|
|
12935
13123
|
};
|
|
@@ -13079,12 +13267,15 @@ var bind2 = {
|
|
|
13079
13267
|
const close = CONSUME(symbols_exports.RParen);
|
|
13080
13268
|
return ACTION(() => C.astFactory.patternBind(expressionVal, variable, C.astFactory.sourceLocation(bind3, close)));
|
|
13081
13269
|
},
|
|
13082
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
13270
|
+
gImpl: ({ SUBRULE, PRINT_WORD, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
13083
13271
|
F2.printFilter(ast, () => PRINT_WORD("BIND", "("));
|
|
13084
13272
|
SUBRULE(expression, ast.expression);
|
|
13085
13273
|
F2.printFilter(ast, () => PRINT_WORD("AS"));
|
|
13086
13274
|
SUBRULE(var_, ast.variable);
|
|
13087
|
-
F2.printFilter(ast, () =>
|
|
13275
|
+
F2.printFilter(ast, () => {
|
|
13276
|
+
PRINT_WORD(")");
|
|
13277
|
+
NEW_LINE();
|
|
13278
|
+
});
|
|
13088
13279
|
}
|
|
13089
13280
|
};
|
|
13090
13281
|
var inlineData = {
|
|
@@ -13092,34 +13283,46 @@ var inlineData = {
|
|
|
13092
13283
|
impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
|
|
13093
13284
|
const values3 = CONSUME(values2);
|
|
13094
13285
|
const datablock = SUBRULE(dataBlock);
|
|
13095
|
-
return ACTION(() =>
|
|
13286
|
+
return ACTION(() => {
|
|
13287
|
+
datablock.loc = C.astFactory.sourceLocation(values3, datablock);
|
|
13288
|
+
return datablock;
|
|
13289
|
+
});
|
|
13096
13290
|
},
|
|
13097
|
-
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, C) => {
|
|
13291
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY, NEW_LINE, PRINT_ON_OWN_LINE }) => (ast, C) => {
|
|
13098
13292
|
const { astFactory: F2, indentInc } = C;
|
|
13099
|
-
const variables =
|
|
13293
|
+
const variables = ast.variables;
|
|
13294
|
+
const singleVar = variables.length === 1;
|
|
13295
|
+
F2.printFilter(ast, () => {
|
|
13296
|
+
PRINT_ON_EMPTY("VALUES", singleVar ? "" : "( ");
|
|
13297
|
+
});
|
|
13298
|
+
for (const variable of variables) {
|
|
13299
|
+
F2.printFilter(ast, () => PRINT_WORD(""));
|
|
13300
|
+
SUBRULE(varOrTerm, variable);
|
|
13301
|
+
F2.printFilter(ast, () => PRINT_WORD(""));
|
|
13302
|
+
}
|
|
13100
13303
|
F2.printFilter(ast, () => {
|
|
13101
|
-
PRINT_ON_EMPTY("");
|
|
13102
|
-
PRINT_WORD("VALUES", "(");
|
|
13103
|
-
for (const variable of variables) {
|
|
13104
|
-
PRINT_WORD(`?${variable}`);
|
|
13105
|
-
}
|
|
13106
13304
|
C[traqulaIndentation] += indentInc;
|
|
13107
|
-
PRINT_WORD(")", "{
|
|
13305
|
+
PRINT_WORD(singleVar ? "" : ")", "{");
|
|
13306
|
+
NEW_LINE();
|
|
13108
13307
|
});
|
|
13109
13308
|
for (const mapping of ast.values) {
|
|
13110
|
-
F2.printFilter(ast, () => PRINT_WORD("("));
|
|
13309
|
+
F2.printFilter(ast, () => !singleVar && PRINT_WORD("("));
|
|
13111
13310
|
for (const variable of variables) {
|
|
13112
|
-
|
|
13311
|
+
const var_2 = variable.value;
|
|
13312
|
+
if (mapping[var_2] === void 0) {
|
|
13113
13313
|
F2.printFilter(ast, () => PRINT_WORD("UNDEF"));
|
|
13114
13314
|
} else {
|
|
13115
|
-
SUBRULE(graphNodePath, mapping[
|
|
13315
|
+
SUBRULE(graphNodePath, mapping[var_2]);
|
|
13116
13316
|
}
|
|
13117
13317
|
}
|
|
13118
|
-
F2.printFilter(ast, () =>
|
|
13318
|
+
F2.printFilter(ast, () => {
|
|
13319
|
+
PRINT_WORD(singleVar ? "" : ")");
|
|
13320
|
+
NEW_LINE();
|
|
13321
|
+
});
|
|
13119
13322
|
}
|
|
13120
13323
|
F2.printFilter(ast, () => {
|
|
13121
13324
|
C[traqulaIndentation] -= indentInc;
|
|
13122
|
-
|
|
13325
|
+
PRINT_ON_OWN_LINE("}");
|
|
13123
13326
|
});
|
|
13124
13327
|
}
|
|
13125
13328
|
};
|
|
@@ -13143,7 +13346,7 @@ var inlineDataOneVar = {
|
|
|
13143
13346
|
});
|
|
13144
13347
|
});
|
|
13145
13348
|
const close = CONSUME(symbols_exports.RCurly);
|
|
13146
|
-
return ACTION(() => C.astFactory.
|
|
13349
|
+
return ACTION(() => C.astFactory.patternValues([varVal], res, C.astFactory.sourceLocation(varVal, close)));
|
|
13147
13350
|
}
|
|
13148
13351
|
};
|
|
13149
13352
|
var inlineDataFull = {
|
|
@@ -13160,7 +13363,7 @@ var inlineDataFull = {
|
|
|
13160
13363
|
res.push({});
|
|
13161
13364
|
});
|
|
13162
13365
|
const close = CONSUME1(symbols_exports.RCurly);
|
|
13163
|
-
return ACTION(() => C.astFactory.
|
|
13366
|
+
return ACTION(() => C.astFactory.patternValues(vars, res, C.astFactory.sourceLocation(nil2, close)));
|
|
13164
13367
|
} },
|
|
13165
13368
|
{ ALT: () => {
|
|
13166
13369
|
const open = CONSUME1(symbols_exports.LParen);
|
|
@@ -13192,7 +13395,7 @@ var inlineDataFull = {
|
|
|
13192
13395
|
});
|
|
13193
13396
|
});
|
|
13194
13397
|
const close = CONSUME2(symbols_exports.RCurly);
|
|
13195
|
-
return ACTION(() => C.astFactory.
|
|
13398
|
+
return ACTION(() => C.astFactory.patternValues(vars, res, C.astFactory.sourceLocation(open, close)));
|
|
13196
13399
|
} }
|
|
13197
13400
|
]);
|
|
13198
13401
|
}
|
|
@@ -13255,10 +13458,13 @@ var filter3 = {
|
|
|
13255
13458
|
const expression2 = SUBRULE(constraint);
|
|
13256
13459
|
return ACTION(() => C.astFactory.patternFilter(expression2, C.astFactory.sourceLocation(filterToken, expression2)));
|
|
13257
13460
|
},
|
|
13258
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
13461
|
+
gImpl: ({ SUBRULE, PRINT_WORD, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
13259
13462
|
F2.printFilter(ast, () => PRINT_WORD("FILTER ("));
|
|
13260
13463
|
SUBRULE(expression, ast.expression);
|
|
13261
|
-
F2.printFilter(ast, () =>
|
|
13464
|
+
F2.printFilter(ast, () => {
|
|
13465
|
+
PRINT_WORD(")");
|
|
13466
|
+
NEW_LINE();
|
|
13467
|
+
});
|
|
13262
13468
|
}
|
|
13263
13469
|
};
|
|
13264
13470
|
var constraint = {
|
|
@@ -13644,8 +13850,7 @@ var groupClause = {
|
|
|
13644
13850
|
},
|
|
13645
13851
|
gImpl: ({ PRINT_WORDS, SUBRULE, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
13646
13852
|
F2.printFilter(ast, () => {
|
|
13647
|
-
PRINT_ON_EMPTY("");
|
|
13648
|
-
PRINT_WORDS("GROUP", "BY");
|
|
13853
|
+
PRINT_ON_EMPTY("GROUP BY ");
|
|
13649
13854
|
});
|
|
13650
13855
|
for (const grouping of ast.groupings) {
|
|
13651
13856
|
if (F2.isExpression(grouping)) {
|
|
@@ -13701,10 +13906,9 @@ var havingClause = {
|
|
|
13701
13906
|
ACTION(() => !couldParseAgg && C.parseMode.delete("canParseAggregate"));
|
|
13702
13907
|
return ACTION(() => C.astFactory.solutionModifierHaving(expressions, C.astFactory.sourceLocation(having2, expressions.at(-1))));
|
|
13703
13908
|
},
|
|
13704
|
-
gImpl: ({
|
|
13909
|
+
gImpl: ({ PRINT_ON_EMPTY, SUBRULE }) => (ast, { astFactory: F2 }) => {
|
|
13705
13910
|
F2.printFilter(ast, () => {
|
|
13706
|
-
PRINT_ON_EMPTY("");
|
|
13707
|
-
PRINT_WORD("HAVING");
|
|
13911
|
+
PRINT_ON_EMPTY("HAVING ");
|
|
13708
13912
|
});
|
|
13709
13913
|
for (const having2 of ast.having) {
|
|
13710
13914
|
SUBRULE(expression, having2);
|
|
@@ -13730,8 +13934,7 @@ var orderClause = {
|
|
|
13730
13934
|
},
|
|
13731
13935
|
gImpl: ({ PRINT_WORDS, PRINT_ON_EMPTY, SUBRULE }) => (ast, { astFactory: F2 }) => {
|
|
13732
13936
|
F2.printFilter(ast, () => {
|
|
13733
|
-
PRINT_ON_EMPTY("");
|
|
13734
|
-
PRINT_WORDS("ORDER", "BY");
|
|
13937
|
+
PRINT_ON_EMPTY("ORDER BY ");
|
|
13735
13938
|
});
|
|
13736
13939
|
for (const ordering of ast.orderDefs) {
|
|
13737
13940
|
if (ordering.descending) {
|
|
@@ -13790,9 +13993,9 @@ var limitOffsetClauses = {
|
|
|
13790
13993
|
return ACTION(() => C.astFactory.solutionModifierLimitOffset(limit2?.val, offset2.val, C.astFactory.sourceLocation(offset2, limit2)));
|
|
13791
13994
|
} }
|
|
13792
13995
|
]),
|
|
13793
|
-
gImpl: ({ PRINT_WORDS,
|
|
13996
|
+
gImpl: ({ PRINT_WORDS, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
13794
13997
|
F2.printFilter(ast, () => {
|
|
13795
|
-
|
|
13998
|
+
NEW_LINE();
|
|
13796
13999
|
if (ast.limit) {
|
|
13797
14000
|
PRINT_WORDS("LIMIT", String(ast.limit));
|
|
13798
14001
|
}
|
|
@@ -13977,9 +14180,9 @@ var selectClause = {
|
|
|
13977
14180
|
ACTION(() => !couldParseAgg && C.parseMode.delete("canParseAggregate"));
|
|
13978
14181
|
return ACTION(() => C.astFactory.wrap(val, C.astFactory.sourceLocation(select2, last2)));
|
|
13979
14182
|
},
|
|
13980
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
14183
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
13981
14184
|
F2.printFilter(ast, () => {
|
|
13982
|
-
|
|
14185
|
+
PRINT_ON_EMPTY("SELECT ");
|
|
13983
14186
|
if (ast.val.distinct) {
|
|
13984
14187
|
PRINT_WORD("DISTINCT");
|
|
13985
14188
|
} else if (ast.val.reduced) {
|
|
@@ -13998,7 +14201,9 @@ var selectClause = {
|
|
|
13998
14201
|
SUBRULE(var_, variable.variable);
|
|
13999
14202
|
F2.printFilter(ast, () => PRINT_WORD(")"));
|
|
14000
14203
|
}
|
|
14204
|
+
F2.printFilter(ast, () => PRINT_WORD(""));
|
|
14001
14205
|
}
|
|
14206
|
+
F2.printFilter(ast, () => PRINT_WORD(""));
|
|
14002
14207
|
}
|
|
14003
14208
|
};
|
|
14004
14209
|
var constructQuery = {
|
|
@@ -14036,18 +14241,19 @@ var constructQuery = {
|
|
|
14036
14241
|
} }
|
|
14037
14242
|
]);
|
|
14038
14243
|
},
|
|
14039
|
-
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, C) => {
|
|
14244
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY, PRINT_ON_OWN_LINE, NEW_LINE }) => (ast, C) => {
|
|
14040
14245
|
const { astFactory: F2, indentInc } = C;
|
|
14041
|
-
F2.printFilter(ast, () =>
|
|
14246
|
+
F2.printFilter(ast, () => PRINT_ON_EMPTY("CONSTRUCT "));
|
|
14042
14247
|
if (!F2.isSourceLocationNoMaterialize(ast.where.loc)) {
|
|
14043
14248
|
F2.printFilter(ast, () => {
|
|
14044
14249
|
C[traqulaIndentation] += indentInc;
|
|
14045
|
-
PRINT_WORD("{
|
|
14250
|
+
PRINT_WORD("{");
|
|
14251
|
+
NEW_LINE();
|
|
14046
14252
|
});
|
|
14047
14253
|
SUBRULE(triplesBlock, ast.template);
|
|
14048
14254
|
F2.printFilter(ast, () => {
|
|
14049
14255
|
C[traqulaIndentation] -= indentInc;
|
|
14050
|
-
|
|
14256
|
+
PRINT_ON_OWN_LINE("}");
|
|
14051
14257
|
});
|
|
14052
14258
|
}
|
|
14053
14259
|
SUBRULE(datasetClauseStar, ast.datasets);
|
|
@@ -14088,8 +14294,8 @@ var describeQuery = {
|
|
|
14088
14294
|
loc: C.astFactory.sourceLocation(describe2, ...variables, from2, where2, modifiers.group, modifiers.having, modifiers.order, modifiers.limitOffset)
|
|
14089
14295
|
}));
|
|
14090
14296
|
},
|
|
14091
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
14092
|
-
F2.printFilter(ast, () =>
|
|
14297
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
14298
|
+
F2.printFilter(ast, () => PRINT_ON_EMPTY("DESCRIBE "));
|
|
14093
14299
|
if (F2.isWildcard(ast.variables[0])) {
|
|
14094
14300
|
F2.printFilter(ast, () => PRINT_WORD("*"));
|
|
14095
14301
|
} else {
|
|
@@ -14119,8 +14325,8 @@ var askQuery = {
|
|
|
14119
14325
|
loc: C.astFactory.sourceLocation(ask2, from2, where2, modifiers.group, modifiers.having, modifiers.order, modifiers.limitOffset)
|
|
14120
14326
|
}));
|
|
14121
14327
|
},
|
|
14122
|
-
gImpl: ({ SUBRULE,
|
|
14123
|
-
F2.printFilter(ast, () =>
|
|
14328
|
+
gImpl: ({ SUBRULE, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
14329
|
+
F2.printFilter(ast, () => PRINT_ON_EMPTY("ASK "));
|
|
14124
14330
|
SUBRULE(datasetClauseStar, ast.datasets);
|
|
14125
14331
|
SUBRULE(whereClause, F2.wrap(ast.where, ast.loc));
|
|
14126
14332
|
SUBRULE(solutionModifier, ast.solutionModifiers);
|
|
@@ -14179,7 +14385,7 @@ var update = {
|
|
|
14179
14385
|
return update2;
|
|
14180
14386
|
});
|
|
14181
14387
|
},
|
|
14182
|
-
gImpl: ({ SUBRULE,
|
|
14388
|
+
gImpl: ({ SUBRULE, PRINT, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
14183
14389
|
const [head2, ...tail] = ast.updates;
|
|
14184
14390
|
if (head2) {
|
|
14185
14391
|
SUBRULE(prologue, head2.context);
|
|
@@ -14188,7 +14394,10 @@ var update = {
|
|
|
14188
14394
|
}
|
|
14189
14395
|
}
|
|
14190
14396
|
for (const update2 of tail) {
|
|
14191
|
-
F2.printFilter(ast, () =>
|
|
14397
|
+
F2.printFilter(ast, () => {
|
|
14398
|
+
PRINT(";");
|
|
14399
|
+
NEW_LINE();
|
|
14400
|
+
});
|
|
14192
14401
|
SUBRULE(prologue, update2.context);
|
|
14193
14402
|
if (update2.operation) {
|
|
14194
14403
|
SUBRULE(update1, update2.operation);
|
|
@@ -14261,9 +14470,9 @@ var load2 = {
|
|
|
14261
14470
|
});
|
|
14262
14471
|
return ACTION(() => C.astFactory.updateOperationLoad(C.astFactory.sourceLocation(loadToken, source, destination), source, Boolean(silent2), destination));
|
|
14263
14472
|
},
|
|
14264
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
14473
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
14265
14474
|
F2.printFilter(ast, () => {
|
|
14266
|
-
|
|
14475
|
+
PRINT_ON_EMPTY("LOAD ");
|
|
14267
14476
|
if (ast.silent) {
|
|
14268
14477
|
PRINT_WORD("SILENT");
|
|
14269
14478
|
}
|
|
@@ -14284,9 +14493,9 @@ function clearOrDrop(operation) {
|
|
|
14284
14493
|
const destination = SUBRULE1(graphRefAll);
|
|
14285
14494
|
return ACTION(() => C.astFactory.updateOperationClearDrop(unCapitalize(operation.name), Boolean(silent2), destination, C.astFactory.sourceLocation(opToken, destination)));
|
|
14286
14495
|
},
|
|
14287
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
14496
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
14288
14497
|
F2.printFilter(ast, () => {
|
|
14289
|
-
|
|
14498
|
+
PRINT_ON_EMPTY(operation.name.toUpperCase(), " ");
|
|
14290
14499
|
if (ast.silent) {
|
|
14291
14500
|
PRINT_WORD("SILENT");
|
|
14292
14501
|
}
|
|
@@ -14305,9 +14514,9 @@ var create2 = {
|
|
|
14305
14514
|
const destination = SUBRULE1(graphRef);
|
|
14306
14515
|
return ACTION(() => C.astFactory.updateOperationCreate(destination, Boolean(silent2), C.astFactory.sourceLocation(createToken3, destination)));
|
|
14307
14516
|
},
|
|
14308
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
14517
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
14309
14518
|
F2.printFilter(ast, () => {
|
|
14310
|
-
|
|
14519
|
+
PRINT_ON_EMPTY("CREATE ");
|
|
14311
14520
|
if (ast.silent) {
|
|
14312
14521
|
PRINT_WORD("SILENT");
|
|
14313
14522
|
}
|
|
@@ -14326,9 +14535,9 @@ function copyMoveAddOperation(operation) {
|
|
|
14326
14535
|
const destination = SUBRULE2(graphOrDefault);
|
|
14327
14536
|
return ACTION(() => C.astFactory.updateOperationAddMoveCopy(unCapitalize(operation.name), source, destination, Boolean(silent2), C.astFactory.sourceLocation(op, destination)));
|
|
14328
14537
|
},
|
|
14329
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
14538
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
14330
14539
|
F2.printFilter(ast, () => {
|
|
14331
|
-
|
|
14540
|
+
PRINT_ON_EMPTY(operation.name.toUpperCase(), " ");
|
|
14332
14541
|
if (ast.silent) {
|
|
14333
14542
|
PRINT_WORD("SILENT");
|
|
14334
14543
|
}
|
|
@@ -14377,23 +14586,24 @@ function insertDeleteDelWhere(name, subType, cons1, dataRule) {
|
|
|
14377
14586
|
}
|
|
14378
14587
|
return ACTION(() => C.astFactory.updateOperationInsDelDataWhere(subType, data.val, C.astFactory.sourceLocation(insDelToken, data)));
|
|
14379
14588
|
},
|
|
14380
|
-
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, C) => {
|
|
14589
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY, PRINT_ON_OWN_LINE, NEW_LINE }) => (ast, C) => {
|
|
14381
14590
|
const { astFactory: F2, indentInc } = C;
|
|
14382
14591
|
F2.printFilter(ast, () => {
|
|
14383
|
-
C[traqulaIndentation] += indentInc;
|
|
14384
14592
|
if (subType === "insertdata") {
|
|
14385
|
-
|
|
14593
|
+
PRINT_ON_EMPTY("INSERT DATA ");
|
|
14386
14594
|
} else if (subType === "deletedata") {
|
|
14387
|
-
|
|
14595
|
+
PRINT_ON_EMPTY("DELETE DATA ");
|
|
14388
14596
|
} else if (subType === "deletewhere") {
|
|
14389
|
-
|
|
14597
|
+
PRINT_ON_EMPTY("DELETE WHERE ");
|
|
14390
14598
|
}
|
|
14391
|
-
|
|
14599
|
+
C[traqulaIndentation] += indentInc;
|
|
14600
|
+
PRINT_WORD("{");
|
|
14601
|
+
NEW_LINE();
|
|
14392
14602
|
});
|
|
14393
14603
|
SUBRULE(quads, F2.wrap(ast.data, ast.loc));
|
|
14394
14604
|
F2.printFilter(ast, () => {
|
|
14395
14605
|
C[traqulaIndentation] -= indentInc;
|
|
14396
|
-
|
|
14606
|
+
PRINT_ON_OWN_LINE("}");
|
|
14397
14607
|
});
|
|
14398
14608
|
}
|
|
14399
14609
|
};
|
|
@@ -14425,36 +14635,40 @@ var modify = {
|
|
|
14425
14635
|
const where2 = SUBRULE1(groupGraphPattern);
|
|
14426
14636
|
return ACTION(() => C.astFactory.updateOperationModify(C.astFactory.sourceLocation(graph2?.withToken, del, insert, where2), insert?.val ?? [], del?.val ?? [], where2, using, graph2?.graph));
|
|
14427
14637
|
},
|
|
14428
|
-
gImpl: ({ SUBRULE,
|
|
14638
|
+
gImpl: ({ SUBRULE, PRINT_WORDS, PRINT_ON_EMPTY, NEW_LINE }) => (ast, C) => {
|
|
14429
14639
|
const { astFactory: F2, indentInc } = C;
|
|
14430
14640
|
if (ast.graph) {
|
|
14431
|
-
F2.printFilter(ast, () =>
|
|
14641
|
+
F2.printFilter(ast, () => PRINT_WORDS("WITH"));
|
|
14432
14642
|
SUBRULE(iri2, ast.graph);
|
|
14433
14643
|
}
|
|
14434
14644
|
if (ast.delete.length > 0) {
|
|
14435
14645
|
F2.printFilter(ast, () => {
|
|
14436
14646
|
C[traqulaIndentation] += indentInc;
|
|
14437
|
-
|
|
14647
|
+
PRINT_WORDS("DELETE", "{");
|
|
14648
|
+
NEW_LINE();
|
|
14438
14649
|
});
|
|
14439
14650
|
SUBRULE(quads, F2.wrap(ast.delete, ast.loc));
|
|
14440
14651
|
F2.printFilter(ast, () => {
|
|
14441
14652
|
C[traqulaIndentation] -= indentInc;
|
|
14442
|
-
PRINT_ON_EMPTY("}
|
|
14653
|
+
PRINT_ON_EMPTY("}");
|
|
14654
|
+
NEW_LINE();
|
|
14443
14655
|
});
|
|
14444
14656
|
}
|
|
14445
14657
|
if (ast.insert.length > 0) {
|
|
14446
14658
|
F2.printFilter(ast, () => {
|
|
14447
14659
|
C[traqulaIndentation] += indentInc;
|
|
14448
|
-
|
|
14660
|
+
PRINT_WORDS("INSERT", "{");
|
|
14661
|
+
NEW_LINE();
|
|
14449
14662
|
});
|
|
14450
14663
|
SUBRULE(quads, F2.wrap(ast.insert, ast.loc));
|
|
14451
14664
|
F2.printFilter(ast, () => {
|
|
14452
14665
|
C[traqulaIndentation] -= indentInc;
|
|
14453
|
-
PRINT_ON_EMPTY("}
|
|
14666
|
+
PRINT_ON_EMPTY("} ");
|
|
14667
|
+
NEW_LINE();
|
|
14454
14668
|
});
|
|
14455
14669
|
}
|
|
14456
14670
|
SUBRULE(usingClauseStar, ast.from);
|
|
14457
|
-
F2.printFilter(ast, () =>
|
|
14671
|
+
F2.printFilter(ast, () => PRINT_WORDS("WHERE"));
|
|
14458
14672
|
SUBRULE(groupGraphPattern, ast.where);
|
|
14459
14673
|
}
|
|
14460
14674
|
};
|
|
@@ -14578,18 +14792,19 @@ var quadsNotTriples = {
|
|
|
14578
14792
|
const close = CONSUME(symbols_exports.RCurly);
|
|
14579
14793
|
return ACTION(() => C.astFactory.graphQuads(name, triples ?? C.astFactory.patternBgp([], C.astFactory.sourceLocationNoMaterialize()), C.astFactory.sourceLocation(graph2, close)));
|
|
14580
14794
|
},
|
|
14581
|
-
gImpl: ({ SUBRULE, PRINT_WORD,
|
|
14795
|
+
gImpl: ({ SUBRULE, PRINT_WORD, NEW_LINE, PRINT_ON_OWN_LINE }) => (ast, C) => {
|
|
14582
14796
|
const { astFactory: F2, indentInc } = C;
|
|
14583
14797
|
F2.printFilter(ast, () => PRINT_WORD("GRAPH"));
|
|
14584
14798
|
SUBRULE(varOrTerm, ast.graph);
|
|
14585
14799
|
F2.printFilter(ast, () => {
|
|
14586
14800
|
C[traqulaIndentation] += indentInc;
|
|
14587
|
-
PRINT_WORD("{
|
|
14801
|
+
PRINT_WORD("{");
|
|
14802
|
+
NEW_LINE();
|
|
14588
14803
|
});
|
|
14589
14804
|
SUBRULE(triplesBlock, ast.triples);
|
|
14590
14805
|
F2.printFilter(ast, () => {
|
|
14591
14806
|
C[traqulaIndentation] -= indentInc;
|
|
14592
|
-
|
|
14807
|
+
PRINT_ON_OWN_LINE("}");
|
|
14593
14808
|
});
|
|
14594
14809
|
}
|
|
14595
14810
|
};
|