@traqula/rules-sparql-1-1-adjust 0.0.19 → 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/index.cjs +401 -189
- 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,31 @@ 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 {
|
|
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
|
+
/**
|
|
9781
|
+
* Function to shallow clone any type.
|
|
9782
|
+
* @param obj
|
|
9783
|
+
* @protected
|
|
9784
|
+
*/
|
|
9785
|
+
clone(obj) {
|
|
9786
|
+
if (obj === null || typeof obj !== "object") {
|
|
9787
|
+
return obj;
|
|
9782
9788
|
}
|
|
9783
|
-
|
|
9789
|
+
const proto = Object.getPrototypeOf(obj);
|
|
9790
|
+
if (proto === Object.prototype || proto === null) {
|
|
9791
|
+
return { ...obj };
|
|
9792
|
+
}
|
|
9793
|
+
return Object.assign(Object.create(proto), obj);
|
|
9784
9794
|
}
|
|
9785
9795
|
/**
|
|
9786
9796
|
* Recursively transforms all objects that are not arrays. Mapper is called on deeper objects first.
|
|
@@ -9792,90 +9802,228 @@ var TransformerType = class {
|
|
|
9792
9802
|
* - Default false
|
|
9793
9803
|
*/
|
|
9794
9804
|
transformObject(startObject, mapper, preVisitor = () => ({})) {
|
|
9805
|
+
const defaults2 = this.defaultContext;
|
|
9806
|
+
const defaultCopyFlag = defaults2.copy ?? true;
|
|
9807
|
+
const defaultContinues = defaults2.continue ?? true;
|
|
9808
|
+
const defaultIgnoreKeys = defaults2.ignoreKeys;
|
|
9809
|
+
const defaultShallowKeys = defaults2.shallowKeys;
|
|
9810
|
+
const defaultDidShortCut = defaults2.shortcut ?? false;
|
|
9795
9811
|
let didShortCut = false;
|
|
9796
|
-
const
|
|
9797
|
-
|
|
9798
|
-
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
|
|
9812
|
+
const resultWrap = { res: startObject };
|
|
9813
|
+
const stack = [startObject];
|
|
9814
|
+
const stackParent = [resultWrap];
|
|
9815
|
+
const stackParentKey = ["res"];
|
|
9816
|
+
const handleMapperOnLen = [];
|
|
9817
|
+
const mapperCopyStack = [];
|
|
9818
|
+
const mapperOrigStack = [];
|
|
9819
|
+
const mapperParent = [];
|
|
9820
|
+
const mapperParentKey = [];
|
|
9821
|
+
function handleMapper() {
|
|
9822
|
+
while (stack.length === handleMapperOnLen.at(-1)) {
|
|
9823
|
+
handleMapperOnLen.pop();
|
|
9824
|
+
const copyToMap = mapperCopyStack.pop();
|
|
9825
|
+
const origToMap = mapperOrigStack.pop();
|
|
9826
|
+
const parent = mapperParent.pop();
|
|
9827
|
+
const parentKey = mapperParentKey.pop();
|
|
9828
|
+
parent[parentKey] = mapper(copyToMap, origToMap);
|
|
9829
|
+
}
|
|
9830
|
+
}
|
|
9831
|
+
while (stack.length > 0 && stack.length < this.maxStackSize) {
|
|
9832
|
+
const curObject = stack.pop();
|
|
9833
|
+
const curParent = stackParent.pop();
|
|
9834
|
+
const curKey = stackParentKey.pop();
|
|
9835
|
+
if (!didShortCut) {
|
|
9836
|
+
if (Array.isArray(curObject)) {
|
|
9837
|
+
const newArr = [...curObject];
|
|
9838
|
+
handleMapperOnLen.push(stack.length);
|
|
9839
|
+
mapperCopyStack.push(newArr);
|
|
9840
|
+
mapperOrigStack.push(curObject);
|
|
9841
|
+
mapperParent.push(curParent);
|
|
9842
|
+
mapperParentKey.push(curKey);
|
|
9843
|
+
for (let index = curObject.length - 1; index >= 0; index--) {
|
|
9844
|
+
const val = curObject[index];
|
|
9845
|
+
if (val !== null && typeof val === "object") {
|
|
9846
|
+
stack.push(val);
|
|
9847
|
+
stackParent.push(newArr);
|
|
9848
|
+
stackParentKey.push(index.toString());
|
|
9849
|
+
}
|
|
9850
|
+
}
|
|
9851
|
+
handleMapper();
|
|
9852
|
+
continue;
|
|
9853
|
+
}
|
|
9854
|
+
const context = preVisitor(curObject);
|
|
9855
|
+
const copyFlag = context.copy ?? defaultCopyFlag;
|
|
9856
|
+
const continues = context.continue ?? defaultContinues;
|
|
9857
|
+
const ignoreKeys = context.ignoreKeys ?? defaultIgnoreKeys;
|
|
9858
|
+
const shallowKeys = context.shallowKeys ?? defaultShallowKeys;
|
|
9859
|
+
didShortCut = context.shortcut ?? defaultDidShortCut;
|
|
9860
|
+
const copy3 = copyFlag ? this.clone(curObject) : curObject;
|
|
9861
|
+
handleMapperOnLen.push(stack.length);
|
|
9862
|
+
mapperCopyStack.push(copy3);
|
|
9863
|
+
mapperOrigStack.push(curObject);
|
|
9864
|
+
mapperParent.push(curParent);
|
|
9865
|
+
mapperParentKey.push(curKey);
|
|
9866
|
+
if (continues && !didShortCut) {
|
|
9867
|
+
for (const key in copy3) {
|
|
9868
|
+
if (!Object.hasOwn(copy3, key)) {
|
|
9869
|
+
continue;
|
|
9870
|
+
}
|
|
9871
|
+
const val = copy3[key];
|
|
9872
|
+
const onlyShallow = shallowKeys && shallowKeys?.has(key);
|
|
9873
|
+
if (onlyShallow) {
|
|
9874
|
+
copy3[key] = this.clone(val);
|
|
9875
|
+
}
|
|
9876
|
+
if (ignoreKeys && ignoreKeys.has(key)) {
|
|
9877
|
+
continue;
|
|
9878
|
+
}
|
|
9879
|
+
if (!onlyShallow && val !== null && typeof val === "object") {
|
|
9880
|
+
stack.push(val);
|
|
9881
|
+
stackParentKey.push(key);
|
|
9882
|
+
stackParent.push(copy3);
|
|
9883
|
+
}
|
|
9805
9884
|
}
|
|
9806
|
-
copy3[key] = this.safeObjectVisit(value, (obj) => recurse(obj));
|
|
9807
9885
|
}
|
|
9808
9886
|
}
|
|
9809
|
-
|
|
9810
|
-
}
|
|
9811
|
-
|
|
9887
|
+
handleMapper();
|
|
9888
|
+
}
|
|
9889
|
+
if (stack.length >= this.maxStackSize) {
|
|
9890
|
+
throw new Error("Transform object stack overflowed");
|
|
9891
|
+
}
|
|
9892
|
+
handleMapper();
|
|
9893
|
+
return resultWrap.res;
|
|
9812
9894
|
}
|
|
9813
9895
|
/**
|
|
9814
9896
|
* Visitor that visits all objects. Visits deeper objects first.
|
|
9815
9897
|
*/
|
|
9816
9898
|
visitObject(startObject, visitor, preVisitor = () => ({})) {
|
|
9899
|
+
const defaults2 = this.defaultContext;
|
|
9900
|
+
const defaultContinues = defaults2.continue ?? true;
|
|
9901
|
+
const defaultIgnoreKeys = defaults2.ignoreKeys;
|
|
9902
|
+
const defaultShortcut = defaults2.shortcut ?? false;
|
|
9817
9903
|
let didShortCut = false;
|
|
9818
|
-
const
|
|
9819
|
-
|
|
9820
|
-
|
|
9821
|
-
|
|
9822
|
-
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
|
|
9904
|
+
const stack = [startObject];
|
|
9905
|
+
const handleVisitorOnLen = [];
|
|
9906
|
+
const visitorStack = [];
|
|
9907
|
+
function handleVisitor() {
|
|
9908
|
+
while (stack.length === handleVisitorOnLen.at(-1)) {
|
|
9909
|
+
handleVisitorOnLen.pop();
|
|
9910
|
+
const toVisit = visitorStack.pop();
|
|
9911
|
+
visitor(toVisit);
|
|
9912
|
+
}
|
|
9913
|
+
}
|
|
9914
|
+
while (stack.length > 0 && stack.length < this.maxStackSize) {
|
|
9915
|
+
const curObject = stack.pop();
|
|
9916
|
+
if (!didShortCut) {
|
|
9917
|
+
if (Array.isArray(curObject)) {
|
|
9918
|
+
for (let i = curObject.length - 1; i >= 0; i--) {
|
|
9919
|
+
stack.push(curObject[i]);
|
|
9920
|
+
}
|
|
9921
|
+
handleVisitor();
|
|
9922
|
+
continue;
|
|
9923
|
+
}
|
|
9924
|
+
const context = preVisitor(curObject);
|
|
9925
|
+
didShortCut = context.shortcut ?? defaultShortcut;
|
|
9926
|
+
const continues = context.continue ?? defaultContinues;
|
|
9927
|
+
const ignoreKeys = context.ignoreKeys ?? defaultIgnoreKeys;
|
|
9928
|
+
handleVisitorOnLen.push(stack.length);
|
|
9929
|
+
visitorStack.push(curObject);
|
|
9930
|
+
if (continues && !didShortCut) {
|
|
9931
|
+
for (const key in curObject) {
|
|
9932
|
+
if (!Object.hasOwn(curObject, key)) {
|
|
9933
|
+
continue;
|
|
9934
|
+
}
|
|
9935
|
+
if (ignoreKeys && ignoreKeys.has(key)) {
|
|
9936
|
+
continue;
|
|
9937
|
+
}
|
|
9938
|
+
const val = curObject[key];
|
|
9939
|
+
if (val && typeof val === "object") {
|
|
9940
|
+
stack.push(val);
|
|
9941
|
+
}
|
|
9826
9942
|
}
|
|
9827
|
-
this.safeObjectVisit(value, (obj) => recurse(obj));
|
|
9828
9943
|
}
|
|
9829
9944
|
}
|
|
9830
|
-
|
|
9831
|
-
}
|
|
9832
|
-
|
|
9945
|
+
handleVisitor();
|
|
9946
|
+
}
|
|
9947
|
+
if (stack.length >= this.maxStackSize) {
|
|
9948
|
+
throw new Error("Transform object stack overflowed");
|
|
9949
|
+
}
|
|
9950
|
+
handleVisitor();
|
|
9833
9951
|
}
|
|
9952
|
+
};
|
|
9953
|
+
|
|
9954
|
+
// ../core/lib/TransformerTyped.js
|
|
9955
|
+
var TransformerTyped = class extends TransformerObject {
|
|
9956
|
+
defaultNodePreVisitor;
|
|
9957
|
+
constructor(defaultContext = {}, defaultNodePreVisitor = {}) {
|
|
9958
|
+
super(defaultContext);
|
|
9959
|
+
this.defaultNodePreVisitor = defaultNodePreVisitor;
|
|
9960
|
+
}
|
|
9961
|
+
/**
|
|
9962
|
+
* Transform a single node.
|
|
9963
|
+
* The transformation calls the preVisitor from starting from the startObject.
|
|
9964
|
+
* The preVisitor can dictate whether transformation should be stopped.
|
|
9965
|
+
* Note that stopping the transformation also prevets further copying.
|
|
9966
|
+
* The transformer itself transforms object starting with the deepest one that can be visited.
|
|
9967
|
+
* The transformer callback is performed on a copy of the original.
|
|
9968
|
+
* @param startObject
|
|
9969
|
+
* @param nodeCallBacks
|
|
9970
|
+
*/
|
|
9834
9971
|
transformNode(startObject, nodeCallBacks) {
|
|
9835
|
-
const transformWrapper = (
|
|
9836
|
-
|
|
9972
|
+
const transformWrapper = (copy3, orig) => {
|
|
9973
|
+
let ogTransform;
|
|
9974
|
+
const casted = copy3;
|
|
9837
9975
|
if (casted.type) {
|
|
9838
|
-
|
|
9839
|
-
if (ogFunc) {
|
|
9840
|
-
return ogFunc(casted);
|
|
9841
|
-
}
|
|
9976
|
+
ogTransform = nodeCallBacks[casted.type]?.transform;
|
|
9842
9977
|
}
|
|
9843
|
-
return
|
|
9978
|
+
return ogTransform ? ogTransform(casted, orig) : copy3;
|
|
9844
9979
|
};
|
|
9845
|
-
const
|
|
9980
|
+
const nodeDefaults = this.defaultNodePreVisitor;
|
|
9981
|
+
const preVisitWrapper = (curObject) => {
|
|
9982
|
+
let ogPreVisit;
|
|
9983
|
+
let nodeContext = {};
|
|
9846
9984
|
const casted = curObject;
|
|
9847
9985
|
if (casted.type) {
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
return ogFunc(casted);
|
|
9851
|
-
}
|
|
9986
|
+
ogPreVisit = nodeCallBacks[casted.type]?.preVisitor;
|
|
9987
|
+
nodeContext = nodeDefaults[casted.type] ?? nodeContext;
|
|
9852
9988
|
}
|
|
9853
|
-
return {};
|
|
9989
|
+
return ogPreVisit ? { ...nodeContext, ...ogPreVisit(casted) } : nodeContext;
|
|
9854
9990
|
};
|
|
9855
|
-
return this.transformObject(startObject, transformWrapper,
|
|
9991
|
+
return this.transformObject(startObject, transformWrapper, preVisitWrapper);
|
|
9856
9992
|
}
|
|
9993
|
+
/**
|
|
9994
|
+
* Similar to {@link this.transformNode}, but without copying the startObject.
|
|
9995
|
+
* The pre-visitor visits starting from the root, going deeper, while the actual visitor goes in reverse.
|
|
9996
|
+
* @param startObject
|
|
9997
|
+
* @param nodeCallBacks
|
|
9998
|
+
*/
|
|
9857
9999
|
visitNode(startObject, nodeCallBacks) {
|
|
9858
|
-
const
|
|
10000
|
+
const visitorWrapper = (curObject) => {
|
|
9859
10001
|
const casted = curObject;
|
|
9860
10002
|
if (casted.type) {
|
|
9861
|
-
const
|
|
9862
|
-
if (
|
|
9863
|
-
|
|
10003
|
+
const ogTransform = nodeCallBacks[casted.type]?.visitor;
|
|
10004
|
+
if (ogTransform) {
|
|
10005
|
+
ogTransform(casted);
|
|
9864
10006
|
}
|
|
9865
10007
|
}
|
|
9866
10008
|
};
|
|
10009
|
+
const nodeDefaults = this.defaultNodePreVisitor;
|
|
9867
10010
|
const preVisitWrapper = (curObject) => {
|
|
10011
|
+
let ogPreVisit;
|
|
10012
|
+
let nodeContext = {};
|
|
9868
10013
|
const casted = curObject;
|
|
9869
10014
|
if (casted.type) {
|
|
9870
|
-
|
|
9871
|
-
|
|
9872
|
-
return ogFunc(casted);
|
|
9873
|
-
}
|
|
10015
|
+
ogPreVisit = nodeCallBacks[casted.type]?.preVisitor;
|
|
10016
|
+
nodeContext = nodeDefaults[casted.type] ?? nodeContext;
|
|
9874
10017
|
}
|
|
9875
|
-
return {};
|
|
10018
|
+
return ogPreVisit ? { ...nodeContext, ...ogPreVisit(casted) } : nodeContext;
|
|
9876
10019
|
};
|
|
9877
|
-
this.visitObject(startObject,
|
|
10020
|
+
return this.visitObject(startObject, visitorWrapper, preVisitWrapper);
|
|
9878
10021
|
}
|
|
10022
|
+
/**
|
|
10023
|
+
* Traverses only selected nodes as returned by the function.
|
|
10024
|
+
* @param currentNode
|
|
10025
|
+
* @param traverse
|
|
10026
|
+
*/
|
|
9879
10027
|
traverseNodes(currentNode, traverse) {
|
|
9880
10028
|
let didShortCut = false;
|
|
9881
10029
|
const recurse = (curNode) => {
|
|
@@ -9896,11 +10044,24 @@ var TransformerType = class {
|
|
|
9896
10044
|
recurse(currentNode);
|
|
9897
10045
|
}
|
|
9898
10046
|
};
|
|
9899
|
-
|
|
10047
|
+
|
|
10048
|
+
// ../core/lib/TransformerSubTyped.js
|
|
10049
|
+
var TransformerSubTyped = class extends TransformerTyped {
|
|
10050
|
+
constructor(defaultContext = {}, defaultNodePreVisitor = {}) {
|
|
10051
|
+
super(defaultContext, defaultNodePreVisitor);
|
|
10052
|
+
}
|
|
10053
|
+
/**
|
|
10054
|
+
* Shares the functionality and first two arguments with {@link this.transformNode}.
|
|
10055
|
+
* The third argument allows you to also transform based on the subType of objects.
|
|
10056
|
+
* Note that when a callback for the subtype is provided, the callback for the general type is **NOT** executed.
|
|
10057
|
+
* @param startObject
|
|
10058
|
+
* @param nodeCallBacks
|
|
10059
|
+
* @param nodeSpecificCallBacks
|
|
10060
|
+
*/
|
|
9900
10061
|
transformNodeSpecific(startObject, nodeCallBacks, nodeSpecificCallBacks) {
|
|
9901
|
-
const transformWrapper = (
|
|
10062
|
+
const transformWrapper = (copy3, orig) => {
|
|
9902
10063
|
let ogTransform;
|
|
9903
|
-
const casted =
|
|
10064
|
+
const casted = copy3;
|
|
9904
10065
|
if (casted.type && casted.subType) {
|
|
9905
10066
|
const specific = nodeSpecificCallBacks[casted.type];
|
|
9906
10067
|
if (specific) {
|
|
@@ -9910,7 +10071,7 @@ var TransformerSubType = class extends TransformerType {
|
|
|
9910
10071
|
ogTransform = nodeCallBacks[casted.type]?.transform;
|
|
9911
10072
|
}
|
|
9912
10073
|
}
|
|
9913
|
-
return ogTransform ? ogTransform(casted) :
|
|
10074
|
+
return ogTransform ? ogTransform(casted, orig) : copy3;
|
|
9914
10075
|
};
|
|
9915
10076
|
const preVisitWrapper = (curObject) => {
|
|
9916
10077
|
let ogPreVisit;
|
|
@@ -9924,12 +10085,13 @@ var TransformerSubType = class extends TransformerType {
|
|
|
9924
10085
|
ogPreVisit = nodeCallBacks[casted.type]?.preVisitor;
|
|
9925
10086
|
}
|
|
9926
10087
|
}
|
|
9927
|
-
return ogPreVisit ? ogPreVisit(casted) :
|
|
10088
|
+
return ogPreVisit ? ogPreVisit(casted) : {};
|
|
9928
10089
|
};
|
|
9929
10090
|
return this.transformObject(startObject, transformWrapper, preVisitWrapper);
|
|
9930
10091
|
}
|
|
9931
10092
|
/**
|
|
9932
|
-
*
|
|
10093
|
+
* Similar to {@link this.visitNode} but also allows you to match based on the subtype of objects.
|
|
10094
|
+
* When both nodeCallBack and NodeSpecific callBack are matched, will only visit nodeSpecifCallback
|
|
9933
10095
|
*/
|
|
9934
10096
|
visitNodeSpecific(startObject, nodeCallBacks, nodeSpecificCallBacks) {
|
|
9935
10097
|
const visitWrapper = (curObject) => {
|
|
@@ -9960,10 +10122,16 @@ var TransformerSubType = class extends TransformerType {
|
|
|
9960
10122
|
ogPreVisit = nodeCallBacks[casted.type]?.preVisitor;
|
|
9961
10123
|
}
|
|
9962
10124
|
}
|
|
9963
|
-
return ogPreVisit ? ogPreVisit(casted) :
|
|
10125
|
+
return ogPreVisit ? ogPreVisit(casted) : {};
|
|
9964
10126
|
};
|
|
9965
10127
|
this.visitObject(startObject, visitWrapper, preVisitWrapper);
|
|
9966
10128
|
}
|
|
10129
|
+
/**
|
|
10130
|
+
* Similar to {@link this.traverseNodes} but also allows you to match based on the subtype of objects.
|
|
10131
|
+
* @param currentNode
|
|
10132
|
+
* @param traverseNode
|
|
10133
|
+
* @param traverseSubNode
|
|
10134
|
+
*/
|
|
9967
10135
|
traverseSubNodes(currentNode, traverseNode, traverseSubNode) {
|
|
9968
10136
|
let didShortCut = false;
|
|
9969
10137
|
const recurse = (curNode) => {
|
|
@@ -10687,8 +10855,8 @@ function PatternFactoryMixin(Base) {
|
|
|
10687
10855
|
isPatternOptional(obj) {
|
|
10688
10856
|
return this.isOfSubType(obj, nodeType5, "optional");
|
|
10689
10857
|
}
|
|
10690
|
-
patternValues(values3, loc) {
|
|
10691
|
-
return { type: nodeType5, subType: "values", values: values3, loc };
|
|
10858
|
+
patternValues(variables, values3, loc) {
|
|
10859
|
+
return { type: nodeType5, subType: "values", variables, values: values3, loc };
|
|
10692
10860
|
}
|
|
10693
10861
|
isPatternValues(obj) {
|
|
10694
10862
|
return this.isOfSubType(obj, nodeType5, "values");
|
|
@@ -10863,7 +11031,7 @@ function TermFactoryMixin(Base) {
|
|
|
10863
11031
|
isTerm(x) {
|
|
10864
11032
|
return this.isOfType(x, "term");
|
|
10865
11033
|
}
|
|
10866
|
-
|
|
11034
|
+
termBlank(label, loc) {
|
|
10867
11035
|
const base = {
|
|
10868
11036
|
type: "term",
|
|
10869
11037
|
subType: "blankNode",
|
|
@@ -10877,7 +11045,7 @@ function TermFactoryMixin(Base) {
|
|
|
10877
11045
|
isTermBlank(obj) {
|
|
10878
11046
|
return this.isOfSubType(obj, nodeType8, "blankNode");
|
|
10879
11047
|
}
|
|
10880
|
-
|
|
11048
|
+
termLiteral(loc, value, langOrIri) {
|
|
10881
11049
|
return {
|
|
10882
11050
|
type: nodeType8,
|
|
10883
11051
|
subType: "literal",
|
|
@@ -10899,7 +11067,7 @@ function TermFactoryMixin(Base) {
|
|
|
10899
11067
|
const casted = obj;
|
|
10900
11068
|
return this.isTermLiteral(obj) && typeof casted.langOrIri === "object" && casted.langOrIri !== null && this.isTermNamed(casted.langOrIri);
|
|
10901
11069
|
}
|
|
10902
|
-
|
|
11070
|
+
termVariable(value, loc) {
|
|
10903
11071
|
return {
|
|
10904
11072
|
type: nodeType8,
|
|
10905
11073
|
subType: "variable",
|
|
@@ -10910,7 +11078,7 @@ function TermFactoryMixin(Base) {
|
|
|
10910
11078
|
isTermVariable(obj) {
|
|
10911
11079
|
return this.isOfSubType(obj, nodeType8, "variable");
|
|
10912
11080
|
}
|
|
10913
|
-
|
|
11081
|
+
termNamed(loc, value, prefix) {
|
|
10914
11082
|
const base = {
|
|
10915
11083
|
type: nodeType8,
|
|
10916
11084
|
subType: "namedNode",
|
|
@@ -11155,7 +11323,7 @@ var CommonIRIs;
|
|
|
11155
11323
|
CommonIRIs2["NIL"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil";
|
|
11156
11324
|
CommonIRIs2["TYPE"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
|
|
11157
11325
|
})(CommonIRIs || (CommonIRIs = {}));
|
|
11158
|
-
var AstTransformer = class extends
|
|
11326
|
+
var AstTransformer = class extends TransformerSubTyped {
|
|
11159
11327
|
};
|
|
11160
11328
|
|
|
11161
11329
|
// ../rules-sparql-1-1/lib/validation/validators.js
|
|
@@ -11371,17 +11539,20 @@ var rdfLiteral = {
|
|
|
11371
11539
|
return OPTION(() => OR([
|
|
11372
11540
|
{ ALT: () => {
|
|
11373
11541
|
const lang2 = CONSUME(terminals_exports.langTag);
|
|
11374
|
-
return ACTION(() => C.astFactory.
|
|
11542
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(value, lang2), value.value, lang2.image.slice(1).toLowerCase()));
|
|
11375
11543
|
} },
|
|
11376
11544
|
{ ALT: () => {
|
|
11377
11545
|
CONSUME(symbols_exports.hathat);
|
|
11378
11546
|
const iriVal = SUBRULE1(iri2);
|
|
11379
|
-
return ACTION(() => C.astFactory.
|
|
11547
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(value, iriVal), value.value, iriVal));
|
|
11380
11548
|
} }
|
|
11381
11549
|
])) ?? value;
|
|
11382
11550
|
},
|
|
11383
|
-
gImpl: ({ SUBRULE, PRINT,
|
|
11384
|
-
astFactory.printFilter(ast, () =>
|
|
11551
|
+
gImpl: ({ SUBRULE, PRINT, PRINT_WORD }) => (ast, { astFactory }) => {
|
|
11552
|
+
astFactory.printFilter(ast, () => {
|
|
11553
|
+
PRINT_WORD("");
|
|
11554
|
+
PRINT(stringEscapedLexical(ast.value));
|
|
11555
|
+
});
|
|
11385
11556
|
if (ast.langOrIri) {
|
|
11386
11557
|
if (typeof ast.langOrIri === "string") {
|
|
11387
11558
|
astFactory.printFilter(ast, () => PRINT("@", ast.langOrIri));
|
|
@@ -11408,7 +11579,7 @@ var numericLiteralUnsigned = {
|
|
|
11408
11579
|
{ ALT: () => [CONSUME(terminals_exports.decimal), CommonIRIs.DECIMAL] },
|
|
11409
11580
|
{ ALT: () => [CONSUME(terminals_exports.double), CommonIRIs.DOUBLE] }
|
|
11410
11581
|
]);
|
|
11411
|
-
return ACTION(() => C.astFactory.
|
|
11582
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(parsed[0]), parsed[0].image, C.astFactory.termNamed(C.astFactory.sourceLocationNoMaterialize(), parsed[1])));
|
|
11412
11583
|
}
|
|
11413
11584
|
};
|
|
11414
11585
|
var numericLiteralPositive = {
|
|
@@ -11419,7 +11590,7 @@ var numericLiteralPositive = {
|
|
|
11419
11590
|
{ ALT: () => [CONSUME(terminals_exports.decimalPositive), CommonIRIs.DECIMAL] },
|
|
11420
11591
|
{ ALT: () => [CONSUME(terminals_exports.doublePositive), CommonIRIs.DOUBLE] }
|
|
11421
11592
|
]);
|
|
11422
|
-
return ACTION(() => C.astFactory.
|
|
11593
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(parsed[0]), parsed[0].image, C.astFactory.termNamed(C.astFactory.sourceLocationNoMaterialize(), parsed[1])));
|
|
11423
11594
|
}
|
|
11424
11595
|
};
|
|
11425
11596
|
var numericLiteralNegative = {
|
|
@@ -11430,7 +11601,7 @@ var numericLiteralNegative = {
|
|
|
11430
11601
|
{ ALT: () => [CONSUME(terminals_exports.decimalNegative), CommonIRIs.DECIMAL] },
|
|
11431
11602
|
{ ALT: () => [CONSUME(terminals_exports.doubleNegative), CommonIRIs.DOUBLE] }
|
|
11432
11603
|
]);
|
|
11433
|
-
return ACTION(() => C.astFactory.
|
|
11604
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(parsed[0]), parsed[0].image, C.astFactory.termNamed(C.astFactory.sourceLocationNoMaterialize(), parsed[1])));
|
|
11434
11605
|
}
|
|
11435
11606
|
};
|
|
11436
11607
|
var booleanLiteral = {
|
|
@@ -11440,7 +11611,7 @@ var booleanLiteral = {
|
|
|
11440
11611
|
{ ALT: () => CONSUME(true_) },
|
|
11441
11612
|
{ ALT: () => CONSUME(false_) }
|
|
11442
11613
|
]);
|
|
11443
|
-
return ACTION(() => C.astFactory.
|
|
11614
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(token), token.image.toLowerCase(), C.astFactory.termNamed(C.astFactory.sourceLocationNoMaterialize(), CommonIRIs.BOOLEAN)));
|
|
11444
11615
|
}
|
|
11445
11616
|
};
|
|
11446
11617
|
var string = {
|
|
@@ -11482,7 +11653,7 @@ var string = {
|
|
|
11482
11653
|
return char;
|
|
11483
11654
|
}
|
|
11484
11655
|
});
|
|
11485
|
-
return F2.
|
|
11656
|
+
return F2.termLiteral(F2.sourceLocation(x[0]), value);
|
|
11486
11657
|
});
|
|
11487
11658
|
}
|
|
11488
11659
|
};
|
|
@@ -11498,7 +11669,7 @@ var iriFull = {
|
|
|
11498
11669
|
name: "iriFull",
|
|
11499
11670
|
impl: ({ ACTION, CONSUME }) => (C) => {
|
|
11500
11671
|
const iriToken = CONSUME(terminals_exports.iriRef);
|
|
11501
|
-
return ACTION(() => C.astFactory.
|
|
11672
|
+
return ACTION(() => C.astFactory.termNamed(C.astFactory.sourceLocation(iriToken), iriToken.image.slice(1, -1)));
|
|
11502
11673
|
},
|
|
11503
11674
|
gImpl: ({ PRINT }) => (ast, { astFactory: F2 }) => {
|
|
11504
11675
|
F2.printFilter(ast, () => PRINT("<", ast.value, ">"));
|
|
@@ -11511,16 +11682,16 @@ var prefixedName = {
|
|
|
11511
11682
|
const longName = CONSUME(terminals_exports.pNameLn);
|
|
11512
11683
|
return ACTION(() => {
|
|
11513
11684
|
const [prefix, localName] = longName.image.split(":");
|
|
11514
|
-
return C.astFactory.
|
|
11685
|
+
return C.astFactory.termNamed(C.astFactory.sourceLocation(longName), localName, prefix);
|
|
11515
11686
|
});
|
|
11516
11687
|
} },
|
|
11517
11688
|
{ ALT: () => {
|
|
11518
11689
|
const shortName = CONSUME(terminals_exports.pNameNs);
|
|
11519
|
-
return ACTION(() => C.astFactory.
|
|
11690
|
+
return ACTION(() => C.astFactory.termNamed(C.astFactory.sourceLocation(shortName), "", shortName.image.slice(0, -1)));
|
|
11520
11691
|
} }
|
|
11521
11692
|
]),
|
|
11522
|
-
gImpl: ({
|
|
11523
|
-
F2.printFilter(ast, () =>
|
|
11693
|
+
gImpl: ({ PRINT }) => (ast, { astFactory: F2 }) => {
|
|
11694
|
+
F2.printFilter(ast, () => PRINT(ast.prefix, ":", ast.value));
|
|
11524
11695
|
}
|
|
11525
11696
|
};
|
|
11526
11697
|
var canCreateBlankNodes = Symbol("canCreateBlankNodes");
|
|
@@ -11530,11 +11701,11 @@ var blankNode = {
|
|
|
11530
11701
|
const result = OR([
|
|
11531
11702
|
{ ALT: () => {
|
|
11532
11703
|
const labelToken = CONSUME(terminals_exports.blankNodeLabel);
|
|
11533
|
-
return ACTION(() => C.astFactory.
|
|
11704
|
+
return ACTION(() => C.astFactory.termBlank(labelToken.image.slice(2), C.astFactory.sourceLocation(labelToken)));
|
|
11534
11705
|
} },
|
|
11535
11706
|
{ ALT: () => {
|
|
11536
11707
|
const anonToken = CONSUME(terminals_exports.anon);
|
|
11537
|
-
return ACTION(() => C.astFactory.
|
|
11708
|
+
return ACTION(() => C.astFactory.termBlank(void 0, C.astFactory.sourceLocation(anonToken)));
|
|
11538
11709
|
} }
|
|
11539
11710
|
]);
|
|
11540
11711
|
ACTION(() => {
|
|
@@ -11544,15 +11715,15 @@ var blankNode = {
|
|
|
11544
11715
|
});
|
|
11545
11716
|
return result;
|
|
11546
11717
|
},
|
|
11547
|
-
gImpl: ({
|
|
11548
|
-
astFactory.printFilter(ast, () =>
|
|
11718
|
+
gImpl: ({ PRINT }) => (ast, { astFactory }) => {
|
|
11719
|
+
astFactory.printFilter(ast, () => PRINT("_:", ast.label.replace(/^e_/u, "")));
|
|
11549
11720
|
}
|
|
11550
11721
|
};
|
|
11551
11722
|
var verbA = {
|
|
11552
11723
|
name: "VerbA",
|
|
11553
11724
|
impl: ({ ACTION, CONSUME }) => (C) => {
|
|
11554
11725
|
const token = CONSUME(a);
|
|
11555
|
-
return ACTION(() => C.astFactory.
|
|
11726
|
+
return ACTION(() => C.astFactory.termNamed(C.astFactory.sourceLocation(token), CommonIRIs.TYPE, void 0));
|
|
11556
11727
|
}
|
|
11557
11728
|
};
|
|
11558
11729
|
|
|
@@ -11586,10 +11757,10 @@ var baseDecl2 = {
|
|
|
11586
11757
|
const val = SUBRULE(iriFull);
|
|
11587
11758
|
return ACTION(() => C.astFactory.contextDefinitionBase(C.astFactory.sourceLocation(base, val), val));
|
|
11588
11759
|
},
|
|
11589
|
-
gImpl: ({ SUBRULE,
|
|
11590
|
-
F2.printFilter(ast, () =>
|
|
11760
|
+
gImpl: ({ SUBRULE, PRINT_ON_EMPTY, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
11761
|
+
F2.printFilter(ast, () => PRINT_ON_EMPTY("BASE "));
|
|
11591
11762
|
SUBRULE(iri2, ast.value);
|
|
11592
|
-
F2.printFilter(ast, () =>
|
|
11763
|
+
F2.printFilter(ast, () => NEW_LINE());
|
|
11593
11764
|
}
|
|
11594
11765
|
};
|
|
11595
11766
|
var prefixDecl2 = {
|
|
@@ -11600,12 +11771,12 @@ var prefixDecl2 = {
|
|
|
11600
11771
|
const value = SUBRULE(iriFull);
|
|
11601
11772
|
return ACTION(() => C.astFactory.contextDefinitionPrefix(C.astFactory.sourceLocation(prefix, value), name, value));
|
|
11602
11773
|
},
|
|
11603
|
-
gImpl: ({ SUBRULE,
|
|
11774
|
+
gImpl: ({ SUBRULE, PRINT_ON_EMPTY, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
11604
11775
|
F2.printFilter(ast, () => {
|
|
11605
|
-
|
|
11776
|
+
PRINT_ON_EMPTY("PREFIX ", `${ast.key}: `);
|
|
11606
11777
|
});
|
|
11607
11778
|
SUBRULE(iri2, ast.value);
|
|
11608
|
-
F2.printFilter(ast, () =>
|
|
11779
|
+
F2.printFilter(ast, () => NEW_LINE());
|
|
11609
11780
|
}
|
|
11610
11781
|
};
|
|
11611
11782
|
var verb = {
|
|
@@ -11642,10 +11813,10 @@ var var_ = {
|
|
|
11642
11813
|
{ ALT: () => CONSUME(terminals_exports.var1) },
|
|
11643
11814
|
{ ALT: () => CONSUME(terminals_exports.var2) }
|
|
11644
11815
|
]);
|
|
11645
|
-
return ACTION(() => C.astFactory.
|
|
11816
|
+
return ACTION(() => C.astFactory.termVariable(varToken.image.slice(1), C.astFactory.sourceLocation(varToken)));
|
|
11646
11817
|
},
|
|
11647
|
-
gImpl: ({
|
|
11648
|
-
F2.printFilter(ast, () =>
|
|
11818
|
+
gImpl: ({ PRINT }) => (ast, { astFactory: F2 }) => {
|
|
11819
|
+
F2.printFilter(ast, () => PRINT(`?${ast.value}`));
|
|
11649
11820
|
}
|
|
11650
11821
|
};
|
|
11651
11822
|
var graphTerm = {
|
|
@@ -11658,7 +11829,7 @@ var graphTerm = {
|
|
|
11658
11829
|
{ GATE: () => C.parseMode.has("canCreateBlankNodes"), ALT: () => SUBRULE(blankNode) },
|
|
11659
11830
|
{ ALT: () => {
|
|
11660
11831
|
const tokenNil = CONSUME(terminals_exports.nil);
|
|
11661
|
-
return ACTION(() => C.astFactory.
|
|
11832
|
+
return ACTION(() => C.astFactory.termNamed(C.astFactory.sourceLocation(tokenNil), CommonIRIs.NIL));
|
|
11662
11833
|
} }
|
|
11663
11834
|
]),
|
|
11664
11835
|
gImpl: ({ SUBRULE }) => (ast, { astFactory: F2 }) => {
|
|
@@ -12288,13 +12459,16 @@ function triplesDotSeperated(triplesSameSubjectSubrule) {
|
|
|
12288
12459
|
var triplesBlock = {
|
|
12289
12460
|
name: "triplesBlock",
|
|
12290
12461
|
impl: (implArgs) => (C) => triplesDotSeperated(triplesSameSubjectPath)(implArgs)(C),
|
|
12291
|
-
gImpl: ({ SUBRULE, PRINT_WORD, HANDLE_LOC }) => (ast, { astFactory: F2 }) => {
|
|
12462
|
+
gImpl: ({ SUBRULE, PRINT_WORD, HANDLE_LOC, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
12292
12463
|
for (const [index, triple] of ast.triples.entries()) {
|
|
12293
12464
|
HANDLE_LOC(triple, () => {
|
|
12294
12465
|
const nextTriple = ast.triples.at(index);
|
|
12295
12466
|
if (F2.isTripleCollection(triple)) {
|
|
12296
12467
|
SUBRULE(graphNodePath, triple);
|
|
12297
|
-
F2.printFilter(triple, () =>
|
|
12468
|
+
F2.printFilter(triple, () => {
|
|
12469
|
+
PRINT_WORD(".");
|
|
12470
|
+
NEW_LINE();
|
|
12471
|
+
});
|
|
12298
12472
|
} else {
|
|
12299
12473
|
SUBRULE(graphNodePath, triple.subject);
|
|
12300
12474
|
F2.printFilter(triple, () => PRINT_WORD(""));
|
|
@@ -12306,11 +12480,17 @@ var triplesBlock = {
|
|
|
12306
12480
|
F2.printFilter(triple, () => PRINT_WORD(""));
|
|
12307
12481
|
SUBRULE(graphNodePath, triple.object);
|
|
12308
12482
|
if (nextTriple === void 0 || F2.isTripleCollection(nextTriple) || !F2.isSourceLocationNoMaterialize(nextTriple.subject.loc)) {
|
|
12309
|
-
F2.printFilter(ast, () =>
|
|
12483
|
+
F2.printFilter(ast, () => {
|
|
12484
|
+
PRINT_WORD(".");
|
|
12485
|
+
NEW_LINE();
|
|
12486
|
+
});
|
|
12310
12487
|
} else if (F2.isSourceLocationNoMaterialize(nextTriple.predicate.loc)) {
|
|
12311
12488
|
F2.printFilter(ast, () => PRINT_WORD(","));
|
|
12312
12489
|
} else {
|
|
12313
|
-
F2.printFilter(ast, () =>
|
|
12490
|
+
F2.printFilter(ast, () => {
|
|
12491
|
+
PRINT_WORD(";");
|
|
12492
|
+
NEW_LINE();
|
|
12493
|
+
});
|
|
12314
12494
|
}
|
|
12315
12495
|
}
|
|
12316
12496
|
});
|
|
@@ -12443,10 +12623,10 @@ function collectionImpl(name, allowPaths) {
|
|
|
12443
12623
|
return ACTION(() => {
|
|
12444
12624
|
const F2 = C.astFactory;
|
|
12445
12625
|
const triples = [];
|
|
12446
|
-
const predFirst = F2.
|
|
12447
|
-
const predRest = F2.
|
|
12448
|
-
const predNil = F2.
|
|
12449
|
-
const listHead = F2.
|
|
12626
|
+
const predFirst = F2.termNamed(F2.sourceLocationNoMaterialize(), CommonIRIs.FIRST, void 0);
|
|
12627
|
+
const predRest = F2.termNamed(F2.sourceLocationNoMaterialize(), CommonIRIs.REST, void 0);
|
|
12628
|
+
const predNil = F2.termNamed(F2.sourceLocationNoMaterialize(), CommonIRIs.NIL, void 0);
|
|
12629
|
+
const listHead = F2.termBlank(void 0, F2.sourceLocationNoMaterialize());
|
|
12450
12630
|
let iterHead = listHead;
|
|
12451
12631
|
for (const [index, term] of terms.entries()) {
|
|
12452
12632
|
const lastInList = index === terms.length - 1;
|
|
@@ -12456,7 +12636,7 @@ function collectionImpl(name, allowPaths) {
|
|
|
12456
12636
|
const nilTriple = F2.triple(iterHead, predRest, predNil);
|
|
12457
12637
|
triples.push(nilTriple);
|
|
12458
12638
|
} else {
|
|
12459
|
-
const tail = F2.
|
|
12639
|
+
const tail = F2.termBlank(void 0, F2.sourceLocationNoMaterialize());
|
|
12460
12640
|
const linkTriple = F2.triple(iterHead, predRest, tail);
|
|
12461
12641
|
triples.push(linkTriple);
|
|
12462
12642
|
iterHead = tail;
|
|
@@ -12496,16 +12676,17 @@ function blankNodePropertyListImpl(name, allowPaths) {
|
|
|
12496
12676
|
name,
|
|
12497
12677
|
impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
|
|
12498
12678
|
const startToken = CONSUME(symbols_exports.LSquare);
|
|
12499
|
-
const blankNode2 = ACTION(() => C.astFactory.
|
|
12679
|
+
const blankNode2 = ACTION(() => C.astFactory.termBlank(void 0, C.astFactory.sourceLocationNoMaterialize()));
|
|
12500
12680
|
const propList = SUBRULE(propertyPathNotEmptyImpl, blankNode2);
|
|
12501
12681
|
const endToken = CONSUME(symbols_exports.RSquare);
|
|
12502
12682
|
return ACTION(() => C.astFactory.tripleCollectionBlankNodeProperties(blankNode2, propList, C.astFactory.sourceLocation(startToken, endToken)));
|
|
12503
12683
|
},
|
|
12504
|
-
gImpl: ({ SUBRULE, PRINT, PRINT_WORD, HANDLE_LOC, PRINT_ON_EMPTY }) => (ast, c) => {
|
|
12684
|
+
gImpl: ({ SUBRULE, PRINT, PRINT_WORD, HANDLE_LOC, PRINT_ON_EMPTY, NEW_LINE }) => (ast, c) => {
|
|
12505
12685
|
const { astFactory: F2, indentInc } = c;
|
|
12506
12686
|
F2.printFilter(ast, () => {
|
|
12507
12687
|
c[traqulaIndentation] += indentInc;
|
|
12508
|
-
PRINT("[
|
|
12688
|
+
PRINT("[");
|
|
12689
|
+
NEW_LINE();
|
|
12509
12690
|
});
|
|
12510
12691
|
for (const triple of ast.triples) {
|
|
12511
12692
|
HANDLE_LOC(triple, () => {
|
|
@@ -12516,7 +12697,10 @@ function blankNodePropertyListImpl(name, allowPaths) {
|
|
|
12516
12697
|
}
|
|
12517
12698
|
F2.printFilter(triple, () => PRINT_WORD(""));
|
|
12518
12699
|
SUBRULE(graphNodePath, triple.object);
|
|
12519
|
-
F2.printFilter(ast, () =>
|
|
12700
|
+
F2.printFilter(ast, () => {
|
|
12701
|
+
PRINT_WORD(";");
|
|
12702
|
+
NEW_LINE();
|
|
12703
|
+
});
|
|
12520
12704
|
});
|
|
12521
12705
|
}
|
|
12522
12706
|
F2.printFilter(ast, () => {
|
|
@@ -12575,18 +12759,19 @@ var groupGraphPattern = {
|
|
|
12575
12759
|
const close = CONSUME(symbols_exports.RCurly);
|
|
12576
12760
|
return ACTION(() => C.astFactory.patternGroup(patterns, C.astFactory.sourceLocation(open, close)));
|
|
12577
12761
|
},
|
|
12578
|
-
gImpl: ({ SUBRULE, PRINT_WORD,
|
|
12762
|
+
gImpl: ({ SUBRULE, PRINT_WORD, NEW_LINE, PRINT_ON_OWN_LINE }) => (ast, C) => {
|
|
12579
12763
|
const { astFactory: F2, indentInc } = C;
|
|
12580
12764
|
F2.printFilter(ast, () => {
|
|
12581
12765
|
C[traqulaIndentation] += indentInc;
|
|
12582
|
-
PRINT_WORD("{
|
|
12766
|
+
PRINT_WORD("{");
|
|
12767
|
+
NEW_LINE();
|
|
12583
12768
|
});
|
|
12584
12769
|
for (const pattern of ast.patterns) {
|
|
12585
12770
|
SUBRULE(generatePattern, pattern);
|
|
12586
12771
|
}
|
|
12587
12772
|
F2.printFilter(ast, () => {
|
|
12588
12773
|
C[traqulaIndentation] -= indentInc;
|
|
12589
|
-
|
|
12774
|
+
PRINT_ON_OWN_LINE("}");
|
|
12590
12775
|
});
|
|
12591
12776
|
}
|
|
12592
12777
|
};
|
|
@@ -12736,12 +12921,15 @@ var bind2 = {
|
|
|
12736
12921
|
const close = CONSUME(symbols_exports.RParen);
|
|
12737
12922
|
return ACTION(() => C.astFactory.patternBind(expressionVal, variable, C.astFactory.sourceLocation(bind3, close)));
|
|
12738
12923
|
},
|
|
12739
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
12924
|
+
gImpl: ({ SUBRULE, PRINT_WORD, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
12740
12925
|
F2.printFilter(ast, () => PRINT_WORD("BIND", "("));
|
|
12741
12926
|
SUBRULE(expression, ast.expression);
|
|
12742
12927
|
F2.printFilter(ast, () => PRINT_WORD("AS"));
|
|
12743
12928
|
SUBRULE(var_, ast.variable);
|
|
12744
|
-
F2.printFilter(ast, () =>
|
|
12929
|
+
F2.printFilter(ast, () => {
|
|
12930
|
+
PRINT_WORD(")");
|
|
12931
|
+
NEW_LINE();
|
|
12932
|
+
});
|
|
12745
12933
|
}
|
|
12746
12934
|
};
|
|
12747
12935
|
var inlineData = {
|
|
@@ -12749,34 +12937,46 @@ var inlineData = {
|
|
|
12749
12937
|
impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
|
|
12750
12938
|
const values3 = CONSUME(values2);
|
|
12751
12939
|
const datablock = SUBRULE(dataBlock);
|
|
12752
|
-
return ACTION(() =>
|
|
12940
|
+
return ACTION(() => {
|
|
12941
|
+
datablock.loc = C.astFactory.sourceLocation(values3, datablock);
|
|
12942
|
+
return datablock;
|
|
12943
|
+
});
|
|
12753
12944
|
},
|
|
12754
|
-
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, C) => {
|
|
12945
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY, NEW_LINE, PRINT_ON_OWN_LINE }) => (ast, C) => {
|
|
12755
12946
|
const { astFactory: F2, indentInc } = C;
|
|
12756
|
-
const variables =
|
|
12947
|
+
const variables = ast.variables;
|
|
12948
|
+
const singleVar = variables.length === 1;
|
|
12949
|
+
F2.printFilter(ast, () => {
|
|
12950
|
+
PRINT_ON_EMPTY("VALUES", singleVar ? "" : "( ");
|
|
12951
|
+
});
|
|
12952
|
+
for (const variable of variables) {
|
|
12953
|
+
F2.printFilter(ast, () => PRINT_WORD(""));
|
|
12954
|
+
SUBRULE(varOrTerm, variable);
|
|
12955
|
+
F2.printFilter(ast, () => PRINT_WORD(""));
|
|
12956
|
+
}
|
|
12757
12957
|
F2.printFilter(ast, () => {
|
|
12758
|
-
PRINT_ON_EMPTY("");
|
|
12759
|
-
PRINT_WORD("VALUES", "(");
|
|
12760
|
-
for (const variable of variables) {
|
|
12761
|
-
PRINT_WORD(`?${variable}`);
|
|
12762
|
-
}
|
|
12763
12958
|
C[traqulaIndentation] += indentInc;
|
|
12764
|
-
PRINT_WORD(")", "{
|
|
12959
|
+
PRINT_WORD(singleVar ? "" : ")", "{");
|
|
12960
|
+
NEW_LINE();
|
|
12765
12961
|
});
|
|
12766
12962
|
for (const mapping of ast.values) {
|
|
12767
|
-
F2.printFilter(ast, () => PRINT_WORD("("));
|
|
12963
|
+
F2.printFilter(ast, () => !singleVar && PRINT_WORD("("));
|
|
12768
12964
|
for (const variable of variables) {
|
|
12769
|
-
|
|
12965
|
+
const var_2 = variable.value;
|
|
12966
|
+
if (mapping[var_2] === void 0) {
|
|
12770
12967
|
F2.printFilter(ast, () => PRINT_WORD("UNDEF"));
|
|
12771
12968
|
} else {
|
|
12772
|
-
SUBRULE(graphNodePath, mapping[
|
|
12969
|
+
SUBRULE(graphNodePath, mapping[var_2]);
|
|
12773
12970
|
}
|
|
12774
12971
|
}
|
|
12775
|
-
F2.printFilter(ast, () =>
|
|
12972
|
+
F2.printFilter(ast, () => {
|
|
12973
|
+
PRINT_WORD(singleVar ? "" : ")");
|
|
12974
|
+
NEW_LINE();
|
|
12975
|
+
});
|
|
12776
12976
|
}
|
|
12777
12977
|
F2.printFilter(ast, () => {
|
|
12778
12978
|
C[traqulaIndentation] -= indentInc;
|
|
12779
|
-
|
|
12979
|
+
PRINT_ON_OWN_LINE("}");
|
|
12780
12980
|
});
|
|
12781
12981
|
}
|
|
12782
12982
|
};
|
|
@@ -12800,7 +13000,7 @@ var inlineDataOneVar = {
|
|
|
12800
13000
|
});
|
|
12801
13001
|
});
|
|
12802
13002
|
const close = CONSUME(symbols_exports.RCurly);
|
|
12803
|
-
return ACTION(() => C.astFactory.
|
|
13003
|
+
return ACTION(() => C.astFactory.patternValues([varVal], res, C.astFactory.sourceLocation(varVal, close)));
|
|
12804
13004
|
}
|
|
12805
13005
|
};
|
|
12806
13006
|
var inlineDataFull = {
|
|
@@ -12817,7 +13017,7 @@ var inlineDataFull = {
|
|
|
12817
13017
|
res.push({});
|
|
12818
13018
|
});
|
|
12819
13019
|
const close = CONSUME1(symbols_exports.RCurly);
|
|
12820
|
-
return ACTION(() => C.astFactory.
|
|
13020
|
+
return ACTION(() => C.astFactory.patternValues(vars, res, C.astFactory.sourceLocation(nil2, close)));
|
|
12821
13021
|
} },
|
|
12822
13022
|
{ ALT: () => {
|
|
12823
13023
|
const open = CONSUME1(symbols_exports.LParen);
|
|
@@ -12849,7 +13049,7 @@ var inlineDataFull = {
|
|
|
12849
13049
|
});
|
|
12850
13050
|
});
|
|
12851
13051
|
const close = CONSUME2(symbols_exports.RCurly);
|
|
12852
|
-
return ACTION(() => C.astFactory.
|
|
13052
|
+
return ACTION(() => C.astFactory.patternValues(vars, res, C.astFactory.sourceLocation(open, close)));
|
|
12853
13053
|
} }
|
|
12854
13054
|
]);
|
|
12855
13055
|
}
|
|
@@ -12912,10 +13112,13 @@ var filter3 = {
|
|
|
12912
13112
|
const expression2 = SUBRULE(constraint);
|
|
12913
13113
|
return ACTION(() => C.astFactory.patternFilter(expression2, C.astFactory.sourceLocation(filterToken, expression2)));
|
|
12914
13114
|
},
|
|
12915
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
13115
|
+
gImpl: ({ SUBRULE, PRINT_WORD, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
12916
13116
|
F2.printFilter(ast, () => PRINT_WORD("FILTER ("));
|
|
12917
13117
|
SUBRULE(expression, ast.expression);
|
|
12918
|
-
F2.printFilter(ast, () =>
|
|
13118
|
+
F2.printFilter(ast, () => {
|
|
13119
|
+
PRINT_WORD(")");
|
|
13120
|
+
NEW_LINE();
|
|
13121
|
+
});
|
|
12919
13122
|
}
|
|
12920
13123
|
};
|
|
12921
13124
|
var constraint = {
|
|
@@ -13301,8 +13504,7 @@ var groupClause = {
|
|
|
13301
13504
|
},
|
|
13302
13505
|
gImpl: ({ PRINT_WORDS, SUBRULE, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
13303
13506
|
F2.printFilter(ast, () => {
|
|
13304
|
-
PRINT_ON_EMPTY("");
|
|
13305
|
-
PRINT_WORDS("GROUP", "BY");
|
|
13507
|
+
PRINT_ON_EMPTY("GROUP BY ");
|
|
13306
13508
|
});
|
|
13307
13509
|
for (const grouping of ast.groupings) {
|
|
13308
13510
|
if (F2.isExpression(grouping)) {
|
|
@@ -13358,10 +13560,9 @@ var havingClause = {
|
|
|
13358
13560
|
ACTION(() => !couldParseAgg && C.parseMode.delete("canParseAggregate"));
|
|
13359
13561
|
return ACTION(() => C.astFactory.solutionModifierHaving(expressions, C.astFactory.sourceLocation(having2, expressions.at(-1))));
|
|
13360
13562
|
},
|
|
13361
|
-
gImpl: ({
|
|
13563
|
+
gImpl: ({ PRINT_ON_EMPTY, SUBRULE }) => (ast, { astFactory: F2 }) => {
|
|
13362
13564
|
F2.printFilter(ast, () => {
|
|
13363
|
-
PRINT_ON_EMPTY("");
|
|
13364
|
-
PRINT_WORD("HAVING");
|
|
13565
|
+
PRINT_ON_EMPTY("HAVING ");
|
|
13365
13566
|
});
|
|
13366
13567
|
for (const having2 of ast.having) {
|
|
13367
13568
|
SUBRULE(expression, having2);
|
|
@@ -13387,8 +13588,7 @@ var orderClause = {
|
|
|
13387
13588
|
},
|
|
13388
13589
|
gImpl: ({ PRINT_WORDS, PRINT_ON_EMPTY, SUBRULE }) => (ast, { astFactory: F2 }) => {
|
|
13389
13590
|
F2.printFilter(ast, () => {
|
|
13390
|
-
PRINT_ON_EMPTY("");
|
|
13391
|
-
PRINT_WORDS("ORDER", "BY");
|
|
13591
|
+
PRINT_ON_EMPTY("ORDER BY ");
|
|
13392
13592
|
});
|
|
13393
13593
|
for (const ordering of ast.orderDefs) {
|
|
13394
13594
|
if (ordering.descending) {
|
|
@@ -13447,9 +13647,9 @@ var limitOffsetClauses = {
|
|
|
13447
13647
|
return ACTION(() => C.astFactory.solutionModifierLimitOffset(limit2?.val, offset2.val, C.astFactory.sourceLocation(offset2, limit2)));
|
|
13448
13648
|
} }
|
|
13449
13649
|
]),
|
|
13450
|
-
gImpl: ({ PRINT_WORDS,
|
|
13650
|
+
gImpl: ({ PRINT_WORDS, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
13451
13651
|
F2.printFilter(ast, () => {
|
|
13452
|
-
|
|
13652
|
+
NEW_LINE();
|
|
13453
13653
|
if (ast.limit) {
|
|
13454
13654
|
PRINT_WORDS("LIMIT", String(ast.limit));
|
|
13455
13655
|
}
|
|
@@ -13634,9 +13834,9 @@ var selectClause = {
|
|
|
13634
13834
|
ACTION(() => !couldParseAgg && C.parseMode.delete("canParseAggregate"));
|
|
13635
13835
|
return ACTION(() => C.astFactory.wrap(val, C.astFactory.sourceLocation(select2, last2)));
|
|
13636
13836
|
},
|
|
13637
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
13837
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
13638
13838
|
F2.printFilter(ast, () => {
|
|
13639
|
-
|
|
13839
|
+
PRINT_ON_EMPTY("SELECT ");
|
|
13640
13840
|
if (ast.val.distinct) {
|
|
13641
13841
|
PRINT_WORD("DISTINCT");
|
|
13642
13842
|
} else if (ast.val.reduced) {
|
|
@@ -13655,7 +13855,9 @@ var selectClause = {
|
|
|
13655
13855
|
SUBRULE(var_, variable.variable);
|
|
13656
13856
|
F2.printFilter(ast, () => PRINT_WORD(")"));
|
|
13657
13857
|
}
|
|
13858
|
+
F2.printFilter(ast, () => PRINT_WORD(""));
|
|
13658
13859
|
}
|
|
13860
|
+
F2.printFilter(ast, () => PRINT_WORD(""));
|
|
13659
13861
|
}
|
|
13660
13862
|
};
|
|
13661
13863
|
var constructQuery = {
|
|
@@ -13693,18 +13895,19 @@ var constructQuery = {
|
|
|
13693
13895
|
} }
|
|
13694
13896
|
]);
|
|
13695
13897
|
},
|
|
13696
|
-
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, C) => {
|
|
13898
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY, PRINT_ON_OWN_LINE, NEW_LINE }) => (ast, C) => {
|
|
13697
13899
|
const { astFactory: F2, indentInc } = C;
|
|
13698
|
-
F2.printFilter(ast, () =>
|
|
13900
|
+
F2.printFilter(ast, () => PRINT_ON_EMPTY("CONSTRUCT "));
|
|
13699
13901
|
if (!F2.isSourceLocationNoMaterialize(ast.where.loc)) {
|
|
13700
13902
|
F2.printFilter(ast, () => {
|
|
13701
13903
|
C[traqulaIndentation] += indentInc;
|
|
13702
|
-
PRINT_WORD("{
|
|
13904
|
+
PRINT_WORD("{");
|
|
13905
|
+
NEW_LINE();
|
|
13703
13906
|
});
|
|
13704
13907
|
SUBRULE(triplesBlock, ast.template);
|
|
13705
13908
|
F2.printFilter(ast, () => {
|
|
13706
13909
|
C[traqulaIndentation] -= indentInc;
|
|
13707
|
-
|
|
13910
|
+
PRINT_ON_OWN_LINE("}");
|
|
13708
13911
|
});
|
|
13709
13912
|
}
|
|
13710
13913
|
SUBRULE(datasetClauseStar, ast.datasets);
|
|
@@ -13745,8 +13948,8 @@ var describeQuery = {
|
|
|
13745
13948
|
loc: C.astFactory.sourceLocation(describe2, ...variables, from2, where2, modifiers.group, modifiers.having, modifiers.order, modifiers.limitOffset)
|
|
13746
13949
|
}));
|
|
13747
13950
|
},
|
|
13748
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
13749
|
-
F2.printFilter(ast, () =>
|
|
13951
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
13952
|
+
F2.printFilter(ast, () => PRINT_ON_EMPTY("DESCRIBE "));
|
|
13750
13953
|
if (F2.isWildcard(ast.variables[0])) {
|
|
13751
13954
|
F2.printFilter(ast, () => PRINT_WORD("*"));
|
|
13752
13955
|
} else {
|
|
@@ -13776,8 +13979,8 @@ var askQuery = {
|
|
|
13776
13979
|
loc: C.astFactory.sourceLocation(ask2, from2, where2, modifiers.group, modifiers.having, modifiers.order, modifiers.limitOffset)
|
|
13777
13980
|
}));
|
|
13778
13981
|
},
|
|
13779
|
-
gImpl: ({ SUBRULE,
|
|
13780
|
-
F2.printFilter(ast, () =>
|
|
13982
|
+
gImpl: ({ SUBRULE, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
13983
|
+
F2.printFilter(ast, () => PRINT_ON_EMPTY("ASK "));
|
|
13781
13984
|
SUBRULE(datasetClauseStar, ast.datasets);
|
|
13782
13985
|
SUBRULE(whereClause, F2.wrap(ast.where, ast.loc));
|
|
13783
13986
|
SUBRULE(solutionModifier, ast.solutionModifiers);
|
|
@@ -13836,7 +14039,7 @@ var update = {
|
|
|
13836
14039
|
return update2;
|
|
13837
14040
|
});
|
|
13838
14041
|
},
|
|
13839
|
-
gImpl: ({ SUBRULE,
|
|
14042
|
+
gImpl: ({ SUBRULE, PRINT, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
13840
14043
|
const [head2, ...tail] = ast.updates;
|
|
13841
14044
|
if (head2) {
|
|
13842
14045
|
SUBRULE(prologue, head2.context);
|
|
@@ -13845,7 +14048,10 @@ var update = {
|
|
|
13845
14048
|
}
|
|
13846
14049
|
}
|
|
13847
14050
|
for (const update2 of tail) {
|
|
13848
|
-
F2.printFilter(ast, () =>
|
|
14051
|
+
F2.printFilter(ast, () => {
|
|
14052
|
+
PRINT(";");
|
|
14053
|
+
NEW_LINE();
|
|
14054
|
+
});
|
|
13849
14055
|
SUBRULE(prologue, update2.context);
|
|
13850
14056
|
if (update2.operation) {
|
|
13851
14057
|
SUBRULE(update1, update2.operation);
|
|
@@ -13918,9 +14124,9 @@ var load2 = {
|
|
|
13918
14124
|
});
|
|
13919
14125
|
return ACTION(() => C.astFactory.updateOperationLoad(C.astFactory.sourceLocation(loadToken, source, destination), source, Boolean(silent2), destination));
|
|
13920
14126
|
},
|
|
13921
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
14127
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
13922
14128
|
F2.printFilter(ast, () => {
|
|
13923
|
-
|
|
14129
|
+
PRINT_ON_EMPTY("LOAD ");
|
|
13924
14130
|
if (ast.silent) {
|
|
13925
14131
|
PRINT_WORD("SILENT");
|
|
13926
14132
|
}
|
|
@@ -13941,9 +14147,9 @@ function clearOrDrop(operation) {
|
|
|
13941
14147
|
const destination = SUBRULE1(graphRefAll);
|
|
13942
14148
|
return ACTION(() => C.astFactory.updateOperationClearDrop(unCapitalize(operation.name), Boolean(silent2), destination, C.astFactory.sourceLocation(opToken, destination)));
|
|
13943
14149
|
},
|
|
13944
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
14150
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
13945
14151
|
F2.printFilter(ast, () => {
|
|
13946
|
-
|
|
14152
|
+
PRINT_ON_EMPTY(operation.name.toUpperCase(), " ");
|
|
13947
14153
|
if (ast.silent) {
|
|
13948
14154
|
PRINT_WORD("SILENT");
|
|
13949
14155
|
}
|
|
@@ -13962,9 +14168,9 @@ var create2 = {
|
|
|
13962
14168
|
const destination = SUBRULE1(graphRef);
|
|
13963
14169
|
return ACTION(() => C.astFactory.updateOperationCreate(destination, Boolean(silent2), C.astFactory.sourceLocation(createToken3, destination)));
|
|
13964
14170
|
},
|
|
13965
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
14171
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
13966
14172
|
F2.printFilter(ast, () => {
|
|
13967
|
-
|
|
14173
|
+
PRINT_ON_EMPTY("CREATE ");
|
|
13968
14174
|
if (ast.silent) {
|
|
13969
14175
|
PRINT_WORD("SILENT");
|
|
13970
14176
|
}
|
|
@@ -13983,9 +14189,9 @@ function copyMoveAddOperation(operation) {
|
|
|
13983
14189
|
const destination = SUBRULE2(graphOrDefault);
|
|
13984
14190
|
return ACTION(() => C.astFactory.updateOperationAddMoveCopy(unCapitalize(operation.name), source, destination, Boolean(silent2), C.astFactory.sourceLocation(op, destination)));
|
|
13985
14191
|
},
|
|
13986
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
14192
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
13987
14193
|
F2.printFilter(ast, () => {
|
|
13988
|
-
|
|
14194
|
+
PRINT_ON_EMPTY(operation.name.toUpperCase(), " ");
|
|
13989
14195
|
if (ast.silent) {
|
|
13990
14196
|
PRINT_WORD("SILENT");
|
|
13991
14197
|
}
|
|
@@ -14034,23 +14240,24 @@ function insertDeleteDelWhere(name, subType, cons1, dataRule) {
|
|
|
14034
14240
|
}
|
|
14035
14241
|
return ACTION(() => C.astFactory.updateOperationInsDelDataWhere(subType, data.val, C.astFactory.sourceLocation(insDelToken, data)));
|
|
14036
14242
|
},
|
|
14037
|
-
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, C) => {
|
|
14243
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY, PRINT_ON_OWN_LINE, NEW_LINE }) => (ast, C) => {
|
|
14038
14244
|
const { astFactory: F2, indentInc } = C;
|
|
14039
14245
|
F2.printFilter(ast, () => {
|
|
14040
|
-
C[traqulaIndentation] += indentInc;
|
|
14041
14246
|
if (subType === "insertdata") {
|
|
14042
|
-
|
|
14247
|
+
PRINT_ON_EMPTY("INSERT DATA ");
|
|
14043
14248
|
} else if (subType === "deletedata") {
|
|
14044
|
-
|
|
14249
|
+
PRINT_ON_EMPTY("DELETE DATA ");
|
|
14045
14250
|
} else if (subType === "deletewhere") {
|
|
14046
|
-
|
|
14251
|
+
PRINT_ON_EMPTY("DELETE WHERE ");
|
|
14047
14252
|
}
|
|
14048
|
-
|
|
14253
|
+
C[traqulaIndentation] += indentInc;
|
|
14254
|
+
PRINT_WORD("{");
|
|
14255
|
+
NEW_LINE();
|
|
14049
14256
|
});
|
|
14050
14257
|
SUBRULE(quads, F2.wrap(ast.data, ast.loc));
|
|
14051
14258
|
F2.printFilter(ast, () => {
|
|
14052
14259
|
C[traqulaIndentation] -= indentInc;
|
|
14053
|
-
|
|
14260
|
+
PRINT_ON_OWN_LINE("}");
|
|
14054
14261
|
});
|
|
14055
14262
|
}
|
|
14056
14263
|
};
|
|
@@ -14082,36 +14289,40 @@ var modify = {
|
|
|
14082
14289
|
const where2 = SUBRULE1(groupGraphPattern);
|
|
14083
14290
|
return ACTION(() => C.astFactory.updateOperationModify(C.astFactory.sourceLocation(graph2?.withToken, del, insert, where2), insert?.val ?? [], del?.val ?? [], where2, using, graph2?.graph));
|
|
14084
14291
|
},
|
|
14085
|
-
gImpl: ({ SUBRULE,
|
|
14292
|
+
gImpl: ({ SUBRULE, PRINT_WORDS, PRINT_ON_EMPTY, NEW_LINE }) => (ast, C) => {
|
|
14086
14293
|
const { astFactory: F2, indentInc } = C;
|
|
14087
14294
|
if (ast.graph) {
|
|
14088
|
-
F2.printFilter(ast, () =>
|
|
14295
|
+
F2.printFilter(ast, () => PRINT_WORDS("WITH"));
|
|
14089
14296
|
SUBRULE(iri2, ast.graph);
|
|
14090
14297
|
}
|
|
14091
14298
|
if (ast.delete.length > 0) {
|
|
14092
14299
|
F2.printFilter(ast, () => {
|
|
14093
14300
|
C[traqulaIndentation] += indentInc;
|
|
14094
|
-
|
|
14301
|
+
PRINT_WORDS("DELETE", "{");
|
|
14302
|
+
NEW_LINE();
|
|
14095
14303
|
});
|
|
14096
14304
|
SUBRULE(quads, F2.wrap(ast.delete, ast.loc));
|
|
14097
14305
|
F2.printFilter(ast, () => {
|
|
14098
14306
|
C[traqulaIndentation] -= indentInc;
|
|
14099
|
-
PRINT_ON_EMPTY("}
|
|
14307
|
+
PRINT_ON_EMPTY("}");
|
|
14308
|
+
NEW_LINE();
|
|
14100
14309
|
});
|
|
14101
14310
|
}
|
|
14102
14311
|
if (ast.insert.length > 0) {
|
|
14103
14312
|
F2.printFilter(ast, () => {
|
|
14104
14313
|
C[traqulaIndentation] += indentInc;
|
|
14105
|
-
|
|
14314
|
+
PRINT_WORDS("INSERT", "{");
|
|
14315
|
+
NEW_LINE();
|
|
14106
14316
|
});
|
|
14107
14317
|
SUBRULE(quads, F2.wrap(ast.insert, ast.loc));
|
|
14108
14318
|
F2.printFilter(ast, () => {
|
|
14109
14319
|
C[traqulaIndentation] -= indentInc;
|
|
14110
|
-
PRINT_ON_EMPTY("}
|
|
14320
|
+
PRINT_ON_EMPTY("} ");
|
|
14321
|
+
NEW_LINE();
|
|
14111
14322
|
});
|
|
14112
14323
|
}
|
|
14113
14324
|
SUBRULE(usingClauseStar, ast.from);
|
|
14114
|
-
F2.printFilter(ast, () =>
|
|
14325
|
+
F2.printFilter(ast, () => PRINT_WORDS("WHERE"));
|
|
14115
14326
|
SUBRULE(groupGraphPattern, ast.where);
|
|
14116
14327
|
}
|
|
14117
14328
|
};
|
|
@@ -14235,18 +14446,19 @@ var quadsNotTriples = {
|
|
|
14235
14446
|
const close = CONSUME(symbols_exports.RCurly);
|
|
14236
14447
|
return ACTION(() => C.astFactory.graphQuads(name, triples ?? C.astFactory.patternBgp([], C.astFactory.sourceLocationNoMaterialize()), C.astFactory.sourceLocation(graph2, close)));
|
|
14237
14448
|
},
|
|
14238
|
-
gImpl: ({ SUBRULE, PRINT_WORD,
|
|
14449
|
+
gImpl: ({ SUBRULE, PRINT_WORD, NEW_LINE, PRINT_ON_OWN_LINE }) => (ast, C) => {
|
|
14239
14450
|
const { astFactory: F2, indentInc } = C;
|
|
14240
14451
|
F2.printFilter(ast, () => PRINT_WORD("GRAPH"));
|
|
14241
14452
|
SUBRULE(varOrTerm, ast.graph);
|
|
14242
14453
|
F2.printFilter(ast, () => {
|
|
14243
14454
|
C[traqulaIndentation] += indentInc;
|
|
14244
|
-
PRINT_WORD("{
|
|
14455
|
+
PRINT_WORD("{");
|
|
14456
|
+
NEW_LINE();
|
|
14245
14457
|
});
|
|
14246
14458
|
SUBRULE(triplesBlock, ast.triples);
|
|
14247
14459
|
F2.printFilter(ast, () => {
|
|
14248
14460
|
C[traqulaIndentation] -= indentInc;
|
|
14249
|
-
|
|
14461
|
+
PRINT_ON_OWN_LINE("}");
|
|
14250
14462
|
});
|
|
14251
14463
|
}
|
|
14252
14464
|
};
|
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.20",
|
|
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.20",
|
|
46
|
+
"@traqula/rules-sparql-1-1": "^0.0.20"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "caf35c28d4ddbfec5947566b697d34f38c1e6e31"
|
|
49
49
|
}
|