@traqula/rules-sparql-1-1-adjust 0.0.19 → 0.0.21
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 +411 -191
- package/package.json +4 -4
package/lib/index.cjs
CHANGED
|
@@ -339,7 +339,7 @@ var AstCoreFactory = class {
|
|
|
339
339
|
if (filtered.length === 0) {
|
|
340
340
|
return this.gen();
|
|
341
341
|
}
|
|
342
|
-
const first2 = filtered
|
|
342
|
+
const first2 = filtered.at(0);
|
|
343
343
|
const last2 = filtered.at(-1);
|
|
344
344
|
return {
|
|
345
345
|
sourceLocationType: "source",
|
|
@@ -9766,21 +9766,34 @@ var LexerBuilder = class _LexerBuilder {
|
|
|
9766
9766
|
}
|
|
9767
9767
|
};
|
|
9768
9768
|
|
|
9769
|
-
// ../core/lib/
|
|
9770
|
-
var
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
|
|
9769
|
+
// ../core/lib/TransformerObject.js
|
|
9770
|
+
var TransformerObject = class _TransformerObject {
|
|
9771
|
+
defaultContext;
|
|
9772
|
+
maxStackSize = 1e6;
|
|
9773
|
+
/**
|
|
9774
|
+
* Creates stateless transformer.
|
|
9775
|
+
* @param defaultContext
|
|
9776
|
+
*/
|
|
9777
|
+
constructor(defaultContext = {}) {
|
|
9778
|
+
this.defaultContext = defaultContext;
|
|
9775
9779
|
}
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
|
|
9780
|
+
clone(newDefaultContext = {}) {
|
|
9781
|
+
return new _TransformerObject({ ...this.defaultContext, ...newDefaultContext });
|
|
9782
|
+
}
|
|
9783
|
+
/**
|
|
9784
|
+
* Function to shallow clone any type.
|
|
9785
|
+
* @param obj
|
|
9786
|
+
* @protected
|
|
9787
|
+
*/
|
|
9788
|
+
cloneObj(obj) {
|
|
9789
|
+
if (obj === null || typeof obj !== "object") {
|
|
9790
|
+
return obj;
|
|
9782
9791
|
}
|
|
9783
|
-
|
|
9792
|
+
const proto = Object.getPrototypeOf(obj);
|
|
9793
|
+
if (proto === Object.prototype || proto === null) {
|
|
9794
|
+
return { ...obj };
|
|
9795
|
+
}
|
|
9796
|
+
return Object.assign(Object.create(proto), obj);
|
|
9784
9797
|
}
|
|
9785
9798
|
/**
|
|
9786
9799
|
* Recursively transforms all objects that are not arrays. Mapper is called on deeper objects first.
|
|
@@ -9792,90 +9805,231 @@ var TransformerType = class {
|
|
|
9792
9805
|
* - Default false
|
|
9793
9806
|
*/
|
|
9794
9807
|
transformObject(startObject, mapper, preVisitor = () => ({})) {
|
|
9808
|
+
const defaults2 = this.defaultContext;
|
|
9809
|
+
const defaultCopyFlag = defaults2.copy ?? true;
|
|
9810
|
+
const defaultContinues = defaults2.continue ?? true;
|
|
9811
|
+
const defaultIgnoreKeys = defaults2.ignoreKeys;
|
|
9812
|
+
const defaultShallowKeys = defaults2.shallowKeys;
|
|
9813
|
+
const defaultDidShortCut = defaults2.shortcut ?? false;
|
|
9795
9814
|
let didShortCut = false;
|
|
9796
|
-
const
|
|
9797
|
-
|
|
9798
|
-
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
|
|
9815
|
+
const resultWrap = { res: startObject };
|
|
9816
|
+
const stack = [startObject];
|
|
9817
|
+
const stackParent = [resultWrap];
|
|
9818
|
+
const stackParentKey = ["res"];
|
|
9819
|
+
const handleMapperOnLen = [];
|
|
9820
|
+
const mapperCopyStack = [];
|
|
9821
|
+
const mapperOrigStack = [];
|
|
9822
|
+
const mapperParent = [];
|
|
9823
|
+
const mapperParentKey = [];
|
|
9824
|
+
function handleMapper() {
|
|
9825
|
+
while (stack.length === handleMapperOnLen.at(-1)) {
|
|
9826
|
+
handleMapperOnLen.pop();
|
|
9827
|
+
const copyToMap = mapperCopyStack.pop();
|
|
9828
|
+
const origToMap = mapperOrigStack.pop();
|
|
9829
|
+
const parent = mapperParent.pop();
|
|
9830
|
+
const parentKey = mapperParentKey.pop();
|
|
9831
|
+
parent[parentKey] = mapper(copyToMap, origToMap);
|
|
9832
|
+
}
|
|
9833
|
+
}
|
|
9834
|
+
while (stack.length > 0 && stack.length < this.maxStackSize) {
|
|
9835
|
+
const curObject = stack.pop();
|
|
9836
|
+
const curParent = stackParent.pop();
|
|
9837
|
+
const curKey = stackParentKey.pop();
|
|
9838
|
+
if (!didShortCut) {
|
|
9839
|
+
if (Array.isArray(curObject)) {
|
|
9840
|
+
const newArr = [...curObject];
|
|
9841
|
+
handleMapperOnLen.push(stack.length);
|
|
9842
|
+
mapperCopyStack.push(newArr);
|
|
9843
|
+
mapperOrigStack.push(curObject);
|
|
9844
|
+
mapperParent.push(curParent);
|
|
9845
|
+
mapperParentKey.push(curKey);
|
|
9846
|
+
for (let index = curObject.length - 1; index >= 0; index--) {
|
|
9847
|
+
const val = curObject[index];
|
|
9848
|
+
if (val !== null && typeof val === "object") {
|
|
9849
|
+
stack.push(val);
|
|
9850
|
+
stackParent.push(newArr);
|
|
9851
|
+
stackParentKey.push(index.toString());
|
|
9852
|
+
}
|
|
9853
|
+
}
|
|
9854
|
+
handleMapper();
|
|
9855
|
+
continue;
|
|
9856
|
+
}
|
|
9857
|
+
const context = preVisitor(curObject);
|
|
9858
|
+
const copyFlag = context.copy ?? defaultCopyFlag;
|
|
9859
|
+
const continues = context.continue ?? defaultContinues;
|
|
9860
|
+
const ignoreKeys = context.ignoreKeys ?? defaultIgnoreKeys;
|
|
9861
|
+
const shallowKeys = context.shallowKeys ?? defaultShallowKeys;
|
|
9862
|
+
didShortCut = context.shortcut ?? defaultDidShortCut;
|
|
9863
|
+
const copy3 = copyFlag ? this.cloneObj(curObject) : curObject;
|
|
9864
|
+
handleMapperOnLen.push(stack.length);
|
|
9865
|
+
mapperCopyStack.push(copy3);
|
|
9866
|
+
mapperOrigStack.push(curObject);
|
|
9867
|
+
mapperParent.push(curParent);
|
|
9868
|
+
mapperParentKey.push(curKey);
|
|
9869
|
+
if (continues && !didShortCut) {
|
|
9870
|
+
for (const key in copy3) {
|
|
9871
|
+
if (!Object.hasOwn(copy3, key)) {
|
|
9872
|
+
continue;
|
|
9873
|
+
}
|
|
9874
|
+
const val = copy3[key];
|
|
9875
|
+
const onlyShallow = shallowKeys && shallowKeys?.has(key);
|
|
9876
|
+
if (onlyShallow) {
|
|
9877
|
+
copy3[key] = this.cloneObj(val);
|
|
9878
|
+
}
|
|
9879
|
+
if (ignoreKeys && ignoreKeys.has(key)) {
|
|
9880
|
+
continue;
|
|
9881
|
+
}
|
|
9882
|
+
if (!onlyShallow && val !== null && typeof val === "object") {
|
|
9883
|
+
stack.push(val);
|
|
9884
|
+
stackParentKey.push(key);
|
|
9885
|
+
stackParent.push(copy3);
|
|
9886
|
+
}
|
|
9805
9887
|
}
|
|
9806
|
-
copy3[key] = this.safeObjectVisit(value, (obj) => recurse(obj));
|
|
9807
9888
|
}
|
|
9808
9889
|
}
|
|
9809
|
-
|
|
9810
|
-
}
|
|
9811
|
-
|
|
9890
|
+
handleMapper();
|
|
9891
|
+
}
|
|
9892
|
+
if (stack.length >= this.maxStackSize) {
|
|
9893
|
+
throw new Error("Transform object stack overflowed");
|
|
9894
|
+
}
|
|
9895
|
+
handleMapper();
|
|
9896
|
+
return resultWrap.res;
|
|
9812
9897
|
}
|
|
9813
9898
|
/**
|
|
9814
9899
|
* Visitor that visits all objects. Visits deeper objects first.
|
|
9815
9900
|
*/
|
|
9816
9901
|
visitObject(startObject, visitor, preVisitor = () => ({})) {
|
|
9902
|
+
const defaults2 = this.defaultContext;
|
|
9903
|
+
const defaultContinues = defaults2.continue ?? true;
|
|
9904
|
+
const defaultIgnoreKeys = defaults2.ignoreKeys;
|
|
9905
|
+
const defaultShortcut = defaults2.shortcut ?? false;
|
|
9817
9906
|
let didShortCut = false;
|
|
9818
|
-
const
|
|
9819
|
-
|
|
9820
|
-
|
|
9821
|
-
|
|
9822
|
-
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
|
|
9907
|
+
const stack = [startObject];
|
|
9908
|
+
const handleVisitorOnLen = [];
|
|
9909
|
+
const visitorStack = [];
|
|
9910
|
+
function handleVisitor() {
|
|
9911
|
+
while (stack.length === handleVisitorOnLen.at(-1)) {
|
|
9912
|
+
handleVisitorOnLen.pop();
|
|
9913
|
+
const toVisit = visitorStack.pop();
|
|
9914
|
+
visitor(toVisit);
|
|
9915
|
+
}
|
|
9916
|
+
}
|
|
9917
|
+
while (stack.length > 0 && stack.length < this.maxStackSize) {
|
|
9918
|
+
const curObject = stack.pop();
|
|
9919
|
+
if (!didShortCut) {
|
|
9920
|
+
if (Array.isArray(curObject)) {
|
|
9921
|
+
for (let i = curObject.length - 1; i >= 0; i--) {
|
|
9922
|
+
stack.push(curObject[i]);
|
|
9923
|
+
}
|
|
9924
|
+
handleVisitor();
|
|
9925
|
+
continue;
|
|
9926
|
+
}
|
|
9927
|
+
const context = preVisitor(curObject);
|
|
9928
|
+
didShortCut = context.shortcut ?? defaultShortcut;
|
|
9929
|
+
const continues = context.continue ?? defaultContinues;
|
|
9930
|
+
const ignoreKeys = context.ignoreKeys ?? defaultIgnoreKeys;
|
|
9931
|
+
handleVisitorOnLen.push(stack.length);
|
|
9932
|
+
visitorStack.push(curObject);
|
|
9933
|
+
if (continues && !didShortCut) {
|
|
9934
|
+
for (const key in curObject) {
|
|
9935
|
+
if (!Object.hasOwn(curObject, key)) {
|
|
9936
|
+
continue;
|
|
9937
|
+
}
|
|
9938
|
+
if (ignoreKeys && ignoreKeys.has(key)) {
|
|
9939
|
+
continue;
|
|
9940
|
+
}
|
|
9941
|
+
const val = curObject[key];
|
|
9942
|
+
if (val && typeof val === "object") {
|
|
9943
|
+
stack.push(val);
|
|
9944
|
+
}
|
|
9826
9945
|
}
|
|
9827
|
-
this.safeObjectVisit(value, (obj) => recurse(obj));
|
|
9828
9946
|
}
|
|
9829
9947
|
}
|
|
9830
|
-
|
|
9831
|
-
}
|
|
9832
|
-
|
|
9948
|
+
handleVisitor();
|
|
9949
|
+
}
|
|
9950
|
+
if (stack.length >= this.maxStackSize) {
|
|
9951
|
+
throw new Error("Transform object stack overflowed");
|
|
9952
|
+
}
|
|
9953
|
+
handleVisitor();
|
|
9833
9954
|
}
|
|
9955
|
+
};
|
|
9956
|
+
|
|
9957
|
+
// ../core/lib/TransformerTyped.js
|
|
9958
|
+
var TransformerTyped = class _TransformerTyped extends TransformerObject {
|
|
9959
|
+
defaultNodePreVisitor;
|
|
9960
|
+
constructor(defaultContext = {}, defaultNodePreVisitor = {}) {
|
|
9961
|
+
super(defaultContext);
|
|
9962
|
+
this.defaultNodePreVisitor = defaultNodePreVisitor;
|
|
9963
|
+
}
|
|
9964
|
+
clone(newDefaultContext = {}, newDefaultNodePreVisitor = {}) {
|
|
9965
|
+
return new _TransformerTyped({ ...this.defaultContext, ...newDefaultContext }, { ...this.defaultNodePreVisitor, ...newDefaultNodePreVisitor });
|
|
9966
|
+
}
|
|
9967
|
+
/**
|
|
9968
|
+
* Transform a single node.
|
|
9969
|
+
* The transformation calls the preVisitor from starting from the startObject.
|
|
9970
|
+
* The preVisitor can dictate whether transformation should be stopped.
|
|
9971
|
+
* Note that stopping the transformation also prevets further copying.
|
|
9972
|
+
* The transformer itself transforms object starting with the deepest one that can be visited.
|
|
9973
|
+
* The transformer callback is performed on a copy of the original.
|
|
9974
|
+
* @param startObject
|
|
9975
|
+
* @param nodeCallBacks
|
|
9976
|
+
*/
|
|
9834
9977
|
transformNode(startObject, nodeCallBacks) {
|
|
9835
|
-
const transformWrapper = (
|
|
9836
|
-
|
|
9978
|
+
const transformWrapper = (copy3, orig) => {
|
|
9979
|
+
let ogTransform;
|
|
9980
|
+
const casted = copy3;
|
|
9837
9981
|
if (casted.type) {
|
|
9838
|
-
|
|
9839
|
-
if (ogFunc) {
|
|
9840
|
-
return ogFunc(casted);
|
|
9841
|
-
}
|
|
9982
|
+
ogTransform = nodeCallBacks[casted.type]?.transform;
|
|
9842
9983
|
}
|
|
9843
|
-
return
|
|
9984
|
+
return ogTransform ? ogTransform(casted, orig) : copy3;
|
|
9844
9985
|
};
|
|
9845
|
-
const
|
|
9986
|
+
const nodeDefaults = this.defaultNodePreVisitor;
|
|
9987
|
+
const preVisitWrapper = (curObject) => {
|
|
9988
|
+
let ogPreVisit;
|
|
9989
|
+
let nodeContext = {};
|
|
9846
9990
|
const casted = curObject;
|
|
9847
9991
|
if (casted.type) {
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
return ogFunc(casted);
|
|
9851
|
-
}
|
|
9992
|
+
ogPreVisit = nodeCallBacks[casted.type]?.preVisitor;
|
|
9993
|
+
nodeContext = nodeDefaults[casted.type] ?? nodeContext;
|
|
9852
9994
|
}
|
|
9853
|
-
return {};
|
|
9995
|
+
return ogPreVisit ? { ...nodeContext, ...ogPreVisit(casted) } : nodeContext;
|
|
9854
9996
|
};
|
|
9855
|
-
return this.transformObject(startObject, transformWrapper,
|
|
9997
|
+
return this.transformObject(startObject, transformWrapper, preVisitWrapper);
|
|
9856
9998
|
}
|
|
9999
|
+
/**
|
|
10000
|
+
* Similar to {@link this.transformNode}, but without copying the startObject.
|
|
10001
|
+
* The pre-visitor visits starting from the root, going deeper, while the actual visitor goes in reverse.
|
|
10002
|
+
* @param startObject
|
|
10003
|
+
* @param nodeCallBacks
|
|
10004
|
+
*/
|
|
9857
10005
|
visitNode(startObject, nodeCallBacks) {
|
|
9858
|
-
const
|
|
10006
|
+
const visitorWrapper = (curObject) => {
|
|
9859
10007
|
const casted = curObject;
|
|
9860
10008
|
if (casted.type) {
|
|
9861
|
-
const
|
|
9862
|
-
if (
|
|
9863
|
-
|
|
10009
|
+
const ogTransform = nodeCallBacks[casted.type]?.visitor;
|
|
10010
|
+
if (ogTransform) {
|
|
10011
|
+
ogTransform(casted);
|
|
9864
10012
|
}
|
|
9865
10013
|
}
|
|
9866
10014
|
};
|
|
10015
|
+
const nodeDefaults = this.defaultNodePreVisitor;
|
|
9867
10016
|
const preVisitWrapper = (curObject) => {
|
|
10017
|
+
let ogPreVisit;
|
|
10018
|
+
let nodeContext = {};
|
|
9868
10019
|
const casted = curObject;
|
|
9869
10020
|
if (casted.type) {
|
|
9870
|
-
|
|
9871
|
-
|
|
9872
|
-
return ogFunc(casted);
|
|
9873
|
-
}
|
|
10021
|
+
ogPreVisit = nodeCallBacks[casted.type]?.preVisitor;
|
|
10022
|
+
nodeContext = nodeDefaults[casted.type] ?? nodeContext;
|
|
9874
10023
|
}
|
|
9875
|
-
return {};
|
|
10024
|
+
return ogPreVisit ? { ...nodeContext, ...ogPreVisit(casted) } : nodeContext;
|
|
9876
10025
|
};
|
|
9877
|
-
this.visitObject(startObject,
|
|
10026
|
+
return this.visitObject(startObject, visitorWrapper, preVisitWrapper);
|
|
9878
10027
|
}
|
|
10028
|
+
/**
|
|
10029
|
+
* Traverses only selected nodes as returned by the function.
|
|
10030
|
+
* @param currentNode
|
|
10031
|
+
* @param traverse
|
|
10032
|
+
*/
|
|
9879
10033
|
traverseNodes(currentNode, traverse) {
|
|
9880
10034
|
let didShortCut = false;
|
|
9881
10035
|
const recurse = (curNode) => {
|
|
@@ -9896,11 +10050,27 @@ var TransformerType = class {
|
|
|
9896
10050
|
recurse(currentNode);
|
|
9897
10051
|
}
|
|
9898
10052
|
};
|
|
9899
|
-
|
|
10053
|
+
|
|
10054
|
+
// ../core/lib/TransformerSubTyped.js
|
|
10055
|
+
var TransformerSubTyped = class _TransformerSubTyped extends TransformerTyped {
|
|
10056
|
+
constructor(defaultContext = {}, defaultNodePreVisitor = {}) {
|
|
10057
|
+
super(defaultContext, defaultNodePreVisitor);
|
|
10058
|
+
}
|
|
10059
|
+
clone(newDefaultContext = {}, newDefaultNodePreVisitor = {}) {
|
|
10060
|
+
return new _TransformerSubTyped({ ...this.defaultContext, ...newDefaultContext }, { ...this.defaultNodePreVisitor, ...newDefaultNodePreVisitor });
|
|
10061
|
+
}
|
|
10062
|
+
/**
|
|
10063
|
+
* Shares the functionality and first two arguments with {@link this.transformNode}.
|
|
10064
|
+
* The third argument allows you to also transform based on the subType of objects.
|
|
10065
|
+
* Note that when a callback for the subtype is provided, the callback for the general type is **NOT** executed.
|
|
10066
|
+
* @param startObject
|
|
10067
|
+
* @param nodeCallBacks
|
|
10068
|
+
* @param nodeSpecificCallBacks
|
|
10069
|
+
*/
|
|
9900
10070
|
transformNodeSpecific(startObject, nodeCallBacks, nodeSpecificCallBacks) {
|
|
9901
|
-
const transformWrapper = (
|
|
10071
|
+
const transformWrapper = (copy3, orig) => {
|
|
9902
10072
|
let ogTransform;
|
|
9903
|
-
const casted =
|
|
10073
|
+
const casted = copy3;
|
|
9904
10074
|
if (casted.type && casted.subType) {
|
|
9905
10075
|
const specific = nodeSpecificCallBacks[casted.type];
|
|
9906
10076
|
if (specific) {
|
|
@@ -9910,7 +10080,7 @@ var TransformerSubType = class extends TransformerType {
|
|
|
9910
10080
|
ogTransform = nodeCallBacks[casted.type]?.transform;
|
|
9911
10081
|
}
|
|
9912
10082
|
}
|
|
9913
|
-
return ogTransform ? ogTransform(casted) :
|
|
10083
|
+
return ogTransform ? ogTransform(casted, orig) : copy3;
|
|
9914
10084
|
};
|
|
9915
10085
|
const preVisitWrapper = (curObject) => {
|
|
9916
10086
|
let ogPreVisit;
|
|
@@ -9924,12 +10094,13 @@ var TransformerSubType = class extends TransformerType {
|
|
|
9924
10094
|
ogPreVisit = nodeCallBacks[casted.type]?.preVisitor;
|
|
9925
10095
|
}
|
|
9926
10096
|
}
|
|
9927
|
-
return ogPreVisit ? ogPreVisit(casted) :
|
|
10097
|
+
return ogPreVisit ? ogPreVisit(casted) : {};
|
|
9928
10098
|
};
|
|
9929
10099
|
return this.transformObject(startObject, transformWrapper, preVisitWrapper);
|
|
9930
10100
|
}
|
|
9931
10101
|
/**
|
|
9932
|
-
*
|
|
10102
|
+
* Similar to {@link this.visitNode} but also allows you to match based on the subtype of objects.
|
|
10103
|
+
* When both nodeCallBack and NodeSpecific callBack are matched, will only visit nodeSpecifCallback
|
|
9933
10104
|
*/
|
|
9934
10105
|
visitNodeSpecific(startObject, nodeCallBacks, nodeSpecificCallBacks) {
|
|
9935
10106
|
const visitWrapper = (curObject) => {
|
|
@@ -9960,10 +10131,16 @@ var TransformerSubType = class extends TransformerType {
|
|
|
9960
10131
|
ogPreVisit = nodeCallBacks[casted.type]?.preVisitor;
|
|
9961
10132
|
}
|
|
9962
10133
|
}
|
|
9963
|
-
return ogPreVisit ? ogPreVisit(casted) :
|
|
10134
|
+
return ogPreVisit ? ogPreVisit(casted) : {};
|
|
9964
10135
|
};
|
|
9965
10136
|
this.visitObject(startObject, visitWrapper, preVisitWrapper);
|
|
9966
10137
|
}
|
|
10138
|
+
/**
|
|
10139
|
+
* Similar to {@link this.traverseNodes} but also allows you to match based on the subtype of objects.
|
|
10140
|
+
* @param currentNode
|
|
10141
|
+
* @param traverseNode
|
|
10142
|
+
* @param traverseSubNode
|
|
10143
|
+
*/
|
|
9967
10144
|
traverseSubNodes(currentNode, traverseNode, traverseSubNode) {
|
|
9968
10145
|
let didShortCut = false;
|
|
9969
10146
|
const recurse = (curNode) => {
|
|
@@ -10687,8 +10864,8 @@ function PatternFactoryMixin(Base) {
|
|
|
10687
10864
|
isPatternOptional(obj) {
|
|
10688
10865
|
return this.isOfSubType(obj, nodeType5, "optional");
|
|
10689
10866
|
}
|
|
10690
|
-
patternValues(values3, loc) {
|
|
10691
|
-
return { type: nodeType5, subType: "values", values: values3, loc };
|
|
10867
|
+
patternValues(variables, values3, loc) {
|
|
10868
|
+
return { type: nodeType5, subType: "values", variables, values: values3, loc };
|
|
10692
10869
|
}
|
|
10693
10870
|
isPatternValues(obj) {
|
|
10694
10871
|
return this.isOfSubType(obj, nodeType5, "values");
|
|
@@ -10863,7 +11040,7 @@ function TermFactoryMixin(Base) {
|
|
|
10863
11040
|
isTerm(x) {
|
|
10864
11041
|
return this.isOfType(x, "term");
|
|
10865
11042
|
}
|
|
10866
|
-
|
|
11043
|
+
termBlank(label, loc) {
|
|
10867
11044
|
const base = {
|
|
10868
11045
|
type: "term",
|
|
10869
11046
|
subType: "blankNode",
|
|
@@ -10877,7 +11054,7 @@ function TermFactoryMixin(Base) {
|
|
|
10877
11054
|
isTermBlank(obj) {
|
|
10878
11055
|
return this.isOfSubType(obj, nodeType8, "blankNode");
|
|
10879
11056
|
}
|
|
10880
|
-
|
|
11057
|
+
termLiteral(loc, value, langOrIri) {
|
|
10881
11058
|
return {
|
|
10882
11059
|
type: nodeType8,
|
|
10883
11060
|
subType: "literal",
|
|
@@ -10899,7 +11076,7 @@ function TermFactoryMixin(Base) {
|
|
|
10899
11076
|
const casted = obj;
|
|
10900
11077
|
return this.isTermLiteral(obj) && typeof casted.langOrIri === "object" && casted.langOrIri !== null && this.isTermNamed(casted.langOrIri);
|
|
10901
11078
|
}
|
|
10902
|
-
|
|
11079
|
+
termVariable(value, loc) {
|
|
10903
11080
|
return {
|
|
10904
11081
|
type: nodeType8,
|
|
10905
11082
|
subType: "variable",
|
|
@@ -10910,7 +11087,7 @@ function TermFactoryMixin(Base) {
|
|
|
10910
11087
|
isTermVariable(obj) {
|
|
10911
11088
|
return this.isOfSubType(obj, nodeType8, "variable");
|
|
10912
11089
|
}
|
|
10913
|
-
|
|
11090
|
+
termNamed(loc, value, prefix) {
|
|
10914
11091
|
const base = {
|
|
10915
11092
|
type: nodeType8,
|
|
10916
11093
|
subType: "namedNode",
|
|
@@ -11155,7 +11332,7 @@ var CommonIRIs;
|
|
|
11155
11332
|
CommonIRIs2["NIL"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil";
|
|
11156
11333
|
CommonIRIs2["TYPE"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
|
|
11157
11334
|
})(CommonIRIs || (CommonIRIs = {}));
|
|
11158
|
-
var AstTransformer = class extends
|
|
11335
|
+
var AstTransformer = class extends TransformerSubTyped {
|
|
11159
11336
|
};
|
|
11160
11337
|
|
|
11161
11338
|
// ../rules-sparql-1-1/lib/validation/validators.js
|
|
@@ -11283,8 +11460,7 @@ function findPatternBoundedVars(iter, boundedVars) {
|
|
|
11283
11460
|
optional: (op) => ({ next: op.patterns }),
|
|
11284
11461
|
service: (op) => ({ next: [op.name, ...op.patterns] }),
|
|
11285
11462
|
bind: (op) => ({ next: [op.variable] }),
|
|
11286
|
-
graph: (op) => ({ next: [op.name, ...op.patterns] })
|
|
11287
|
-
minus: (op) => ({ next: op.patterns.slice(0, 1) })
|
|
11463
|
+
graph: (op) => ({ next: [op.name, ...op.patterns] })
|
|
11288
11464
|
},
|
|
11289
11465
|
term: {
|
|
11290
11466
|
variable: (op) => {
|
|
@@ -11371,17 +11547,20 @@ var rdfLiteral = {
|
|
|
11371
11547
|
return OPTION(() => OR([
|
|
11372
11548
|
{ ALT: () => {
|
|
11373
11549
|
const lang2 = CONSUME(terminals_exports.langTag);
|
|
11374
|
-
return ACTION(() => C.astFactory.
|
|
11550
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(value, lang2), value.value, lang2.image.slice(1).toLowerCase()));
|
|
11375
11551
|
} },
|
|
11376
11552
|
{ ALT: () => {
|
|
11377
11553
|
CONSUME(symbols_exports.hathat);
|
|
11378
11554
|
const iriVal = SUBRULE1(iri2);
|
|
11379
|
-
return ACTION(() => C.astFactory.
|
|
11555
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(value, iriVal), value.value, iriVal));
|
|
11380
11556
|
} }
|
|
11381
11557
|
])) ?? value;
|
|
11382
11558
|
},
|
|
11383
|
-
gImpl: ({ SUBRULE, PRINT,
|
|
11384
|
-
astFactory.printFilter(ast, () =>
|
|
11559
|
+
gImpl: ({ SUBRULE, PRINT, PRINT_WORD }) => (ast, { astFactory }) => {
|
|
11560
|
+
astFactory.printFilter(ast, () => {
|
|
11561
|
+
PRINT_WORD("");
|
|
11562
|
+
PRINT(stringEscapedLexical(ast.value));
|
|
11563
|
+
});
|
|
11385
11564
|
if (ast.langOrIri) {
|
|
11386
11565
|
if (typeof ast.langOrIri === "string") {
|
|
11387
11566
|
astFactory.printFilter(ast, () => PRINT("@", ast.langOrIri));
|
|
@@ -11408,7 +11587,7 @@ var numericLiteralUnsigned = {
|
|
|
11408
11587
|
{ ALT: () => [CONSUME(terminals_exports.decimal), CommonIRIs.DECIMAL] },
|
|
11409
11588
|
{ ALT: () => [CONSUME(terminals_exports.double), CommonIRIs.DOUBLE] }
|
|
11410
11589
|
]);
|
|
11411
|
-
return ACTION(() => C.astFactory.
|
|
11590
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(parsed[0]), parsed[0].image, C.astFactory.termNamed(C.astFactory.sourceLocationNoMaterialize(), parsed[1])));
|
|
11412
11591
|
}
|
|
11413
11592
|
};
|
|
11414
11593
|
var numericLiteralPositive = {
|
|
@@ -11419,7 +11598,7 @@ var numericLiteralPositive = {
|
|
|
11419
11598
|
{ ALT: () => [CONSUME(terminals_exports.decimalPositive), CommonIRIs.DECIMAL] },
|
|
11420
11599
|
{ ALT: () => [CONSUME(terminals_exports.doublePositive), CommonIRIs.DOUBLE] }
|
|
11421
11600
|
]);
|
|
11422
|
-
return ACTION(() => C.astFactory.
|
|
11601
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(parsed[0]), parsed[0].image, C.astFactory.termNamed(C.astFactory.sourceLocationNoMaterialize(), parsed[1])));
|
|
11423
11602
|
}
|
|
11424
11603
|
};
|
|
11425
11604
|
var numericLiteralNegative = {
|
|
@@ -11430,7 +11609,7 @@ var numericLiteralNegative = {
|
|
|
11430
11609
|
{ ALT: () => [CONSUME(terminals_exports.decimalNegative), CommonIRIs.DECIMAL] },
|
|
11431
11610
|
{ ALT: () => [CONSUME(terminals_exports.doubleNegative), CommonIRIs.DOUBLE] }
|
|
11432
11611
|
]);
|
|
11433
|
-
return ACTION(() => C.astFactory.
|
|
11612
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(parsed[0]), parsed[0].image, C.astFactory.termNamed(C.astFactory.sourceLocationNoMaterialize(), parsed[1])));
|
|
11434
11613
|
}
|
|
11435
11614
|
};
|
|
11436
11615
|
var booleanLiteral = {
|
|
@@ -11440,7 +11619,7 @@ var booleanLiteral = {
|
|
|
11440
11619
|
{ ALT: () => CONSUME(true_) },
|
|
11441
11620
|
{ ALT: () => CONSUME(false_) }
|
|
11442
11621
|
]);
|
|
11443
|
-
return ACTION(() => C.astFactory.
|
|
11622
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(token), token.image.toLowerCase(), C.astFactory.termNamed(C.astFactory.sourceLocationNoMaterialize(), CommonIRIs.BOOLEAN)));
|
|
11444
11623
|
}
|
|
11445
11624
|
};
|
|
11446
11625
|
var string = {
|
|
@@ -11482,7 +11661,7 @@ var string = {
|
|
|
11482
11661
|
return char;
|
|
11483
11662
|
}
|
|
11484
11663
|
});
|
|
11485
|
-
return F2.
|
|
11664
|
+
return F2.termLiteral(F2.sourceLocation(x[0]), value);
|
|
11486
11665
|
});
|
|
11487
11666
|
}
|
|
11488
11667
|
};
|
|
@@ -11498,7 +11677,7 @@ var iriFull = {
|
|
|
11498
11677
|
name: "iriFull",
|
|
11499
11678
|
impl: ({ ACTION, CONSUME }) => (C) => {
|
|
11500
11679
|
const iriToken = CONSUME(terminals_exports.iriRef);
|
|
11501
|
-
return ACTION(() => C.astFactory.
|
|
11680
|
+
return ACTION(() => C.astFactory.termNamed(C.astFactory.sourceLocation(iriToken), iriToken.image.slice(1, -1)));
|
|
11502
11681
|
},
|
|
11503
11682
|
gImpl: ({ PRINT }) => (ast, { astFactory: F2 }) => {
|
|
11504
11683
|
F2.printFilter(ast, () => PRINT("<", ast.value, ">"));
|
|
@@ -11511,16 +11690,16 @@ var prefixedName = {
|
|
|
11511
11690
|
const longName = CONSUME(terminals_exports.pNameLn);
|
|
11512
11691
|
return ACTION(() => {
|
|
11513
11692
|
const [prefix, localName] = longName.image.split(":");
|
|
11514
|
-
return C.astFactory.
|
|
11693
|
+
return C.astFactory.termNamed(C.astFactory.sourceLocation(longName), localName, prefix);
|
|
11515
11694
|
});
|
|
11516
11695
|
} },
|
|
11517
11696
|
{ ALT: () => {
|
|
11518
11697
|
const shortName = CONSUME(terminals_exports.pNameNs);
|
|
11519
|
-
return ACTION(() => C.astFactory.
|
|
11698
|
+
return ACTION(() => C.astFactory.termNamed(C.astFactory.sourceLocation(shortName), "", shortName.image.slice(0, -1)));
|
|
11520
11699
|
} }
|
|
11521
11700
|
]),
|
|
11522
|
-
gImpl: ({
|
|
11523
|
-
F2.printFilter(ast, () =>
|
|
11701
|
+
gImpl: ({ PRINT }) => (ast, { astFactory: F2 }) => {
|
|
11702
|
+
F2.printFilter(ast, () => PRINT(ast.prefix, ":", ast.value));
|
|
11524
11703
|
}
|
|
11525
11704
|
};
|
|
11526
11705
|
var canCreateBlankNodes = Symbol("canCreateBlankNodes");
|
|
@@ -11530,11 +11709,11 @@ var blankNode = {
|
|
|
11530
11709
|
const result = OR([
|
|
11531
11710
|
{ ALT: () => {
|
|
11532
11711
|
const labelToken = CONSUME(terminals_exports.blankNodeLabel);
|
|
11533
|
-
return ACTION(() => C.astFactory.
|
|
11712
|
+
return ACTION(() => C.astFactory.termBlank(labelToken.image.slice(2), C.astFactory.sourceLocation(labelToken)));
|
|
11534
11713
|
} },
|
|
11535
11714
|
{ ALT: () => {
|
|
11536
11715
|
const anonToken = CONSUME(terminals_exports.anon);
|
|
11537
|
-
return ACTION(() => C.astFactory.
|
|
11716
|
+
return ACTION(() => C.astFactory.termBlank(void 0, C.astFactory.sourceLocation(anonToken)));
|
|
11538
11717
|
} }
|
|
11539
11718
|
]);
|
|
11540
11719
|
ACTION(() => {
|
|
@@ -11544,15 +11723,15 @@ var blankNode = {
|
|
|
11544
11723
|
});
|
|
11545
11724
|
return result;
|
|
11546
11725
|
},
|
|
11547
|
-
gImpl: ({
|
|
11548
|
-
astFactory.printFilter(ast, () =>
|
|
11726
|
+
gImpl: ({ PRINT }) => (ast, { astFactory }) => {
|
|
11727
|
+
astFactory.printFilter(ast, () => PRINT("_:", ast.label.replace(/^e_/u, "")));
|
|
11549
11728
|
}
|
|
11550
11729
|
};
|
|
11551
11730
|
var verbA = {
|
|
11552
11731
|
name: "VerbA",
|
|
11553
11732
|
impl: ({ ACTION, CONSUME }) => (C) => {
|
|
11554
11733
|
const token = CONSUME(a);
|
|
11555
|
-
return ACTION(() => C.astFactory.
|
|
11734
|
+
return ACTION(() => C.astFactory.termNamed(C.astFactory.sourceLocation(token), CommonIRIs.TYPE, void 0));
|
|
11556
11735
|
}
|
|
11557
11736
|
};
|
|
11558
11737
|
|
|
@@ -11586,10 +11765,10 @@ var baseDecl2 = {
|
|
|
11586
11765
|
const val = SUBRULE(iriFull);
|
|
11587
11766
|
return ACTION(() => C.astFactory.contextDefinitionBase(C.astFactory.sourceLocation(base, val), val));
|
|
11588
11767
|
},
|
|
11589
|
-
gImpl: ({ SUBRULE,
|
|
11590
|
-
F2.printFilter(ast, () =>
|
|
11768
|
+
gImpl: ({ SUBRULE, PRINT_ON_EMPTY, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
11769
|
+
F2.printFilter(ast, () => PRINT_ON_EMPTY("BASE "));
|
|
11591
11770
|
SUBRULE(iri2, ast.value);
|
|
11592
|
-
F2.printFilter(ast, () =>
|
|
11771
|
+
F2.printFilter(ast, () => NEW_LINE());
|
|
11593
11772
|
}
|
|
11594
11773
|
};
|
|
11595
11774
|
var prefixDecl2 = {
|
|
@@ -11600,12 +11779,12 @@ var prefixDecl2 = {
|
|
|
11600
11779
|
const value = SUBRULE(iriFull);
|
|
11601
11780
|
return ACTION(() => C.astFactory.contextDefinitionPrefix(C.astFactory.sourceLocation(prefix, value), name, value));
|
|
11602
11781
|
},
|
|
11603
|
-
gImpl: ({ SUBRULE,
|
|
11782
|
+
gImpl: ({ SUBRULE, PRINT_ON_EMPTY, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
11604
11783
|
F2.printFilter(ast, () => {
|
|
11605
|
-
|
|
11784
|
+
PRINT_ON_EMPTY("PREFIX ", `${ast.key}: `);
|
|
11606
11785
|
});
|
|
11607
11786
|
SUBRULE(iri2, ast.value);
|
|
11608
|
-
F2.printFilter(ast, () =>
|
|
11787
|
+
F2.printFilter(ast, () => NEW_LINE());
|
|
11609
11788
|
}
|
|
11610
11789
|
};
|
|
11611
11790
|
var verb = {
|
|
@@ -11642,10 +11821,10 @@ var var_ = {
|
|
|
11642
11821
|
{ ALT: () => CONSUME(terminals_exports.var1) },
|
|
11643
11822
|
{ ALT: () => CONSUME(terminals_exports.var2) }
|
|
11644
11823
|
]);
|
|
11645
|
-
return ACTION(() => C.astFactory.
|
|
11824
|
+
return ACTION(() => C.astFactory.termVariable(varToken.image.slice(1), C.astFactory.sourceLocation(varToken)));
|
|
11646
11825
|
},
|
|
11647
|
-
gImpl: ({
|
|
11648
|
-
F2.printFilter(ast, () =>
|
|
11826
|
+
gImpl: ({ PRINT }) => (ast, { astFactory: F2 }) => {
|
|
11827
|
+
F2.printFilter(ast, () => PRINT(`?${ast.value}`));
|
|
11649
11828
|
}
|
|
11650
11829
|
};
|
|
11651
11830
|
var graphTerm = {
|
|
@@ -11658,7 +11837,7 @@ var graphTerm = {
|
|
|
11658
11837
|
{ GATE: () => C.parseMode.has("canCreateBlankNodes"), ALT: () => SUBRULE(blankNode) },
|
|
11659
11838
|
{ ALT: () => {
|
|
11660
11839
|
const tokenNil = CONSUME(terminals_exports.nil);
|
|
11661
|
-
return ACTION(() => C.astFactory.
|
|
11840
|
+
return ACTION(() => C.astFactory.termNamed(C.astFactory.sourceLocation(tokenNil), CommonIRIs.NIL));
|
|
11662
11841
|
} }
|
|
11663
11842
|
]),
|
|
11664
11843
|
gImpl: ({ SUBRULE }) => (ast, { astFactory: F2 }) => {
|
|
@@ -12288,13 +12467,16 @@ function triplesDotSeperated(triplesSameSubjectSubrule) {
|
|
|
12288
12467
|
var triplesBlock = {
|
|
12289
12468
|
name: "triplesBlock",
|
|
12290
12469
|
impl: (implArgs) => (C) => triplesDotSeperated(triplesSameSubjectPath)(implArgs)(C),
|
|
12291
|
-
gImpl: ({ SUBRULE, PRINT_WORD, HANDLE_LOC }) => (ast, { astFactory: F2 }) => {
|
|
12470
|
+
gImpl: ({ SUBRULE, PRINT_WORD, HANDLE_LOC, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
12292
12471
|
for (const [index, triple] of ast.triples.entries()) {
|
|
12293
12472
|
HANDLE_LOC(triple, () => {
|
|
12294
12473
|
const nextTriple = ast.triples.at(index);
|
|
12295
12474
|
if (F2.isTripleCollection(triple)) {
|
|
12296
12475
|
SUBRULE(graphNodePath, triple);
|
|
12297
|
-
F2.printFilter(triple, () =>
|
|
12476
|
+
F2.printFilter(triple, () => {
|
|
12477
|
+
PRINT_WORD(".");
|
|
12478
|
+
NEW_LINE();
|
|
12479
|
+
});
|
|
12298
12480
|
} else {
|
|
12299
12481
|
SUBRULE(graphNodePath, triple.subject);
|
|
12300
12482
|
F2.printFilter(triple, () => PRINT_WORD(""));
|
|
@@ -12306,11 +12488,17 @@ var triplesBlock = {
|
|
|
12306
12488
|
F2.printFilter(triple, () => PRINT_WORD(""));
|
|
12307
12489
|
SUBRULE(graphNodePath, triple.object);
|
|
12308
12490
|
if (nextTriple === void 0 || F2.isTripleCollection(nextTriple) || !F2.isSourceLocationNoMaterialize(nextTriple.subject.loc)) {
|
|
12309
|
-
F2.printFilter(ast, () =>
|
|
12491
|
+
F2.printFilter(ast, () => {
|
|
12492
|
+
PRINT_WORD(".");
|
|
12493
|
+
NEW_LINE();
|
|
12494
|
+
});
|
|
12310
12495
|
} else if (F2.isSourceLocationNoMaterialize(nextTriple.predicate.loc)) {
|
|
12311
12496
|
F2.printFilter(ast, () => PRINT_WORD(","));
|
|
12312
12497
|
} else {
|
|
12313
|
-
F2.printFilter(ast, () =>
|
|
12498
|
+
F2.printFilter(ast, () => {
|
|
12499
|
+
PRINT_WORD(";");
|
|
12500
|
+
NEW_LINE();
|
|
12501
|
+
});
|
|
12314
12502
|
}
|
|
12315
12503
|
}
|
|
12316
12504
|
});
|
|
@@ -12443,10 +12631,10 @@ function collectionImpl(name, allowPaths) {
|
|
|
12443
12631
|
return ACTION(() => {
|
|
12444
12632
|
const F2 = C.astFactory;
|
|
12445
12633
|
const triples = [];
|
|
12446
|
-
const predFirst = F2.
|
|
12447
|
-
const predRest = F2.
|
|
12448
|
-
const predNil = F2.
|
|
12449
|
-
const listHead = F2.
|
|
12634
|
+
const predFirst = F2.termNamed(F2.sourceLocationNoMaterialize(), CommonIRIs.FIRST, void 0);
|
|
12635
|
+
const predRest = F2.termNamed(F2.sourceLocationNoMaterialize(), CommonIRIs.REST, void 0);
|
|
12636
|
+
const predNil = F2.termNamed(F2.sourceLocationNoMaterialize(), CommonIRIs.NIL, void 0);
|
|
12637
|
+
const listHead = F2.termBlank(void 0, F2.sourceLocationNoMaterialize());
|
|
12450
12638
|
let iterHead = listHead;
|
|
12451
12639
|
for (const [index, term] of terms.entries()) {
|
|
12452
12640
|
const lastInList = index === terms.length - 1;
|
|
@@ -12456,7 +12644,7 @@ function collectionImpl(name, allowPaths) {
|
|
|
12456
12644
|
const nilTriple = F2.triple(iterHead, predRest, predNil);
|
|
12457
12645
|
triples.push(nilTriple);
|
|
12458
12646
|
} else {
|
|
12459
|
-
const tail = F2.
|
|
12647
|
+
const tail = F2.termBlank(void 0, F2.sourceLocationNoMaterialize());
|
|
12460
12648
|
const linkTriple = F2.triple(iterHead, predRest, tail);
|
|
12461
12649
|
triples.push(linkTriple);
|
|
12462
12650
|
iterHead = tail;
|
|
@@ -12496,16 +12684,17 @@ function blankNodePropertyListImpl(name, allowPaths) {
|
|
|
12496
12684
|
name,
|
|
12497
12685
|
impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
|
|
12498
12686
|
const startToken = CONSUME(symbols_exports.LSquare);
|
|
12499
|
-
const blankNode2 = ACTION(() => C.astFactory.
|
|
12687
|
+
const blankNode2 = ACTION(() => C.astFactory.termBlank(void 0, C.astFactory.sourceLocationNoMaterialize()));
|
|
12500
12688
|
const propList = SUBRULE(propertyPathNotEmptyImpl, blankNode2);
|
|
12501
12689
|
const endToken = CONSUME(symbols_exports.RSquare);
|
|
12502
12690
|
return ACTION(() => C.astFactory.tripleCollectionBlankNodeProperties(blankNode2, propList, C.astFactory.sourceLocation(startToken, endToken)));
|
|
12503
12691
|
},
|
|
12504
|
-
gImpl: ({ SUBRULE, PRINT, PRINT_WORD, HANDLE_LOC, PRINT_ON_EMPTY }) => (ast, c) => {
|
|
12692
|
+
gImpl: ({ SUBRULE, PRINT, PRINT_WORD, HANDLE_LOC, PRINT_ON_EMPTY, NEW_LINE }) => (ast, c) => {
|
|
12505
12693
|
const { astFactory: F2, indentInc } = c;
|
|
12506
12694
|
F2.printFilter(ast, () => {
|
|
12507
12695
|
c[traqulaIndentation] += indentInc;
|
|
12508
|
-
PRINT("[
|
|
12696
|
+
PRINT("[");
|
|
12697
|
+
NEW_LINE();
|
|
12509
12698
|
});
|
|
12510
12699
|
for (const triple of ast.triples) {
|
|
12511
12700
|
HANDLE_LOC(triple, () => {
|
|
@@ -12516,7 +12705,10 @@ function blankNodePropertyListImpl(name, allowPaths) {
|
|
|
12516
12705
|
}
|
|
12517
12706
|
F2.printFilter(triple, () => PRINT_WORD(""));
|
|
12518
12707
|
SUBRULE(graphNodePath, triple.object);
|
|
12519
|
-
F2.printFilter(ast, () =>
|
|
12708
|
+
F2.printFilter(ast, () => {
|
|
12709
|
+
PRINT_WORD(";");
|
|
12710
|
+
NEW_LINE();
|
|
12711
|
+
});
|
|
12520
12712
|
});
|
|
12521
12713
|
}
|
|
12522
12714
|
F2.printFilter(ast, () => {
|
|
@@ -12575,18 +12767,19 @@ var groupGraphPattern = {
|
|
|
12575
12767
|
const close = CONSUME(symbols_exports.RCurly);
|
|
12576
12768
|
return ACTION(() => C.astFactory.patternGroup(patterns, C.astFactory.sourceLocation(open, close)));
|
|
12577
12769
|
},
|
|
12578
|
-
gImpl: ({ SUBRULE, PRINT_WORD,
|
|
12770
|
+
gImpl: ({ SUBRULE, PRINT_WORD, NEW_LINE, PRINT_ON_OWN_LINE }) => (ast, C) => {
|
|
12579
12771
|
const { astFactory: F2, indentInc } = C;
|
|
12580
12772
|
F2.printFilter(ast, () => {
|
|
12581
12773
|
C[traqulaIndentation] += indentInc;
|
|
12582
|
-
PRINT_WORD("{
|
|
12774
|
+
PRINT_WORD("{");
|
|
12775
|
+
NEW_LINE();
|
|
12583
12776
|
});
|
|
12584
12777
|
for (const pattern of ast.patterns) {
|
|
12585
12778
|
SUBRULE(generatePattern, pattern);
|
|
12586
12779
|
}
|
|
12587
12780
|
F2.printFilter(ast, () => {
|
|
12588
12781
|
C[traqulaIndentation] -= indentInc;
|
|
12589
|
-
|
|
12782
|
+
PRINT_ON_OWN_LINE("}");
|
|
12590
12783
|
});
|
|
12591
12784
|
}
|
|
12592
12785
|
};
|
|
@@ -12736,12 +12929,15 @@ var bind2 = {
|
|
|
12736
12929
|
const close = CONSUME(symbols_exports.RParen);
|
|
12737
12930
|
return ACTION(() => C.astFactory.patternBind(expressionVal, variable, C.astFactory.sourceLocation(bind3, close)));
|
|
12738
12931
|
},
|
|
12739
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
12932
|
+
gImpl: ({ SUBRULE, PRINT_WORD, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
12740
12933
|
F2.printFilter(ast, () => PRINT_WORD("BIND", "("));
|
|
12741
12934
|
SUBRULE(expression, ast.expression);
|
|
12742
12935
|
F2.printFilter(ast, () => PRINT_WORD("AS"));
|
|
12743
12936
|
SUBRULE(var_, ast.variable);
|
|
12744
|
-
F2.printFilter(ast, () =>
|
|
12937
|
+
F2.printFilter(ast, () => {
|
|
12938
|
+
PRINT_WORD(")");
|
|
12939
|
+
NEW_LINE();
|
|
12940
|
+
});
|
|
12745
12941
|
}
|
|
12746
12942
|
};
|
|
12747
12943
|
var inlineData = {
|
|
@@ -12749,34 +12945,46 @@ var inlineData = {
|
|
|
12749
12945
|
impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
|
|
12750
12946
|
const values3 = CONSUME(values2);
|
|
12751
12947
|
const datablock = SUBRULE(dataBlock);
|
|
12752
|
-
return ACTION(() =>
|
|
12948
|
+
return ACTION(() => {
|
|
12949
|
+
datablock.loc = C.astFactory.sourceLocation(values3, datablock);
|
|
12950
|
+
return datablock;
|
|
12951
|
+
});
|
|
12753
12952
|
},
|
|
12754
|
-
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, C) => {
|
|
12953
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY, NEW_LINE, PRINT_ON_OWN_LINE }) => (ast, C) => {
|
|
12755
12954
|
const { astFactory: F2, indentInc } = C;
|
|
12756
|
-
const variables =
|
|
12955
|
+
const variables = ast.variables;
|
|
12956
|
+
const singleVar = variables.length === 1;
|
|
12957
|
+
F2.printFilter(ast, () => {
|
|
12958
|
+
PRINT_ON_EMPTY("VALUES", singleVar ? "" : "( ");
|
|
12959
|
+
});
|
|
12960
|
+
for (const variable of variables) {
|
|
12961
|
+
F2.printFilter(ast, () => PRINT_WORD(""));
|
|
12962
|
+
SUBRULE(varOrTerm, variable);
|
|
12963
|
+
F2.printFilter(ast, () => PRINT_WORD(""));
|
|
12964
|
+
}
|
|
12757
12965
|
F2.printFilter(ast, () => {
|
|
12758
|
-
PRINT_ON_EMPTY("");
|
|
12759
|
-
PRINT_WORD("VALUES", "(");
|
|
12760
|
-
for (const variable of variables) {
|
|
12761
|
-
PRINT_WORD(`?${variable}`);
|
|
12762
|
-
}
|
|
12763
12966
|
C[traqulaIndentation] += indentInc;
|
|
12764
|
-
PRINT_WORD(")", "{
|
|
12967
|
+
PRINT_WORD(singleVar ? "" : ")", "{");
|
|
12968
|
+
NEW_LINE();
|
|
12765
12969
|
});
|
|
12766
12970
|
for (const mapping of ast.values) {
|
|
12767
|
-
F2.printFilter(ast, () => PRINT_WORD("("));
|
|
12971
|
+
F2.printFilter(ast, () => !singleVar && PRINT_WORD("("));
|
|
12768
12972
|
for (const variable of variables) {
|
|
12769
|
-
|
|
12973
|
+
const var_2 = variable.value;
|
|
12974
|
+
if (mapping[var_2] === void 0) {
|
|
12770
12975
|
F2.printFilter(ast, () => PRINT_WORD("UNDEF"));
|
|
12771
12976
|
} else {
|
|
12772
|
-
SUBRULE(graphNodePath, mapping[
|
|
12977
|
+
SUBRULE(graphNodePath, mapping[var_2]);
|
|
12773
12978
|
}
|
|
12774
12979
|
}
|
|
12775
|
-
F2.printFilter(ast, () =>
|
|
12980
|
+
F2.printFilter(ast, () => {
|
|
12981
|
+
PRINT_WORD(singleVar ? "" : ")");
|
|
12982
|
+
NEW_LINE();
|
|
12983
|
+
});
|
|
12776
12984
|
}
|
|
12777
12985
|
F2.printFilter(ast, () => {
|
|
12778
12986
|
C[traqulaIndentation] -= indentInc;
|
|
12779
|
-
|
|
12987
|
+
PRINT_ON_OWN_LINE("}");
|
|
12780
12988
|
});
|
|
12781
12989
|
}
|
|
12782
12990
|
};
|
|
@@ -12800,7 +13008,7 @@ var inlineDataOneVar = {
|
|
|
12800
13008
|
});
|
|
12801
13009
|
});
|
|
12802
13010
|
const close = CONSUME(symbols_exports.RCurly);
|
|
12803
|
-
return ACTION(() => C.astFactory.
|
|
13011
|
+
return ACTION(() => C.astFactory.patternValues([varVal], res, C.astFactory.sourceLocation(varVal, close)));
|
|
12804
13012
|
}
|
|
12805
13013
|
};
|
|
12806
13014
|
var inlineDataFull = {
|
|
@@ -12817,7 +13025,7 @@ var inlineDataFull = {
|
|
|
12817
13025
|
res.push({});
|
|
12818
13026
|
});
|
|
12819
13027
|
const close = CONSUME1(symbols_exports.RCurly);
|
|
12820
|
-
return ACTION(() => C.astFactory.
|
|
13028
|
+
return ACTION(() => C.astFactory.patternValues(vars, res, C.astFactory.sourceLocation(nil2, close)));
|
|
12821
13029
|
} },
|
|
12822
13030
|
{ ALT: () => {
|
|
12823
13031
|
const open = CONSUME1(symbols_exports.LParen);
|
|
@@ -12849,7 +13057,7 @@ var inlineDataFull = {
|
|
|
12849
13057
|
});
|
|
12850
13058
|
});
|
|
12851
13059
|
const close = CONSUME2(symbols_exports.RCurly);
|
|
12852
|
-
return ACTION(() => C.astFactory.
|
|
13060
|
+
return ACTION(() => C.astFactory.patternValues(vars, res, C.astFactory.sourceLocation(open, close)));
|
|
12853
13061
|
} }
|
|
12854
13062
|
]);
|
|
12855
13063
|
}
|
|
@@ -12912,10 +13120,13 @@ var filter3 = {
|
|
|
12912
13120
|
const expression2 = SUBRULE(constraint);
|
|
12913
13121
|
return ACTION(() => C.astFactory.patternFilter(expression2, C.astFactory.sourceLocation(filterToken, expression2)));
|
|
12914
13122
|
},
|
|
12915
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
13123
|
+
gImpl: ({ SUBRULE, PRINT_WORD, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
12916
13124
|
F2.printFilter(ast, () => PRINT_WORD("FILTER ("));
|
|
12917
13125
|
SUBRULE(expression, ast.expression);
|
|
12918
|
-
F2.printFilter(ast, () =>
|
|
13126
|
+
F2.printFilter(ast, () => {
|
|
13127
|
+
PRINT_WORD(")");
|
|
13128
|
+
NEW_LINE();
|
|
13129
|
+
});
|
|
12919
13130
|
}
|
|
12920
13131
|
};
|
|
12921
13132
|
var constraint = {
|
|
@@ -13301,8 +13512,7 @@ var groupClause = {
|
|
|
13301
13512
|
},
|
|
13302
13513
|
gImpl: ({ PRINT_WORDS, SUBRULE, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
13303
13514
|
F2.printFilter(ast, () => {
|
|
13304
|
-
PRINT_ON_EMPTY("");
|
|
13305
|
-
PRINT_WORDS("GROUP", "BY");
|
|
13515
|
+
PRINT_ON_EMPTY("GROUP BY ");
|
|
13306
13516
|
});
|
|
13307
13517
|
for (const grouping of ast.groupings) {
|
|
13308
13518
|
if (F2.isExpression(grouping)) {
|
|
@@ -13358,10 +13568,9 @@ var havingClause = {
|
|
|
13358
13568
|
ACTION(() => !couldParseAgg && C.parseMode.delete("canParseAggregate"));
|
|
13359
13569
|
return ACTION(() => C.astFactory.solutionModifierHaving(expressions, C.astFactory.sourceLocation(having2, expressions.at(-1))));
|
|
13360
13570
|
},
|
|
13361
|
-
gImpl: ({
|
|
13571
|
+
gImpl: ({ PRINT_ON_EMPTY, SUBRULE }) => (ast, { astFactory: F2 }) => {
|
|
13362
13572
|
F2.printFilter(ast, () => {
|
|
13363
|
-
PRINT_ON_EMPTY("");
|
|
13364
|
-
PRINT_WORD("HAVING");
|
|
13573
|
+
PRINT_ON_EMPTY("HAVING ");
|
|
13365
13574
|
});
|
|
13366
13575
|
for (const having2 of ast.having) {
|
|
13367
13576
|
SUBRULE(expression, having2);
|
|
@@ -13387,8 +13596,7 @@ var orderClause = {
|
|
|
13387
13596
|
},
|
|
13388
13597
|
gImpl: ({ PRINT_WORDS, PRINT_ON_EMPTY, SUBRULE }) => (ast, { astFactory: F2 }) => {
|
|
13389
13598
|
F2.printFilter(ast, () => {
|
|
13390
|
-
PRINT_ON_EMPTY("");
|
|
13391
|
-
PRINT_WORDS("ORDER", "BY");
|
|
13599
|
+
PRINT_ON_EMPTY("ORDER BY ");
|
|
13392
13600
|
});
|
|
13393
13601
|
for (const ordering of ast.orderDefs) {
|
|
13394
13602
|
if (ordering.descending) {
|
|
@@ -13447,9 +13655,9 @@ var limitOffsetClauses = {
|
|
|
13447
13655
|
return ACTION(() => C.astFactory.solutionModifierLimitOffset(limit2?.val, offset2.val, C.astFactory.sourceLocation(offset2, limit2)));
|
|
13448
13656
|
} }
|
|
13449
13657
|
]),
|
|
13450
|
-
gImpl: ({ PRINT_WORDS,
|
|
13658
|
+
gImpl: ({ PRINT_WORDS, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
13451
13659
|
F2.printFilter(ast, () => {
|
|
13452
|
-
|
|
13660
|
+
NEW_LINE();
|
|
13453
13661
|
if (ast.limit) {
|
|
13454
13662
|
PRINT_WORDS("LIMIT", String(ast.limit));
|
|
13455
13663
|
}
|
|
@@ -13634,9 +13842,9 @@ var selectClause = {
|
|
|
13634
13842
|
ACTION(() => !couldParseAgg && C.parseMode.delete("canParseAggregate"));
|
|
13635
13843
|
return ACTION(() => C.astFactory.wrap(val, C.astFactory.sourceLocation(select2, last2)));
|
|
13636
13844
|
},
|
|
13637
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
13845
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
13638
13846
|
F2.printFilter(ast, () => {
|
|
13639
|
-
|
|
13847
|
+
PRINT_ON_EMPTY("SELECT ");
|
|
13640
13848
|
if (ast.val.distinct) {
|
|
13641
13849
|
PRINT_WORD("DISTINCT");
|
|
13642
13850
|
} else if (ast.val.reduced) {
|
|
@@ -13655,7 +13863,9 @@ var selectClause = {
|
|
|
13655
13863
|
SUBRULE(var_, variable.variable);
|
|
13656
13864
|
F2.printFilter(ast, () => PRINT_WORD(")"));
|
|
13657
13865
|
}
|
|
13866
|
+
F2.printFilter(ast, () => PRINT_WORD(""));
|
|
13658
13867
|
}
|
|
13868
|
+
F2.printFilter(ast, () => PRINT_WORD(""));
|
|
13659
13869
|
}
|
|
13660
13870
|
};
|
|
13661
13871
|
var constructQuery = {
|
|
@@ -13693,18 +13903,19 @@ var constructQuery = {
|
|
|
13693
13903
|
} }
|
|
13694
13904
|
]);
|
|
13695
13905
|
},
|
|
13696
|
-
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, C) => {
|
|
13906
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY, PRINT_ON_OWN_LINE, NEW_LINE }) => (ast, C) => {
|
|
13697
13907
|
const { astFactory: F2, indentInc } = C;
|
|
13698
|
-
F2.printFilter(ast, () =>
|
|
13908
|
+
F2.printFilter(ast, () => PRINT_ON_EMPTY("CONSTRUCT "));
|
|
13699
13909
|
if (!F2.isSourceLocationNoMaterialize(ast.where.loc)) {
|
|
13700
13910
|
F2.printFilter(ast, () => {
|
|
13701
13911
|
C[traqulaIndentation] += indentInc;
|
|
13702
|
-
PRINT_WORD("{
|
|
13912
|
+
PRINT_WORD("{");
|
|
13913
|
+
NEW_LINE();
|
|
13703
13914
|
});
|
|
13704
13915
|
SUBRULE(triplesBlock, ast.template);
|
|
13705
13916
|
F2.printFilter(ast, () => {
|
|
13706
13917
|
C[traqulaIndentation] -= indentInc;
|
|
13707
|
-
|
|
13918
|
+
PRINT_ON_OWN_LINE("}");
|
|
13708
13919
|
});
|
|
13709
13920
|
}
|
|
13710
13921
|
SUBRULE(datasetClauseStar, ast.datasets);
|
|
@@ -13745,8 +13956,8 @@ var describeQuery = {
|
|
|
13745
13956
|
loc: C.astFactory.sourceLocation(describe2, ...variables, from2, where2, modifiers.group, modifiers.having, modifiers.order, modifiers.limitOffset)
|
|
13746
13957
|
}));
|
|
13747
13958
|
},
|
|
13748
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
13749
|
-
F2.printFilter(ast, () =>
|
|
13959
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
13960
|
+
F2.printFilter(ast, () => PRINT_ON_EMPTY("DESCRIBE "));
|
|
13750
13961
|
if (F2.isWildcard(ast.variables[0])) {
|
|
13751
13962
|
F2.printFilter(ast, () => PRINT_WORD("*"));
|
|
13752
13963
|
} else {
|
|
@@ -13776,8 +13987,8 @@ var askQuery = {
|
|
|
13776
13987
|
loc: C.astFactory.sourceLocation(ask2, from2, where2, modifiers.group, modifiers.having, modifiers.order, modifiers.limitOffset)
|
|
13777
13988
|
}));
|
|
13778
13989
|
},
|
|
13779
|
-
gImpl: ({ SUBRULE,
|
|
13780
|
-
F2.printFilter(ast, () =>
|
|
13990
|
+
gImpl: ({ SUBRULE, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
13991
|
+
F2.printFilter(ast, () => PRINT_ON_EMPTY("ASK "));
|
|
13781
13992
|
SUBRULE(datasetClauseStar, ast.datasets);
|
|
13782
13993
|
SUBRULE(whereClause, F2.wrap(ast.where, ast.loc));
|
|
13783
13994
|
SUBRULE(solutionModifier, ast.solutionModifiers);
|
|
@@ -13836,7 +14047,7 @@ var update = {
|
|
|
13836
14047
|
return update2;
|
|
13837
14048
|
});
|
|
13838
14049
|
},
|
|
13839
|
-
gImpl: ({ SUBRULE,
|
|
14050
|
+
gImpl: ({ SUBRULE, PRINT, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
13840
14051
|
const [head2, ...tail] = ast.updates;
|
|
13841
14052
|
if (head2) {
|
|
13842
14053
|
SUBRULE(prologue, head2.context);
|
|
@@ -13845,7 +14056,10 @@ var update = {
|
|
|
13845
14056
|
}
|
|
13846
14057
|
}
|
|
13847
14058
|
for (const update2 of tail) {
|
|
13848
|
-
F2.printFilter(ast, () =>
|
|
14059
|
+
F2.printFilter(ast, () => {
|
|
14060
|
+
PRINT(";");
|
|
14061
|
+
NEW_LINE();
|
|
14062
|
+
});
|
|
13849
14063
|
SUBRULE(prologue, update2.context);
|
|
13850
14064
|
if (update2.operation) {
|
|
13851
14065
|
SUBRULE(update1, update2.operation);
|
|
@@ -13918,9 +14132,9 @@ var load2 = {
|
|
|
13918
14132
|
});
|
|
13919
14133
|
return ACTION(() => C.astFactory.updateOperationLoad(C.astFactory.sourceLocation(loadToken, source, destination), source, Boolean(silent2), destination));
|
|
13920
14134
|
},
|
|
13921
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
14135
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
13922
14136
|
F2.printFilter(ast, () => {
|
|
13923
|
-
|
|
14137
|
+
PRINT_ON_EMPTY("LOAD ");
|
|
13924
14138
|
if (ast.silent) {
|
|
13925
14139
|
PRINT_WORD("SILENT");
|
|
13926
14140
|
}
|
|
@@ -13941,9 +14155,9 @@ function clearOrDrop(operation) {
|
|
|
13941
14155
|
const destination = SUBRULE1(graphRefAll);
|
|
13942
14156
|
return ACTION(() => C.astFactory.updateOperationClearDrop(unCapitalize(operation.name), Boolean(silent2), destination, C.astFactory.sourceLocation(opToken, destination)));
|
|
13943
14157
|
},
|
|
13944
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
14158
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
13945
14159
|
F2.printFilter(ast, () => {
|
|
13946
|
-
|
|
14160
|
+
PRINT_ON_EMPTY(operation.name.toUpperCase(), " ");
|
|
13947
14161
|
if (ast.silent) {
|
|
13948
14162
|
PRINT_WORD("SILENT");
|
|
13949
14163
|
}
|
|
@@ -13962,9 +14176,9 @@ var create2 = {
|
|
|
13962
14176
|
const destination = SUBRULE1(graphRef);
|
|
13963
14177
|
return ACTION(() => C.astFactory.updateOperationCreate(destination, Boolean(silent2), C.astFactory.sourceLocation(createToken3, destination)));
|
|
13964
14178
|
},
|
|
13965
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
14179
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
13966
14180
|
F2.printFilter(ast, () => {
|
|
13967
|
-
|
|
14181
|
+
PRINT_ON_EMPTY("CREATE ");
|
|
13968
14182
|
if (ast.silent) {
|
|
13969
14183
|
PRINT_WORD("SILENT");
|
|
13970
14184
|
}
|
|
@@ -13983,9 +14197,9 @@ function copyMoveAddOperation(operation) {
|
|
|
13983
14197
|
const destination = SUBRULE2(graphOrDefault);
|
|
13984
14198
|
return ACTION(() => C.astFactory.updateOperationAddMoveCopy(unCapitalize(operation.name), source, destination, Boolean(silent2), C.astFactory.sourceLocation(op, destination)));
|
|
13985
14199
|
},
|
|
13986
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
14200
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
13987
14201
|
F2.printFilter(ast, () => {
|
|
13988
|
-
|
|
14202
|
+
PRINT_ON_EMPTY(operation.name.toUpperCase(), " ");
|
|
13989
14203
|
if (ast.silent) {
|
|
13990
14204
|
PRINT_WORD("SILENT");
|
|
13991
14205
|
}
|
|
@@ -14034,23 +14248,24 @@ function insertDeleteDelWhere(name, subType, cons1, dataRule) {
|
|
|
14034
14248
|
}
|
|
14035
14249
|
return ACTION(() => C.astFactory.updateOperationInsDelDataWhere(subType, data.val, C.astFactory.sourceLocation(insDelToken, data)));
|
|
14036
14250
|
},
|
|
14037
|
-
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, C) => {
|
|
14251
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY, PRINT_ON_OWN_LINE, NEW_LINE }) => (ast, C) => {
|
|
14038
14252
|
const { astFactory: F2, indentInc } = C;
|
|
14039
14253
|
F2.printFilter(ast, () => {
|
|
14040
|
-
C[traqulaIndentation] += indentInc;
|
|
14041
14254
|
if (subType === "insertdata") {
|
|
14042
|
-
|
|
14255
|
+
PRINT_ON_EMPTY("INSERT DATA ");
|
|
14043
14256
|
} else if (subType === "deletedata") {
|
|
14044
|
-
|
|
14257
|
+
PRINT_ON_EMPTY("DELETE DATA ");
|
|
14045
14258
|
} else if (subType === "deletewhere") {
|
|
14046
|
-
|
|
14259
|
+
PRINT_ON_EMPTY("DELETE WHERE ");
|
|
14047
14260
|
}
|
|
14048
|
-
|
|
14261
|
+
C[traqulaIndentation] += indentInc;
|
|
14262
|
+
PRINT_WORD("{");
|
|
14263
|
+
NEW_LINE();
|
|
14049
14264
|
});
|
|
14050
14265
|
SUBRULE(quads, F2.wrap(ast.data, ast.loc));
|
|
14051
14266
|
F2.printFilter(ast, () => {
|
|
14052
14267
|
C[traqulaIndentation] -= indentInc;
|
|
14053
|
-
|
|
14268
|
+
PRINT_ON_OWN_LINE("}");
|
|
14054
14269
|
});
|
|
14055
14270
|
}
|
|
14056
14271
|
};
|
|
@@ -14082,36 +14297,40 @@ var modify = {
|
|
|
14082
14297
|
const where2 = SUBRULE1(groupGraphPattern);
|
|
14083
14298
|
return ACTION(() => C.astFactory.updateOperationModify(C.astFactory.sourceLocation(graph2?.withToken, del, insert, where2), insert?.val ?? [], del?.val ?? [], where2, using, graph2?.graph));
|
|
14084
14299
|
},
|
|
14085
|
-
gImpl: ({ SUBRULE,
|
|
14300
|
+
gImpl: ({ SUBRULE, PRINT_WORDS, PRINT_ON_EMPTY, NEW_LINE }) => (ast, C) => {
|
|
14086
14301
|
const { astFactory: F2, indentInc } = C;
|
|
14087
14302
|
if (ast.graph) {
|
|
14088
|
-
F2.printFilter(ast, () =>
|
|
14303
|
+
F2.printFilter(ast, () => PRINT_WORDS("WITH"));
|
|
14089
14304
|
SUBRULE(iri2, ast.graph);
|
|
14090
14305
|
}
|
|
14091
14306
|
if (ast.delete.length > 0) {
|
|
14092
14307
|
F2.printFilter(ast, () => {
|
|
14093
14308
|
C[traqulaIndentation] += indentInc;
|
|
14094
|
-
|
|
14309
|
+
PRINT_WORDS("DELETE", "{");
|
|
14310
|
+
NEW_LINE();
|
|
14095
14311
|
});
|
|
14096
14312
|
SUBRULE(quads, F2.wrap(ast.delete, ast.loc));
|
|
14097
14313
|
F2.printFilter(ast, () => {
|
|
14098
14314
|
C[traqulaIndentation] -= indentInc;
|
|
14099
|
-
PRINT_ON_EMPTY("}
|
|
14315
|
+
PRINT_ON_EMPTY("}");
|
|
14316
|
+
NEW_LINE();
|
|
14100
14317
|
});
|
|
14101
14318
|
}
|
|
14102
14319
|
if (ast.insert.length > 0) {
|
|
14103
14320
|
F2.printFilter(ast, () => {
|
|
14104
14321
|
C[traqulaIndentation] += indentInc;
|
|
14105
|
-
|
|
14322
|
+
PRINT_WORDS("INSERT", "{");
|
|
14323
|
+
NEW_LINE();
|
|
14106
14324
|
});
|
|
14107
14325
|
SUBRULE(quads, F2.wrap(ast.insert, ast.loc));
|
|
14108
14326
|
F2.printFilter(ast, () => {
|
|
14109
14327
|
C[traqulaIndentation] -= indentInc;
|
|
14110
|
-
PRINT_ON_EMPTY("}
|
|
14328
|
+
PRINT_ON_EMPTY("} ");
|
|
14329
|
+
NEW_LINE();
|
|
14111
14330
|
});
|
|
14112
14331
|
}
|
|
14113
14332
|
SUBRULE(usingClauseStar, ast.from);
|
|
14114
|
-
F2.printFilter(ast, () =>
|
|
14333
|
+
F2.printFilter(ast, () => PRINT_WORDS("WHERE"));
|
|
14115
14334
|
SUBRULE(groupGraphPattern, ast.where);
|
|
14116
14335
|
}
|
|
14117
14336
|
};
|
|
@@ -14235,18 +14454,19 @@ var quadsNotTriples = {
|
|
|
14235
14454
|
const close = CONSUME(symbols_exports.RCurly);
|
|
14236
14455
|
return ACTION(() => C.astFactory.graphQuads(name, triples ?? C.astFactory.patternBgp([], C.astFactory.sourceLocationNoMaterialize()), C.astFactory.sourceLocation(graph2, close)));
|
|
14237
14456
|
},
|
|
14238
|
-
gImpl: ({ SUBRULE, PRINT_WORD,
|
|
14457
|
+
gImpl: ({ SUBRULE, PRINT_WORD, NEW_LINE, PRINT_ON_OWN_LINE }) => (ast, C) => {
|
|
14239
14458
|
const { astFactory: F2, indentInc } = C;
|
|
14240
14459
|
F2.printFilter(ast, () => PRINT_WORD("GRAPH"));
|
|
14241
14460
|
SUBRULE(varOrTerm, ast.graph);
|
|
14242
14461
|
F2.printFilter(ast, () => {
|
|
14243
14462
|
C[traqulaIndentation] += indentInc;
|
|
14244
|
-
PRINT_WORD("{
|
|
14463
|
+
PRINT_WORD("{");
|
|
14464
|
+
NEW_LINE();
|
|
14245
14465
|
});
|
|
14246
14466
|
SUBRULE(triplesBlock, ast.triples);
|
|
14247
14467
|
F2.printFilter(ast, () => {
|
|
14248
14468
|
C[traqulaIndentation] -= indentInc;
|
|
14249
|
-
|
|
14469
|
+
PRINT_ON_OWN_LINE("}");
|
|
14250
14470
|
});
|
|
14251
14471
|
}
|
|
14252
14472
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@traqula/rules-sparql-1-1-adjust",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.21",
|
|
5
5
|
"description": "Traqula Lexer and Grammar Rules for sparql 1.1-ADJUST",
|
|
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.21",
|
|
46
|
+
"@traqula/rules-sparql-1-1": "^0.0.21"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "6e27b4bab942e473c11576196320bd52894ea5a4"
|
|
49
49
|
}
|