@traqula/rules-sparql-1-1 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/Sparql11types.d.ts +1 -0
- package/lib/Sparql11types.js.map +1 -1
- package/lib/astFactory.d.ts +9 -9
- package/lib/factoryMixins/Patternfactory.d.ts +1 -1
- package/lib/factoryMixins/Patternfactory.js +2 -2
- package/lib/factoryMixins/Patternfactory.js.map +1 -1
- package/lib/factoryMixins/TermFactory.d.ts +8 -8
- package/lib/factoryMixins/TermFactory.js +4 -4
- package/lib/factoryMixins/TermFactory.js.map +1 -1
- package/lib/grammar/general.js +10 -10
- package/lib/grammar/general.js.map +1 -1
- package/lib/grammar/literals.js +22 -19
- package/lib/grammar/literals.js.map +1 -1
- package/lib/grammar/queryUnit.js +13 -10
- package/lib/grammar/queryUnit.js.map +1 -1
- package/lib/grammar/solutionModifier.js +6 -9
- package/lib/grammar/solutionModifier.js.map +1 -1
- package/lib/grammar/tripleBlock.js +26 -13
- package/lib/grammar/tripleBlock.js.map +1 -1
- package/lib/grammar/updateUnit.js +36 -27
- package/lib/grammar/updateUnit.js.map +1 -1
- package/lib/grammar/whereClause.d.ts +4 -4
- package/lib/grammar/whereClause.js +43 -24
- package/lib/grammar/whereClause.js.map +1 -1
- package/lib/index.cjs +411 -191
- package/lib/sparql11HelperTypes.d.ts +1 -0
- package/lib/sparql11HelperTypes.js.map +1 -1
- package/lib/utils.d.ts +2 -2
- package/lib/utils.js +2 -2
- package/lib/utils.js.map +1 -1
- package/lib/validation/validators.js +0 -1
- package/lib/validation/validators.js.map +1 -1
- package/package.json +3 -3
package/lib/index.cjs
CHANGED
|
@@ -414,7 +414,7 @@ var AstCoreFactory = class {
|
|
|
414
414
|
if (filtered.length === 0) {
|
|
415
415
|
return this.gen();
|
|
416
416
|
}
|
|
417
|
-
const first2 = filtered
|
|
417
|
+
const first2 = filtered.at(0);
|
|
418
418
|
const last2 = filtered.at(-1);
|
|
419
419
|
return {
|
|
420
420
|
sourceLocationType: "source",
|
|
@@ -9841,21 +9841,34 @@ var LexerBuilder = class _LexerBuilder {
|
|
|
9841
9841
|
}
|
|
9842
9842
|
};
|
|
9843
9843
|
|
|
9844
|
-
// ../core/lib/
|
|
9845
|
-
var
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9844
|
+
// ../core/lib/TransformerObject.js
|
|
9845
|
+
var TransformerObject = class _TransformerObject {
|
|
9846
|
+
defaultContext;
|
|
9847
|
+
maxStackSize = 1e6;
|
|
9848
|
+
/**
|
|
9849
|
+
* Creates stateless transformer.
|
|
9850
|
+
* @param defaultContext
|
|
9851
|
+
*/
|
|
9852
|
+
constructor(defaultContext = {}) {
|
|
9853
|
+
this.defaultContext = defaultContext;
|
|
9850
9854
|
}
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9855
|
-
|
|
9856
|
-
|
|
9855
|
+
clone(newDefaultContext = {}) {
|
|
9856
|
+
return new _TransformerObject({ ...this.defaultContext, ...newDefaultContext });
|
|
9857
|
+
}
|
|
9858
|
+
/**
|
|
9859
|
+
* Function to shallow clone any type.
|
|
9860
|
+
* @param obj
|
|
9861
|
+
* @protected
|
|
9862
|
+
*/
|
|
9863
|
+
cloneObj(obj) {
|
|
9864
|
+
if (obj === null || typeof obj !== "object") {
|
|
9865
|
+
return obj;
|
|
9857
9866
|
}
|
|
9858
|
-
|
|
9867
|
+
const proto = Object.getPrototypeOf(obj);
|
|
9868
|
+
if (proto === Object.prototype || proto === null) {
|
|
9869
|
+
return { ...obj };
|
|
9870
|
+
}
|
|
9871
|
+
return Object.assign(Object.create(proto), obj);
|
|
9859
9872
|
}
|
|
9860
9873
|
/**
|
|
9861
9874
|
* Recursively transforms all objects that are not arrays. Mapper is called on deeper objects first.
|
|
@@ -9867,90 +9880,231 @@ var TransformerType = class {
|
|
|
9867
9880
|
* - Default false
|
|
9868
9881
|
*/
|
|
9869
9882
|
transformObject(startObject, mapper, preVisitor = () => ({})) {
|
|
9883
|
+
const defaults2 = this.defaultContext;
|
|
9884
|
+
const defaultCopyFlag = defaults2.copy ?? true;
|
|
9885
|
+
const defaultContinues = defaults2.continue ?? true;
|
|
9886
|
+
const defaultIgnoreKeys = defaults2.ignoreKeys;
|
|
9887
|
+
const defaultShallowKeys = defaults2.shallowKeys;
|
|
9888
|
+
const defaultDidShortCut = defaults2.shortcut ?? false;
|
|
9870
9889
|
let didShortCut = false;
|
|
9871
|
-
const
|
|
9872
|
-
|
|
9873
|
-
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
|
|
9890
|
+
const resultWrap = { res: startObject };
|
|
9891
|
+
const stack = [startObject];
|
|
9892
|
+
const stackParent = [resultWrap];
|
|
9893
|
+
const stackParentKey = ["res"];
|
|
9894
|
+
const handleMapperOnLen = [];
|
|
9895
|
+
const mapperCopyStack = [];
|
|
9896
|
+
const mapperOrigStack = [];
|
|
9897
|
+
const mapperParent = [];
|
|
9898
|
+
const mapperParentKey = [];
|
|
9899
|
+
function handleMapper() {
|
|
9900
|
+
while (stack.length === handleMapperOnLen.at(-1)) {
|
|
9901
|
+
handleMapperOnLen.pop();
|
|
9902
|
+
const copyToMap = mapperCopyStack.pop();
|
|
9903
|
+
const origToMap = mapperOrigStack.pop();
|
|
9904
|
+
const parent = mapperParent.pop();
|
|
9905
|
+
const parentKey = mapperParentKey.pop();
|
|
9906
|
+
parent[parentKey] = mapper(copyToMap, origToMap);
|
|
9907
|
+
}
|
|
9908
|
+
}
|
|
9909
|
+
while (stack.length > 0 && stack.length < this.maxStackSize) {
|
|
9910
|
+
const curObject = stack.pop();
|
|
9911
|
+
const curParent = stackParent.pop();
|
|
9912
|
+
const curKey = stackParentKey.pop();
|
|
9913
|
+
if (!didShortCut) {
|
|
9914
|
+
if (Array.isArray(curObject)) {
|
|
9915
|
+
const newArr = [...curObject];
|
|
9916
|
+
handleMapperOnLen.push(stack.length);
|
|
9917
|
+
mapperCopyStack.push(newArr);
|
|
9918
|
+
mapperOrigStack.push(curObject);
|
|
9919
|
+
mapperParent.push(curParent);
|
|
9920
|
+
mapperParentKey.push(curKey);
|
|
9921
|
+
for (let index = curObject.length - 1; index >= 0; index--) {
|
|
9922
|
+
const val = curObject[index];
|
|
9923
|
+
if (val !== null && typeof val === "object") {
|
|
9924
|
+
stack.push(val);
|
|
9925
|
+
stackParent.push(newArr);
|
|
9926
|
+
stackParentKey.push(index.toString());
|
|
9927
|
+
}
|
|
9928
|
+
}
|
|
9929
|
+
handleMapper();
|
|
9930
|
+
continue;
|
|
9931
|
+
}
|
|
9932
|
+
const context = preVisitor(curObject);
|
|
9933
|
+
const copyFlag = context.copy ?? defaultCopyFlag;
|
|
9934
|
+
const continues = context.continue ?? defaultContinues;
|
|
9935
|
+
const ignoreKeys = context.ignoreKeys ?? defaultIgnoreKeys;
|
|
9936
|
+
const shallowKeys = context.shallowKeys ?? defaultShallowKeys;
|
|
9937
|
+
didShortCut = context.shortcut ?? defaultDidShortCut;
|
|
9938
|
+
const copy3 = copyFlag ? this.cloneObj(curObject) : curObject;
|
|
9939
|
+
handleMapperOnLen.push(stack.length);
|
|
9940
|
+
mapperCopyStack.push(copy3);
|
|
9941
|
+
mapperOrigStack.push(curObject);
|
|
9942
|
+
mapperParent.push(curParent);
|
|
9943
|
+
mapperParentKey.push(curKey);
|
|
9944
|
+
if (continues && !didShortCut) {
|
|
9945
|
+
for (const key in copy3) {
|
|
9946
|
+
if (!Object.hasOwn(copy3, key)) {
|
|
9947
|
+
continue;
|
|
9948
|
+
}
|
|
9949
|
+
const val = copy3[key];
|
|
9950
|
+
const onlyShallow = shallowKeys && shallowKeys?.has(key);
|
|
9951
|
+
if (onlyShallow) {
|
|
9952
|
+
copy3[key] = this.cloneObj(val);
|
|
9953
|
+
}
|
|
9954
|
+
if (ignoreKeys && ignoreKeys.has(key)) {
|
|
9955
|
+
continue;
|
|
9956
|
+
}
|
|
9957
|
+
if (!onlyShallow && val !== null && typeof val === "object") {
|
|
9958
|
+
stack.push(val);
|
|
9959
|
+
stackParentKey.push(key);
|
|
9960
|
+
stackParent.push(copy3);
|
|
9961
|
+
}
|
|
9880
9962
|
}
|
|
9881
|
-
copy3[key] = this.safeObjectVisit(value, (obj) => recurse(obj));
|
|
9882
9963
|
}
|
|
9883
9964
|
}
|
|
9884
|
-
|
|
9885
|
-
}
|
|
9886
|
-
|
|
9965
|
+
handleMapper();
|
|
9966
|
+
}
|
|
9967
|
+
if (stack.length >= this.maxStackSize) {
|
|
9968
|
+
throw new Error("Transform object stack overflowed");
|
|
9969
|
+
}
|
|
9970
|
+
handleMapper();
|
|
9971
|
+
return resultWrap.res;
|
|
9887
9972
|
}
|
|
9888
9973
|
/**
|
|
9889
9974
|
* Visitor that visits all objects. Visits deeper objects first.
|
|
9890
9975
|
*/
|
|
9891
9976
|
visitObject(startObject, visitor, preVisitor = () => ({})) {
|
|
9977
|
+
const defaults2 = this.defaultContext;
|
|
9978
|
+
const defaultContinues = defaults2.continue ?? true;
|
|
9979
|
+
const defaultIgnoreKeys = defaults2.ignoreKeys;
|
|
9980
|
+
const defaultShortcut = defaults2.shortcut ?? false;
|
|
9892
9981
|
let didShortCut = false;
|
|
9893
|
-
const
|
|
9894
|
-
|
|
9895
|
-
|
|
9896
|
-
|
|
9897
|
-
|
|
9898
|
-
|
|
9899
|
-
|
|
9900
|
-
|
|
9982
|
+
const stack = [startObject];
|
|
9983
|
+
const handleVisitorOnLen = [];
|
|
9984
|
+
const visitorStack = [];
|
|
9985
|
+
function handleVisitor() {
|
|
9986
|
+
while (stack.length === handleVisitorOnLen.at(-1)) {
|
|
9987
|
+
handleVisitorOnLen.pop();
|
|
9988
|
+
const toVisit = visitorStack.pop();
|
|
9989
|
+
visitor(toVisit);
|
|
9990
|
+
}
|
|
9991
|
+
}
|
|
9992
|
+
while (stack.length > 0 && stack.length < this.maxStackSize) {
|
|
9993
|
+
const curObject = stack.pop();
|
|
9994
|
+
if (!didShortCut) {
|
|
9995
|
+
if (Array.isArray(curObject)) {
|
|
9996
|
+
for (let i = curObject.length - 1; i >= 0; i--) {
|
|
9997
|
+
stack.push(curObject[i]);
|
|
9998
|
+
}
|
|
9999
|
+
handleVisitor();
|
|
10000
|
+
continue;
|
|
10001
|
+
}
|
|
10002
|
+
const context = preVisitor(curObject);
|
|
10003
|
+
didShortCut = context.shortcut ?? defaultShortcut;
|
|
10004
|
+
const continues = context.continue ?? defaultContinues;
|
|
10005
|
+
const ignoreKeys = context.ignoreKeys ?? defaultIgnoreKeys;
|
|
10006
|
+
handleVisitorOnLen.push(stack.length);
|
|
10007
|
+
visitorStack.push(curObject);
|
|
10008
|
+
if (continues && !didShortCut) {
|
|
10009
|
+
for (const key in curObject) {
|
|
10010
|
+
if (!Object.hasOwn(curObject, key)) {
|
|
10011
|
+
continue;
|
|
10012
|
+
}
|
|
10013
|
+
if (ignoreKeys && ignoreKeys.has(key)) {
|
|
10014
|
+
continue;
|
|
10015
|
+
}
|
|
10016
|
+
const val = curObject[key];
|
|
10017
|
+
if (val && typeof val === "object") {
|
|
10018
|
+
stack.push(val);
|
|
10019
|
+
}
|
|
9901
10020
|
}
|
|
9902
|
-
this.safeObjectVisit(value, (obj) => recurse(obj));
|
|
9903
10021
|
}
|
|
9904
10022
|
}
|
|
9905
|
-
|
|
9906
|
-
}
|
|
9907
|
-
|
|
10023
|
+
handleVisitor();
|
|
10024
|
+
}
|
|
10025
|
+
if (stack.length >= this.maxStackSize) {
|
|
10026
|
+
throw new Error("Transform object stack overflowed");
|
|
10027
|
+
}
|
|
10028
|
+
handleVisitor();
|
|
9908
10029
|
}
|
|
10030
|
+
};
|
|
10031
|
+
|
|
10032
|
+
// ../core/lib/TransformerTyped.js
|
|
10033
|
+
var TransformerTyped = class _TransformerTyped extends TransformerObject {
|
|
10034
|
+
defaultNodePreVisitor;
|
|
10035
|
+
constructor(defaultContext = {}, defaultNodePreVisitor = {}) {
|
|
10036
|
+
super(defaultContext);
|
|
10037
|
+
this.defaultNodePreVisitor = defaultNodePreVisitor;
|
|
10038
|
+
}
|
|
10039
|
+
clone(newDefaultContext = {}, newDefaultNodePreVisitor = {}) {
|
|
10040
|
+
return new _TransformerTyped({ ...this.defaultContext, ...newDefaultContext }, { ...this.defaultNodePreVisitor, ...newDefaultNodePreVisitor });
|
|
10041
|
+
}
|
|
10042
|
+
/**
|
|
10043
|
+
* Transform a single node.
|
|
10044
|
+
* The transformation calls the preVisitor from starting from the startObject.
|
|
10045
|
+
* The preVisitor can dictate whether transformation should be stopped.
|
|
10046
|
+
* Note that stopping the transformation also prevets further copying.
|
|
10047
|
+
* The transformer itself transforms object starting with the deepest one that can be visited.
|
|
10048
|
+
* The transformer callback is performed on a copy of the original.
|
|
10049
|
+
* @param startObject
|
|
10050
|
+
* @param nodeCallBacks
|
|
10051
|
+
*/
|
|
9909
10052
|
transformNode(startObject, nodeCallBacks) {
|
|
9910
|
-
const transformWrapper = (
|
|
9911
|
-
|
|
10053
|
+
const transformWrapper = (copy3, orig) => {
|
|
10054
|
+
let ogTransform;
|
|
10055
|
+
const casted = copy3;
|
|
9912
10056
|
if (casted.type) {
|
|
9913
|
-
|
|
9914
|
-
if (ogFunc) {
|
|
9915
|
-
return ogFunc(casted);
|
|
9916
|
-
}
|
|
10057
|
+
ogTransform = nodeCallBacks[casted.type]?.transform;
|
|
9917
10058
|
}
|
|
9918
|
-
return
|
|
10059
|
+
return ogTransform ? ogTransform(casted, orig) : copy3;
|
|
9919
10060
|
};
|
|
9920
|
-
const
|
|
10061
|
+
const nodeDefaults = this.defaultNodePreVisitor;
|
|
10062
|
+
const preVisitWrapper = (curObject) => {
|
|
10063
|
+
let ogPreVisit;
|
|
10064
|
+
let nodeContext = {};
|
|
9921
10065
|
const casted = curObject;
|
|
9922
10066
|
if (casted.type) {
|
|
9923
|
-
|
|
9924
|
-
|
|
9925
|
-
return ogFunc(casted);
|
|
9926
|
-
}
|
|
10067
|
+
ogPreVisit = nodeCallBacks[casted.type]?.preVisitor;
|
|
10068
|
+
nodeContext = nodeDefaults[casted.type] ?? nodeContext;
|
|
9927
10069
|
}
|
|
9928
|
-
return {};
|
|
10070
|
+
return ogPreVisit ? { ...nodeContext, ...ogPreVisit(casted) } : nodeContext;
|
|
9929
10071
|
};
|
|
9930
|
-
return this.transformObject(startObject, transformWrapper,
|
|
10072
|
+
return this.transformObject(startObject, transformWrapper, preVisitWrapper);
|
|
9931
10073
|
}
|
|
10074
|
+
/**
|
|
10075
|
+
* Similar to {@link this.transformNode}, but without copying the startObject.
|
|
10076
|
+
* The pre-visitor visits starting from the root, going deeper, while the actual visitor goes in reverse.
|
|
10077
|
+
* @param startObject
|
|
10078
|
+
* @param nodeCallBacks
|
|
10079
|
+
*/
|
|
9932
10080
|
visitNode(startObject, nodeCallBacks) {
|
|
9933
|
-
const
|
|
10081
|
+
const visitorWrapper = (curObject) => {
|
|
9934
10082
|
const casted = curObject;
|
|
9935
10083
|
if (casted.type) {
|
|
9936
|
-
const
|
|
9937
|
-
if (
|
|
9938
|
-
|
|
10084
|
+
const ogTransform = nodeCallBacks[casted.type]?.visitor;
|
|
10085
|
+
if (ogTransform) {
|
|
10086
|
+
ogTransform(casted);
|
|
9939
10087
|
}
|
|
9940
10088
|
}
|
|
9941
10089
|
};
|
|
10090
|
+
const nodeDefaults = this.defaultNodePreVisitor;
|
|
9942
10091
|
const preVisitWrapper = (curObject) => {
|
|
10092
|
+
let ogPreVisit;
|
|
10093
|
+
let nodeContext = {};
|
|
9943
10094
|
const casted = curObject;
|
|
9944
10095
|
if (casted.type) {
|
|
9945
|
-
|
|
9946
|
-
|
|
9947
|
-
return ogFunc(casted);
|
|
9948
|
-
}
|
|
10096
|
+
ogPreVisit = nodeCallBacks[casted.type]?.preVisitor;
|
|
10097
|
+
nodeContext = nodeDefaults[casted.type] ?? nodeContext;
|
|
9949
10098
|
}
|
|
9950
|
-
return {};
|
|
10099
|
+
return ogPreVisit ? { ...nodeContext, ...ogPreVisit(casted) } : nodeContext;
|
|
9951
10100
|
};
|
|
9952
|
-
this.visitObject(startObject,
|
|
10101
|
+
return this.visitObject(startObject, visitorWrapper, preVisitWrapper);
|
|
9953
10102
|
}
|
|
10103
|
+
/**
|
|
10104
|
+
* Traverses only selected nodes as returned by the function.
|
|
10105
|
+
* @param currentNode
|
|
10106
|
+
* @param traverse
|
|
10107
|
+
*/
|
|
9954
10108
|
traverseNodes(currentNode, traverse) {
|
|
9955
10109
|
let didShortCut = false;
|
|
9956
10110
|
const recurse = (curNode) => {
|
|
@@ -9971,11 +10125,27 @@ var TransformerType = class {
|
|
|
9971
10125
|
recurse(currentNode);
|
|
9972
10126
|
}
|
|
9973
10127
|
};
|
|
9974
|
-
|
|
10128
|
+
|
|
10129
|
+
// ../core/lib/TransformerSubTyped.js
|
|
10130
|
+
var TransformerSubTyped = class _TransformerSubTyped extends TransformerTyped {
|
|
10131
|
+
constructor(defaultContext = {}, defaultNodePreVisitor = {}) {
|
|
10132
|
+
super(defaultContext, defaultNodePreVisitor);
|
|
10133
|
+
}
|
|
10134
|
+
clone(newDefaultContext = {}, newDefaultNodePreVisitor = {}) {
|
|
10135
|
+
return new _TransformerSubTyped({ ...this.defaultContext, ...newDefaultContext }, { ...this.defaultNodePreVisitor, ...newDefaultNodePreVisitor });
|
|
10136
|
+
}
|
|
10137
|
+
/**
|
|
10138
|
+
* Shares the functionality and first two arguments with {@link this.transformNode}.
|
|
10139
|
+
* The third argument allows you to also transform based on the subType of objects.
|
|
10140
|
+
* Note that when a callback for the subtype is provided, the callback for the general type is **NOT** executed.
|
|
10141
|
+
* @param startObject
|
|
10142
|
+
* @param nodeCallBacks
|
|
10143
|
+
* @param nodeSpecificCallBacks
|
|
10144
|
+
*/
|
|
9975
10145
|
transformNodeSpecific(startObject, nodeCallBacks, nodeSpecificCallBacks) {
|
|
9976
|
-
const transformWrapper = (
|
|
10146
|
+
const transformWrapper = (copy3, orig) => {
|
|
9977
10147
|
let ogTransform;
|
|
9978
|
-
const casted =
|
|
10148
|
+
const casted = copy3;
|
|
9979
10149
|
if (casted.type && casted.subType) {
|
|
9980
10150
|
const specific = nodeSpecificCallBacks[casted.type];
|
|
9981
10151
|
if (specific) {
|
|
@@ -9985,7 +10155,7 @@ var TransformerSubType = class extends TransformerType {
|
|
|
9985
10155
|
ogTransform = nodeCallBacks[casted.type]?.transform;
|
|
9986
10156
|
}
|
|
9987
10157
|
}
|
|
9988
|
-
return ogTransform ? ogTransform(casted) :
|
|
10158
|
+
return ogTransform ? ogTransform(casted, orig) : copy3;
|
|
9989
10159
|
};
|
|
9990
10160
|
const preVisitWrapper = (curObject) => {
|
|
9991
10161
|
let ogPreVisit;
|
|
@@ -9999,12 +10169,13 @@ var TransformerSubType = class extends TransformerType {
|
|
|
9999
10169
|
ogPreVisit = nodeCallBacks[casted.type]?.preVisitor;
|
|
10000
10170
|
}
|
|
10001
10171
|
}
|
|
10002
|
-
return ogPreVisit ? ogPreVisit(casted) :
|
|
10172
|
+
return ogPreVisit ? ogPreVisit(casted) : {};
|
|
10003
10173
|
};
|
|
10004
10174
|
return this.transformObject(startObject, transformWrapper, preVisitWrapper);
|
|
10005
10175
|
}
|
|
10006
10176
|
/**
|
|
10007
|
-
*
|
|
10177
|
+
* Similar to {@link this.visitNode} but also allows you to match based on the subtype of objects.
|
|
10178
|
+
* When both nodeCallBack and NodeSpecific callBack are matched, will only visit nodeSpecifCallback
|
|
10008
10179
|
*/
|
|
10009
10180
|
visitNodeSpecific(startObject, nodeCallBacks, nodeSpecificCallBacks) {
|
|
10010
10181
|
const visitWrapper = (curObject) => {
|
|
@@ -10035,10 +10206,16 @@ var TransformerSubType = class extends TransformerType {
|
|
|
10035
10206
|
ogPreVisit = nodeCallBacks[casted.type]?.preVisitor;
|
|
10036
10207
|
}
|
|
10037
10208
|
}
|
|
10038
|
-
return ogPreVisit ? ogPreVisit(casted) :
|
|
10209
|
+
return ogPreVisit ? ogPreVisit(casted) : {};
|
|
10039
10210
|
};
|
|
10040
10211
|
this.visitObject(startObject, visitWrapper, preVisitWrapper);
|
|
10041
10212
|
}
|
|
10213
|
+
/**
|
|
10214
|
+
* Similar to {@link this.traverseNodes} but also allows you to match based on the subtype of objects.
|
|
10215
|
+
* @param currentNode
|
|
10216
|
+
* @param traverseNode
|
|
10217
|
+
* @param traverseSubNode
|
|
10218
|
+
*/
|
|
10042
10219
|
traverseSubNodes(currentNode, traverseNode, traverseSubNode) {
|
|
10043
10220
|
let didShortCut = false;
|
|
10044
10221
|
const recurse = (curNode) => {
|
|
@@ -10762,8 +10939,8 @@ function PatternFactoryMixin(Base) {
|
|
|
10762
10939
|
isPatternOptional(obj) {
|
|
10763
10940
|
return this.isOfSubType(obj, nodeType5, "optional");
|
|
10764
10941
|
}
|
|
10765
|
-
patternValues(values3, loc) {
|
|
10766
|
-
return { type: nodeType5, subType: "values", values: values3, loc };
|
|
10942
|
+
patternValues(variables, values3, loc) {
|
|
10943
|
+
return { type: nodeType5, subType: "values", variables, values: values3, loc };
|
|
10767
10944
|
}
|
|
10768
10945
|
isPatternValues(obj) {
|
|
10769
10946
|
return this.isOfSubType(obj, nodeType5, "values");
|
|
@@ -10938,7 +11115,7 @@ function TermFactoryMixin(Base) {
|
|
|
10938
11115
|
isTerm(x) {
|
|
10939
11116
|
return this.isOfType(x, "term");
|
|
10940
11117
|
}
|
|
10941
|
-
|
|
11118
|
+
termBlank(label, loc) {
|
|
10942
11119
|
const base = {
|
|
10943
11120
|
type: "term",
|
|
10944
11121
|
subType: "blankNode",
|
|
@@ -10952,7 +11129,7 @@ function TermFactoryMixin(Base) {
|
|
|
10952
11129
|
isTermBlank(obj) {
|
|
10953
11130
|
return this.isOfSubType(obj, nodeType8, "blankNode");
|
|
10954
11131
|
}
|
|
10955
|
-
|
|
11132
|
+
termLiteral(loc, value, langOrIri) {
|
|
10956
11133
|
return {
|
|
10957
11134
|
type: nodeType8,
|
|
10958
11135
|
subType: "literal",
|
|
@@ -10974,7 +11151,7 @@ function TermFactoryMixin(Base) {
|
|
|
10974
11151
|
const casted = obj;
|
|
10975
11152
|
return this.isTermLiteral(obj) && typeof casted.langOrIri === "object" && casted.langOrIri !== null && this.isTermNamed(casted.langOrIri);
|
|
10976
11153
|
}
|
|
10977
|
-
|
|
11154
|
+
termVariable(value, loc) {
|
|
10978
11155
|
return {
|
|
10979
11156
|
type: nodeType8,
|
|
10980
11157
|
subType: "variable",
|
|
@@ -10985,7 +11162,7 @@ function TermFactoryMixin(Base) {
|
|
|
10985
11162
|
isTermVariable(obj) {
|
|
10986
11163
|
return this.isOfSubType(obj, nodeType8, "variable");
|
|
10987
11164
|
}
|
|
10988
|
-
|
|
11165
|
+
termNamed(loc, value, prefix) {
|
|
10989
11166
|
const base = {
|
|
10990
11167
|
type: nodeType8,
|
|
10991
11168
|
subType: "namedNode",
|
|
@@ -11248,7 +11425,7 @@ var CommonIRIs;
|
|
|
11248
11425
|
CommonIRIs2["NIL"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil";
|
|
11249
11426
|
CommonIRIs2["TYPE"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
|
|
11250
11427
|
})(CommonIRIs || (CommonIRIs = {}));
|
|
11251
|
-
var AstTransformer = class extends
|
|
11428
|
+
var AstTransformer = class extends TransformerSubTyped {
|
|
11252
11429
|
};
|
|
11253
11430
|
|
|
11254
11431
|
// lib/validation/validators.js
|
|
@@ -11376,8 +11553,7 @@ function findPatternBoundedVars(iter, boundedVars) {
|
|
|
11376
11553
|
optional: (op) => ({ next: op.patterns }),
|
|
11377
11554
|
service: (op) => ({ next: [op.name, ...op.patterns] }),
|
|
11378
11555
|
bind: (op) => ({ next: [op.variable] }),
|
|
11379
|
-
graph: (op) => ({ next: [op.name, ...op.patterns] })
|
|
11380
|
-
minus: (op) => ({ next: op.patterns.slice(0, 1) })
|
|
11556
|
+
graph: (op) => ({ next: [op.name, ...op.patterns] })
|
|
11381
11557
|
},
|
|
11382
11558
|
term: {
|
|
11383
11559
|
variable: (op) => {
|
|
@@ -11464,17 +11640,20 @@ var rdfLiteral = {
|
|
|
11464
11640
|
return OPTION(() => OR([
|
|
11465
11641
|
{ ALT: () => {
|
|
11466
11642
|
const lang2 = CONSUME(terminals_exports.langTag);
|
|
11467
|
-
return ACTION(() => C.astFactory.
|
|
11643
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(value, lang2), value.value, lang2.image.slice(1).toLowerCase()));
|
|
11468
11644
|
} },
|
|
11469
11645
|
{ ALT: () => {
|
|
11470
11646
|
CONSUME(symbols_exports.hathat);
|
|
11471
11647
|
const iriVal = SUBRULE1(iri2);
|
|
11472
|
-
return ACTION(() => C.astFactory.
|
|
11648
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(value, iriVal), value.value, iriVal));
|
|
11473
11649
|
} }
|
|
11474
11650
|
])) ?? value;
|
|
11475
11651
|
},
|
|
11476
|
-
gImpl: ({ SUBRULE, PRINT,
|
|
11477
|
-
astFactory.printFilter(ast, () =>
|
|
11652
|
+
gImpl: ({ SUBRULE, PRINT, PRINT_WORD }) => (ast, { astFactory }) => {
|
|
11653
|
+
astFactory.printFilter(ast, () => {
|
|
11654
|
+
PRINT_WORD("");
|
|
11655
|
+
PRINT(stringEscapedLexical(ast.value));
|
|
11656
|
+
});
|
|
11478
11657
|
if (ast.langOrIri) {
|
|
11479
11658
|
if (typeof ast.langOrIri === "string") {
|
|
11480
11659
|
astFactory.printFilter(ast, () => PRINT("@", ast.langOrIri));
|
|
@@ -11501,7 +11680,7 @@ var numericLiteralUnsigned = {
|
|
|
11501
11680
|
{ ALT: () => [CONSUME(terminals_exports.decimal), CommonIRIs.DECIMAL] },
|
|
11502
11681
|
{ ALT: () => [CONSUME(terminals_exports.double), CommonIRIs.DOUBLE] }
|
|
11503
11682
|
]);
|
|
11504
|
-
return ACTION(() => C.astFactory.
|
|
11683
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(parsed[0]), parsed[0].image, C.astFactory.termNamed(C.astFactory.sourceLocationNoMaterialize(), parsed[1])));
|
|
11505
11684
|
}
|
|
11506
11685
|
};
|
|
11507
11686
|
var numericLiteralPositive = {
|
|
@@ -11512,7 +11691,7 @@ var numericLiteralPositive = {
|
|
|
11512
11691
|
{ ALT: () => [CONSUME(terminals_exports.decimalPositive), CommonIRIs.DECIMAL] },
|
|
11513
11692
|
{ ALT: () => [CONSUME(terminals_exports.doublePositive), CommonIRIs.DOUBLE] }
|
|
11514
11693
|
]);
|
|
11515
|
-
return ACTION(() => C.astFactory.
|
|
11694
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(parsed[0]), parsed[0].image, C.astFactory.termNamed(C.astFactory.sourceLocationNoMaterialize(), parsed[1])));
|
|
11516
11695
|
}
|
|
11517
11696
|
};
|
|
11518
11697
|
var numericLiteralNegative = {
|
|
@@ -11523,7 +11702,7 @@ var numericLiteralNegative = {
|
|
|
11523
11702
|
{ ALT: () => [CONSUME(terminals_exports.decimalNegative), CommonIRIs.DECIMAL] },
|
|
11524
11703
|
{ ALT: () => [CONSUME(terminals_exports.doubleNegative), CommonIRIs.DOUBLE] }
|
|
11525
11704
|
]);
|
|
11526
|
-
return ACTION(() => C.astFactory.
|
|
11705
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(parsed[0]), parsed[0].image, C.astFactory.termNamed(C.astFactory.sourceLocationNoMaterialize(), parsed[1])));
|
|
11527
11706
|
}
|
|
11528
11707
|
};
|
|
11529
11708
|
var booleanLiteral = {
|
|
@@ -11533,7 +11712,7 @@ var booleanLiteral = {
|
|
|
11533
11712
|
{ ALT: () => CONSUME(true_) },
|
|
11534
11713
|
{ ALT: () => CONSUME(false_) }
|
|
11535
11714
|
]);
|
|
11536
|
-
return ACTION(() => C.astFactory.
|
|
11715
|
+
return ACTION(() => C.astFactory.termLiteral(C.astFactory.sourceLocation(token), token.image.toLowerCase(), C.astFactory.termNamed(C.astFactory.sourceLocationNoMaterialize(), CommonIRIs.BOOLEAN)));
|
|
11537
11716
|
}
|
|
11538
11717
|
};
|
|
11539
11718
|
var string = {
|
|
@@ -11575,7 +11754,7 @@ var string = {
|
|
|
11575
11754
|
return char;
|
|
11576
11755
|
}
|
|
11577
11756
|
});
|
|
11578
|
-
return F2.
|
|
11757
|
+
return F2.termLiteral(F2.sourceLocation(x[0]), value);
|
|
11579
11758
|
});
|
|
11580
11759
|
}
|
|
11581
11760
|
};
|
|
@@ -11591,7 +11770,7 @@ var iriFull = {
|
|
|
11591
11770
|
name: "iriFull",
|
|
11592
11771
|
impl: ({ ACTION, CONSUME }) => (C) => {
|
|
11593
11772
|
const iriToken = CONSUME(terminals_exports.iriRef);
|
|
11594
|
-
return ACTION(() => C.astFactory.
|
|
11773
|
+
return ACTION(() => C.astFactory.termNamed(C.astFactory.sourceLocation(iriToken), iriToken.image.slice(1, -1)));
|
|
11595
11774
|
},
|
|
11596
11775
|
gImpl: ({ PRINT }) => (ast, { astFactory: F2 }) => {
|
|
11597
11776
|
F2.printFilter(ast, () => PRINT("<", ast.value, ">"));
|
|
@@ -11604,16 +11783,16 @@ var prefixedName = {
|
|
|
11604
11783
|
const longName = CONSUME(terminals_exports.pNameLn);
|
|
11605
11784
|
return ACTION(() => {
|
|
11606
11785
|
const [prefix, localName] = longName.image.split(":");
|
|
11607
|
-
return C.astFactory.
|
|
11786
|
+
return C.astFactory.termNamed(C.astFactory.sourceLocation(longName), localName, prefix);
|
|
11608
11787
|
});
|
|
11609
11788
|
} },
|
|
11610
11789
|
{ ALT: () => {
|
|
11611
11790
|
const shortName = CONSUME(terminals_exports.pNameNs);
|
|
11612
|
-
return ACTION(() => C.astFactory.
|
|
11791
|
+
return ACTION(() => C.astFactory.termNamed(C.astFactory.sourceLocation(shortName), "", shortName.image.slice(0, -1)));
|
|
11613
11792
|
} }
|
|
11614
11793
|
]),
|
|
11615
|
-
gImpl: ({
|
|
11616
|
-
F2.printFilter(ast, () =>
|
|
11794
|
+
gImpl: ({ PRINT }) => (ast, { astFactory: F2 }) => {
|
|
11795
|
+
F2.printFilter(ast, () => PRINT(ast.prefix, ":", ast.value));
|
|
11617
11796
|
}
|
|
11618
11797
|
};
|
|
11619
11798
|
var canCreateBlankNodes = Symbol("canCreateBlankNodes");
|
|
@@ -11623,11 +11802,11 @@ var blankNode = {
|
|
|
11623
11802
|
const result = OR([
|
|
11624
11803
|
{ ALT: () => {
|
|
11625
11804
|
const labelToken = CONSUME(terminals_exports.blankNodeLabel);
|
|
11626
|
-
return ACTION(() => C.astFactory.
|
|
11805
|
+
return ACTION(() => C.astFactory.termBlank(labelToken.image.slice(2), C.astFactory.sourceLocation(labelToken)));
|
|
11627
11806
|
} },
|
|
11628
11807
|
{ ALT: () => {
|
|
11629
11808
|
const anonToken = CONSUME(terminals_exports.anon);
|
|
11630
|
-
return ACTION(() => C.astFactory.
|
|
11809
|
+
return ACTION(() => C.astFactory.termBlank(void 0, C.astFactory.sourceLocation(anonToken)));
|
|
11631
11810
|
} }
|
|
11632
11811
|
]);
|
|
11633
11812
|
ACTION(() => {
|
|
@@ -11637,15 +11816,15 @@ var blankNode = {
|
|
|
11637
11816
|
});
|
|
11638
11817
|
return result;
|
|
11639
11818
|
},
|
|
11640
|
-
gImpl: ({
|
|
11641
|
-
astFactory.printFilter(ast, () =>
|
|
11819
|
+
gImpl: ({ PRINT }) => (ast, { astFactory }) => {
|
|
11820
|
+
astFactory.printFilter(ast, () => PRINT("_:", ast.label.replace(/^e_/u, "")));
|
|
11642
11821
|
}
|
|
11643
11822
|
};
|
|
11644
11823
|
var verbA = {
|
|
11645
11824
|
name: "VerbA",
|
|
11646
11825
|
impl: ({ ACTION, CONSUME }) => (C) => {
|
|
11647
11826
|
const token = CONSUME(a);
|
|
11648
|
-
return ACTION(() => C.astFactory.
|
|
11827
|
+
return ACTION(() => C.astFactory.termNamed(C.astFactory.sourceLocation(token), CommonIRIs.TYPE, void 0));
|
|
11649
11828
|
}
|
|
11650
11829
|
};
|
|
11651
11830
|
|
|
@@ -11679,10 +11858,10 @@ var baseDecl2 = {
|
|
|
11679
11858
|
const val = SUBRULE(iriFull);
|
|
11680
11859
|
return ACTION(() => C.astFactory.contextDefinitionBase(C.astFactory.sourceLocation(base, val), val));
|
|
11681
11860
|
},
|
|
11682
|
-
gImpl: ({ SUBRULE,
|
|
11683
|
-
F2.printFilter(ast, () =>
|
|
11861
|
+
gImpl: ({ SUBRULE, PRINT_ON_EMPTY, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
11862
|
+
F2.printFilter(ast, () => PRINT_ON_EMPTY("BASE "));
|
|
11684
11863
|
SUBRULE(iri2, ast.value);
|
|
11685
|
-
F2.printFilter(ast, () =>
|
|
11864
|
+
F2.printFilter(ast, () => NEW_LINE());
|
|
11686
11865
|
}
|
|
11687
11866
|
};
|
|
11688
11867
|
var prefixDecl2 = {
|
|
@@ -11693,12 +11872,12 @@ var prefixDecl2 = {
|
|
|
11693
11872
|
const value = SUBRULE(iriFull);
|
|
11694
11873
|
return ACTION(() => C.astFactory.contextDefinitionPrefix(C.astFactory.sourceLocation(prefix, value), name, value));
|
|
11695
11874
|
},
|
|
11696
|
-
gImpl: ({ SUBRULE,
|
|
11875
|
+
gImpl: ({ SUBRULE, PRINT_ON_EMPTY, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
11697
11876
|
F2.printFilter(ast, () => {
|
|
11698
|
-
|
|
11877
|
+
PRINT_ON_EMPTY("PREFIX ", `${ast.key}: `);
|
|
11699
11878
|
});
|
|
11700
11879
|
SUBRULE(iri2, ast.value);
|
|
11701
|
-
F2.printFilter(ast, () =>
|
|
11880
|
+
F2.printFilter(ast, () => NEW_LINE());
|
|
11702
11881
|
}
|
|
11703
11882
|
};
|
|
11704
11883
|
var verb = {
|
|
@@ -11735,10 +11914,10 @@ var var_ = {
|
|
|
11735
11914
|
{ ALT: () => CONSUME(terminals_exports.var1) },
|
|
11736
11915
|
{ ALT: () => CONSUME(terminals_exports.var2) }
|
|
11737
11916
|
]);
|
|
11738
|
-
return ACTION(() => C.astFactory.
|
|
11917
|
+
return ACTION(() => C.astFactory.termVariable(varToken.image.slice(1), C.astFactory.sourceLocation(varToken)));
|
|
11739
11918
|
},
|
|
11740
|
-
gImpl: ({
|
|
11741
|
-
F2.printFilter(ast, () =>
|
|
11919
|
+
gImpl: ({ PRINT }) => (ast, { astFactory: F2 }) => {
|
|
11920
|
+
F2.printFilter(ast, () => PRINT(`?${ast.value}`));
|
|
11742
11921
|
}
|
|
11743
11922
|
};
|
|
11744
11923
|
var graphTerm = {
|
|
@@ -11751,7 +11930,7 @@ var graphTerm = {
|
|
|
11751
11930
|
{ GATE: () => C.parseMode.has("canCreateBlankNodes"), ALT: () => SUBRULE(blankNode) },
|
|
11752
11931
|
{ ALT: () => {
|
|
11753
11932
|
const tokenNil = CONSUME(terminals_exports.nil);
|
|
11754
|
-
return ACTION(() => C.astFactory.
|
|
11933
|
+
return ACTION(() => C.astFactory.termNamed(C.astFactory.sourceLocation(tokenNil), CommonIRIs.NIL));
|
|
11755
11934
|
} }
|
|
11756
11935
|
]),
|
|
11757
11936
|
gImpl: ({ SUBRULE }) => (ast, { astFactory: F2 }) => {
|
|
@@ -12381,13 +12560,16 @@ function triplesDotSeperated(triplesSameSubjectSubrule) {
|
|
|
12381
12560
|
var triplesBlock = {
|
|
12382
12561
|
name: "triplesBlock",
|
|
12383
12562
|
impl: (implArgs) => (C) => triplesDotSeperated(triplesSameSubjectPath)(implArgs)(C),
|
|
12384
|
-
gImpl: ({ SUBRULE, PRINT_WORD, HANDLE_LOC }) => (ast, { astFactory: F2 }) => {
|
|
12563
|
+
gImpl: ({ SUBRULE, PRINT_WORD, HANDLE_LOC, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
12385
12564
|
for (const [index, triple] of ast.triples.entries()) {
|
|
12386
12565
|
HANDLE_LOC(triple, () => {
|
|
12387
12566
|
const nextTriple = ast.triples.at(index);
|
|
12388
12567
|
if (F2.isTripleCollection(triple)) {
|
|
12389
12568
|
SUBRULE(graphNodePath, triple);
|
|
12390
|
-
F2.printFilter(triple, () =>
|
|
12569
|
+
F2.printFilter(triple, () => {
|
|
12570
|
+
PRINT_WORD(".");
|
|
12571
|
+
NEW_LINE();
|
|
12572
|
+
});
|
|
12391
12573
|
} else {
|
|
12392
12574
|
SUBRULE(graphNodePath, triple.subject);
|
|
12393
12575
|
F2.printFilter(triple, () => PRINT_WORD(""));
|
|
@@ -12399,11 +12581,17 @@ var triplesBlock = {
|
|
|
12399
12581
|
F2.printFilter(triple, () => PRINT_WORD(""));
|
|
12400
12582
|
SUBRULE(graphNodePath, triple.object);
|
|
12401
12583
|
if (nextTriple === void 0 || F2.isTripleCollection(nextTriple) || !F2.isSourceLocationNoMaterialize(nextTriple.subject.loc)) {
|
|
12402
|
-
F2.printFilter(ast, () =>
|
|
12584
|
+
F2.printFilter(ast, () => {
|
|
12585
|
+
PRINT_WORD(".");
|
|
12586
|
+
NEW_LINE();
|
|
12587
|
+
});
|
|
12403
12588
|
} else if (F2.isSourceLocationNoMaterialize(nextTriple.predicate.loc)) {
|
|
12404
12589
|
F2.printFilter(ast, () => PRINT_WORD(","));
|
|
12405
12590
|
} else {
|
|
12406
|
-
F2.printFilter(ast, () =>
|
|
12591
|
+
F2.printFilter(ast, () => {
|
|
12592
|
+
PRINT_WORD(";");
|
|
12593
|
+
NEW_LINE();
|
|
12594
|
+
});
|
|
12407
12595
|
}
|
|
12408
12596
|
}
|
|
12409
12597
|
});
|
|
@@ -12536,10 +12724,10 @@ function collectionImpl(name, allowPaths) {
|
|
|
12536
12724
|
return ACTION(() => {
|
|
12537
12725
|
const F2 = C.astFactory;
|
|
12538
12726
|
const triples = [];
|
|
12539
|
-
const predFirst = F2.
|
|
12540
|
-
const predRest = F2.
|
|
12541
|
-
const predNil = F2.
|
|
12542
|
-
const listHead = F2.
|
|
12727
|
+
const predFirst = F2.termNamed(F2.sourceLocationNoMaterialize(), CommonIRIs.FIRST, void 0);
|
|
12728
|
+
const predRest = F2.termNamed(F2.sourceLocationNoMaterialize(), CommonIRIs.REST, void 0);
|
|
12729
|
+
const predNil = F2.termNamed(F2.sourceLocationNoMaterialize(), CommonIRIs.NIL, void 0);
|
|
12730
|
+
const listHead = F2.termBlank(void 0, F2.sourceLocationNoMaterialize());
|
|
12543
12731
|
let iterHead = listHead;
|
|
12544
12732
|
for (const [index, term] of terms.entries()) {
|
|
12545
12733
|
const lastInList = index === terms.length - 1;
|
|
@@ -12549,7 +12737,7 @@ function collectionImpl(name, allowPaths) {
|
|
|
12549
12737
|
const nilTriple = F2.triple(iterHead, predRest, predNil);
|
|
12550
12738
|
triples.push(nilTriple);
|
|
12551
12739
|
} else {
|
|
12552
|
-
const tail = F2.
|
|
12740
|
+
const tail = F2.termBlank(void 0, F2.sourceLocationNoMaterialize());
|
|
12553
12741
|
const linkTriple = F2.triple(iterHead, predRest, tail);
|
|
12554
12742
|
triples.push(linkTriple);
|
|
12555
12743
|
iterHead = tail;
|
|
@@ -12589,16 +12777,17 @@ function blankNodePropertyListImpl(name, allowPaths) {
|
|
|
12589
12777
|
name,
|
|
12590
12778
|
impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
|
|
12591
12779
|
const startToken = CONSUME(symbols_exports.LSquare);
|
|
12592
|
-
const blankNode2 = ACTION(() => C.astFactory.
|
|
12780
|
+
const blankNode2 = ACTION(() => C.astFactory.termBlank(void 0, C.astFactory.sourceLocationNoMaterialize()));
|
|
12593
12781
|
const propList = SUBRULE(propertyPathNotEmptyImpl, blankNode2);
|
|
12594
12782
|
const endToken = CONSUME(symbols_exports.RSquare);
|
|
12595
12783
|
return ACTION(() => C.astFactory.tripleCollectionBlankNodeProperties(blankNode2, propList, C.astFactory.sourceLocation(startToken, endToken)));
|
|
12596
12784
|
},
|
|
12597
|
-
gImpl: ({ SUBRULE, PRINT, PRINT_WORD, HANDLE_LOC, PRINT_ON_EMPTY }) => (ast, c) => {
|
|
12785
|
+
gImpl: ({ SUBRULE, PRINT, PRINT_WORD, HANDLE_LOC, PRINT_ON_EMPTY, NEW_LINE }) => (ast, c) => {
|
|
12598
12786
|
const { astFactory: F2, indentInc } = c;
|
|
12599
12787
|
F2.printFilter(ast, () => {
|
|
12600
12788
|
c[traqulaIndentation] += indentInc;
|
|
12601
|
-
PRINT("[
|
|
12789
|
+
PRINT("[");
|
|
12790
|
+
NEW_LINE();
|
|
12602
12791
|
});
|
|
12603
12792
|
for (const triple of ast.triples) {
|
|
12604
12793
|
HANDLE_LOC(triple, () => {
|
|
@@ -12609,7 +12798,10 @@ function blankNodePropertyListImpl(name, allowPaths) {
|
|
|
12609
12798
|
}
|
|
12610
12799
|
F2.printFilter(triple, () => PRINT_WORD(""));
|
|
12611
12800
|
SUBRULE(graphNodePath, triple.object);
|
|
12612
|
-
F2.printFilter(ast, () =>
|
|
12801
|
+
F2.printFilter(ast, () => {
|
|
12802
|
+
PRINT_WORD(";");
|
|
12803
|
+
NEW_LINE();
|
|
12804
|
+
});
|
|
12613
12805
|
});
|
|
12614
12806
|
}
|
|
12615
12807
|
F2.printFilter(ast, () => {
|
|
@@ -12668,18 +12860,19 @@ var groupGraphPattern = {
|
|
|
12668
12860
|
const close = CONSUME(symbols_exports.RCurly);
|
|
12669
12861
|
return ACTION(() => C.astFactory.patternGroup(patterns, C.astFactory.sourceLocation(open, close)));
|
|
12670
12862
|
},
|
|
12671
|
-
gImpl: ({ SUBRULE, PRINT_WORD,
|
|
12863
|
+
gImpl: ({ SUBRULE, PRINT_WORD, NEW_LINE, PRINT_ON_OWN_LINE }) => (ast, C) => {
|
|
12672
12864
|
const { astFactory: F2, indentInc } = C;
|
|
12673
12865
|
F2.printFilter(ast, () => {
|
|
12674
12866
|
C[traqulaIndentation] += indentInc;
|
|
12675
|
-
PRINT_WORD("{
|
|
12867
|
+
PRINT_WORD("{");
|
|
12868
|
+
NEW_LINE();
|
|
12676
12869
|
});
|
|
12677
12870
|
for (const pattern of ast.patterns) {
|
|
12678
12871
|
SUBRULE(generatePattern, pattern);
|
|
12679
12872
|
}
|
|
12680
12873
|
F2.printFilter(ast, () => {
|
|
12681
12874
|
C[traqulaIndentation] -= indentInc;
|
|
12682
|
-
|
|
12875
|
+
PRINT_ON_OWN_LINE("}");
|
|
12683
12876
|
});
|
|
12684
12877
|
}
|
|
12685
12878
|
};
|
|
@@ -12829,12 +13022,15 @@ var bind2 = {
|
|
|
12829
13022
|
const close = CONSUME(symbols_exports.RParen);
|
|
12830
13023
|
return ACTION(() => C.astFactory.patternBind(expressionVal, variable, C.astFactory.sourceLocation(bind3, close)));
|
|
12831
13024
|
},
|
|
12832
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
13025
|
+
gImpl: ({ SUBRULE, PRINT_WORD, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
12833
13026
|
F2.printFilter(ast, () => PRINT_WORD("BIND", "("));
|
|
12834
13027
|
SUBRULE(expression, ast.expression);
|
|
12835
13028
|
F2.printFilter(ast, () => PRINT_WORD("AS"));
|
|
12836
13029
|
SUBRULE(var_, ast.variable);
|
|
12837
|
-
F2.printFilter(ast, () =>
|
|
13030
|
+
F2.printFilter(ast, () => {
|
|
13031
|
+
PRINT_WORD(")");
|
|
13032
|
+
NEW_LINE();
|
|
13033
|
+
});
|
|
12838
13034
|
}
|
|
12839
13035
|
};
|
|
12840
13036
|
var inlineData = {
|
|
@@ -12842,34 +13038,46 @@ var inlineData = {
|
|
|
12842
13038
|
impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
|
|
12843
13039
|
const values3 = CONSUME(values2);
|
|
12844
13040
|
const datablock = SUBRULE(dataBlock);
|
|
12845
|
-
return ACTION(() =>
|
|
13041
|
+
return ACTION(() => {
|
|
13042
|
+
datablock.loc = C.astFactory.sourceLocation(values3, datablock);
|
|
13043
|
+
return datablock;
|
|
13044
|
+
});
|
|
12846
13045
|
},
|
|
12847
|
-
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, C) => {
|
|
13046
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY, NEW_LINE, PRINT_ON_OWN_LINE }) => (ast, C) => {
|
|
12848
13047
|
const { astFactory: F2, indentInc } = C;
|
|
12849
|
-
const variables =
|
|
13048
|
+
const variables = ast.variables;
|
|
13049
|
+
const singleVar = variables.length === 1;
|
|
13050
|
+
F2.printFilter(ast, () => {
|
|
13051
|
+
PRINT_ON_EMPTY("VALUES", singleVar ? "" : "( ");
|
|
13052
|
+
});
|
|
13053
|
+
for (const variable of variables) {
|
|
13054
|
+
F2.printFilter(ast, () => PRINT_WORD(""));
|
|
13055
|
+
SUBRULE(varOrTerm, variable);
|
|
13056
|
+
F2.printFilter(ast, () => PRINT_WORD(""));
|
|
13057
|
+
}
|
|
12850
13058
|
F2.printFilter(ast, () => {
|
|
12851
|
-
PRINT_ON_EMPTY("");
|
|
12852
|
-
PRINT_WORD("VALUES", "(");
|
|
12853
|
-
for (const variable of variables) {
|
|
12854
|
-
PRINT_WORD(`?${variable}`);
|
|
12855
|
-
}
|
|
12856
13059
|
C[traqulaIndentation] += indentInc;
|
|
12857
|
-
PRINT_WORD(")", "{
|
|
13060
|
+
PRINT_WORD(singleVar ? "" : ")", "{");
|
|
13061
|
+
NEW_LINE();
|
|
12858
13062
|
});
|
|
12859
13063
|
for (const mapping of ast.values) {
|
|
12860
|
-
F2.printFilter(ast, () => PRINT_WORD("("));
|
|
13064
|
+
F2.printFilter(ast, () => !singleVar && PRINT_WORD("("));
|
|
12861
13065
|
for (const variable of variables) {
|
|
12862
|
-
|
|
13066
|
+
const var_2 = variable.value;
|
|
13067
|
+
if (mapping[var_2] === void 0) {
|
|
12863
13068
|
F2.printFilter(ast, () => PRINT_WORD("UNDEF"));
|
|
12864
13069
|
} else {
|
|
12865
|
-
SUBRULE(graphNodePath, mapping[
|
|
13070
|
+
SUBRULE(graphNodePath, mapping[var_2]);
|
|
12866
13071
|
}
|
|
12867
13072
|
}
|
|
12868
|
-
F2.printFilter(ast, () =>
|
|
13073
|
+
F2.printFilter(ast, () => {
|
|
13074
|
+
PRINT_WORD(singleVar ? "" : ")");
|
|
13075
|
+
NEW_LINE();
|
|
13076
|
+
});
|
|
12869
13077
|
}
|
|
12870
13078
|
F2.printFilter(ast, () => {
|
|
12871
13079
|
C[traqulaIndentation] -= indentInc;
|
|
12872
|
-
|
|
13080
|
+
PRINT_ON_OWN_LINE("}");
|
|
12873
13081
|
});
|
|
12874
13082
|
}
|
|
12875
13083
|
};
|
|
@@ -12893,7 +13101,7 @@ var inlineDataOneVar = {
|
|
|
12893
13101
|
});
|
|
12894
13102
|
});
|
|
12895
13103
|
const close = CONSUME(symbols_exports.RCurly);
|
|
12896
|
-
return ACTION(() => C.astFactory.
|
|
13104
|
+
return ACTION(() => C.astFactory.patternValues([varVal], res, C.astFactory.sourceLocation(varVal, close)));
|
|
12897
13105
|
}
|
|
12898
13106
|
};
|
|
12899
13107
|
var inlineDataFull = {
|
|
@@ -12910,7 +13118,7 @@ var inlineDataFull = {
|
|
|
12910
13118
|
res.push({});
|
|
12911
13119
|
});
|
|
12912
13120
|
const close = CONSUME1(symbols_exports.RCurly);
|
|
12913
|
-
return ACTION(() => C.astFactory.
|
|
13121
|
+
return ACTION(() => C.astFactory.patternValues(vars, res, C.astFactory.sourceLocation(nil2, close)));
|
|
12914
13122
|
} },
|
|
12915
13123
|
{ ALT: () => {
|
|
12916
13124
|
const open = CONSUME1(symbols_exports.LParen);
|
|
@@ -12942,7 +13150,7 @@ var inlineDataFull = {
|
|
|
12942
13150
|
});
|
|
12943
13151
|
});
|
|
12944
13152
|
const close = CONSUME2(symbols_exports.RCurly);
|
|
12945
|
-
return ACTION(() => C.astFactory.
|
|
13153
|
+
return ACTION(() => C.astFactory.patternValues(vars, res, C.astFactory.sourceLocation(open, close)));
|
|
12946
13154
|
} }
|
|
12947
13155
|
]);
|
|
12948
13156
|
}
|
|
@@ -13005,10 +13213,13 @@ var filter3 = {
|
|
|
13005
13213
|
const expression2 = SUBRULE(constraint);
|
|
13006
13214
|
return ACTION(() => C.astFactory.patternFilter(expression2, C.astFactory.sourceLocation(filterToken, expression2)));
|
|
13007
13215
|
},
|
|
13008
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
13216
|
+
gImpl: ({ SUBRULE, PRINT_WORD, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
13009
13217
|
F2.printFilter(ast, () => PRINT_WORD("FILTER ("));
|
|
13010
13218
|
SUBRULE(expression, ast.expression);
|
|
13011
|
-
F2.printFilter(ast, () =>
|
|
13219
|
+
F2.printFilter(ast, () => {
|
|
13220
|
+
PRINT_WORD(")");
|
|
13221
|
+
NEW_LINE();
|
|
13222
|
+
});
|
|
13012
13223
|
}
|
|
13013
13224
|
};
|
|
13014
13225
|
var constraint = {
|
|
@@ -13394,8 +13605,7 @@ var groupClause = {
|
|
|
13394
13605
|
},
|
|
13395
13606
|
gImpl: ({ PRINT_WORDS, SUBRULE, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
13396
13607
|
F2.printFilter(ast, () => {
|
|
13397
|
-
PRINT_ON_EMPTY("");
|
|
13398
|
-
PRINT_WORDS("GROUP", "BY");
|
|
13608
|
+
PRINT_ON_EMPTY("GROUP BY ");
|
|
13399
13609
|
});
|
|
13400
13610
|
for (const grouping of ast.groupings) {
|
|
13401
13611
|
if (F2.isExpression(grouping)) {
|
|
@@ -13451,10 +13661,9 @@ var havingClause = {
|
|
|
13451
13661
|
ACTION(() => !couldParseAgg && C.parseMode.delete("canParseAggregate"));
|
|
13452
13662
|
return ACTION(() => C.astFactory.solutionModifierHaving(expressions, C.astFactory.sourceLocation(having2, expressions.at(-1))));
|
|
13453
13663
|
},
|
|
13454
|
-
gImpl: ({
|
|
13664
|
+
gImpl: ({ PRINT_ON_EMPTY, SUBRULE }) => (ast, { astFactory: F2 }) => {
|
|
13455
13665
|
F2.printFilter(ast, () => {
|
|
13456
|
-
PRINT_ON_EMPTY("");
|
|
13457
|
-
PRINT_WORD("HAVING");
|
|
13666
|
+
PRINT_ON_EMPTY("HAVING ");
|
|
13458
13667
|
});
|
|
13459
13668
|
for (const having2 of ast.having) {
|
|
13460
13669
|
SUBRULE(expression, having2);
|
|
@@ -13480,8 +13689,7 @@ var orderClause = {
|
|
|
13480
13689
|
},
|
|
13481
13690
|
gImpl: ({ PRINT_WORDS, PRINT_ON_EMPTY, SUBRULE }) => (ast, { astFactory: F2 }) => {
|
|
13482
13691
|
F2.printFilter(ast, () => {
|
|
13483
|
-
PRINT_ON_EMPTY("");
|
|
13484
|
-
PRINT_WORDS("ORDER", "BY");
|
|
13692
|
+
PRINT_ON_EMPTY("ORDER BY ");
|
|
13485
13693
|
});
|
|
13486
13694
|
for (const ordering of ast.orderDefs) {
|
|
13487
13695
|
if (ordering.descending) {
|
|
@@ -13540,9 +13748,9 @@ var limitOffsetClauses = {
|
|
|
13540
13748
|
return ACTION(() => C.astFactory.solutionModifierLimitOffset(limit2?.val, offset2.val, C.astFactory.sourceLocation(offset2, limit2)));
|
|
13541
13749
|
} }
|
|
13542
13750
|
]),
|
|
13543
|
-
gImpl: ({ PRINT_WORDS,
|
|
13751
|
+
gImpl: ({ PRINT_WORDS, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
13544
13752
|
F2.printFilter(ast, () => {
|
|
13545
|
-
|
|
13753
|
+
NEW_LINE();
|
|
13546
13754
|
if (ast.limit) {
|
|
13547
13755
|
PRINT_WORDS("LIMIT", String(ast.limit));
|
|
13548
13756
|
}
|
|
@@ -13727,9 +13935,9 @@ var selectClause = {
|
|
|
13727
13935
|
ACTION(() => !couldParseAgg && C.parseMode.delete("canParseAggregate"));
|
|
13728
13936
|
return ACTION(() => C.astFactory.wrap(val, C.astFactory.sourceLocation(select2, last2)));
|
|
13729
13937
|
},
|
|
13730
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
13938
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
13731
13939
|
F2.printFilter(ast, () => {
|
|
13732
|
-
|
|
13940
|
+
PRINT_ON_EMPTY("SELECT ");
|
|
13733
13941
|
if (ast.val.distinct) {
|
|
13734
13942
|
PRINT_WORD("DISTINCT");
|
|
13735
13943
|
} else if (ast.val.reduced) {
|
|
@@ -13748,7 +13956,9 @@ var selectClause = {
|
|
|
13748
13956
|
SUBRULE(var_, variable.variable);
|
|
13749
13957
|
F2.printFilter(ast, () => PRINT_WORD(")"));
|
|
13750
13958
|
}
|
|
13959
|
+
F2.printFilter(ast, () => PRINT_WORD(""));
|
|
13751
13960
|
}
|
|
13961
|
+
F2.printFilter(ast, () => PRINT_WORD(""));
|
|
13752
13962
|
}
|
|
13753
13963
|
};
|
|
13754
13964
|
var constructQuery = {
|
|
@@ -13786,18 +13996,19 @@ var constructQuery = {
|
|
|
13786
13996
|
} }
|
|
13787
13997
|
]);
|
|
13788
13998
|
},
|
|
13789
|
-
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, C) => {
|
|
13999
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY, PRINT_ON_OWN_LINE, NEW_LINE }) => (ast, C) => {
|
|
13790
14000
|
const { astFactory: F2, indentInc } = C;
|
|
13791
|
-
F2.printFilter(ast, () =>
|
|
14001
|
+
F2.printFilter(ast, () => PRINT_ON_EMPTY("CONSTRUCT "));
|
|
13792
14002
|
if (!F2.isSourceLocationNoMaterialize(ast.where.loc)) {
|
|
13793
14003
|
F2.printFilter(ast, () => {
|
|
13794
14004
|
C[traqulaIndentation] += indentInc;
|
|
13795
|
-
PRINT_WORD("{
|
|
14005
|
+
PRINT_WORD("{");
|
|
14006
|
+
NEW_LINE();
|
|
13796
14007
|
});
|
|
13797
14008
|
SUBRULE(triplesBlock, ast.template);
|
|
13798
14009
|
F2.printFilter(ast, () => {
|
|
13799
14010
|
C[traqulaIndentation] -= indentInc;
|
|
13800
|
-
|
|
14011
|
+
PRINT_ON_OWN_LINE("}");
|
|
13801
14012
|
});
|
|
13802
14013
|
}
|
|
13803
14014
|
SUBRULE(datasetClauseStar, ast.datasets);
|
|
@@ -13838,8 +14049,8 @@ var describeQuery = {
|
|
|
13838
14049
|
loc: C.astFactory.sourceLocation(describe2, ...variables, from2, where2, modifiers.group, modifiers.having, modifiers.order, modifiers.limitOffset)
|
|
13839
14050
|
}));
|
|
13840
14051
|
},
|
|
13841
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
13842
|
-
F2.printFilter(ast, () =>
|
|
14052
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
14053
|
+
F2.printFilter(ast, () => PRINT_ON_EMPTY("DESCRIBE "));
|
|
13843
14054
|
if (F2.isWildcard(ast.variables[0])) {
|
|
13844
14055
|
F2.printFilter(ast, () => PRINT_WORD("*"));
|
|
13845
14056
|
} else {
|
|
@@ -13869,8 +14080,8 @@ var askQuery = {
|
|
|
13869
14080
|
loc: C.astFactory.sourceLocation(ask2, from2, where2, modifiers.group, modifiers.having, modifiers.order, modifiers.limitOffset)
|
|
13870
14081
|
}));
|
|
13871
14082
|
},
|
|
13872
|
-
gImpl: ({ SUBRULE,
|
|
13873
|
-
F2.printFilter(ast, () =>
|
|
14083
|
+
gImpl: ({ SUBRULE, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
14084
|
+
F2.printFilter(ast, () => PRINT_ON_EMPTY("ASK "));
|
|
13874
14085
|
SUBRULE(datasetClauseStar, ast.datasets);
|
|
13875
14086
|
SUBRULE(whereClause, F2.wrap(ast.where, ast.loc));
|
|
13876
14087
|
SUBRULE(solutionModifier, ast.solutionModifiers);
|
|
@@ -13929,7 +14140,7 @@ var update = {
|
|
|
13929
14140
|
return update2;
|
|
13930
14141
|
});
|
|
13931
14142
|
},
|
|
13932
|
-
gImpl: ({ SUBRULE,
|
|
14143
|
+
gImpl: ({ SUBRULE, PRINT, NEW_LINE }) => (ast, { astFactory: F2 }) => {
|
|
13933
14144
|
const [head2, ...tail] = ast.updates;
|
|
13934
14145
|
if (head2) {
|
|
13935
14146
|
SUBRULE(prologue, head2.context);
|
|
@@ -13938,7 +14149,10 @@ var update = {
|
|
|
13938
14149
|
}
|
|
13939
14150
|
}
|
|
13940
14151
|
for (const update2 of tail) {
|
|
13941
|
-
F2.printFilter(ast, () =>
|
|
14152
|
+
F2.printFilter(ast, () => {
|
|
14153
|
+
PRINT(";");
|
|
14154
|
+
NEW_LINE();
|
|
14155
|
+
});
|
|
13942
14156
|
SUBRULE(prologue, update2.context);
|
|
13943
14157
|
if (update2.operation) {
|
|
13944
14158
|
SUBRULE(update1, update2.operation);
|
|
@@ -14011,9 +14225,9 @@ var load2 = {
|
|
|
14011
14225
|
});
|
|
14012
14226
|
return ACTION(() => C.astFactory.updateOperationLoad(C.astFactory.sourceLocation(loadToken, source, destination), source, Boolean(silent2), destination));
|
|
14013
14227
|
},
|
|
14014
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
14228
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
14015
14229
|
F2.printFilter(ast, () => {
|
|
14016
|
-
|
|
14230
|
+
PRINT_ON_EMPTY("LOAD ");
|
|
14017
14231
|
if (ast.silent) {
|
|
14018
14232
|
PRINT_WORD("SILENT");
|
|
14019
14233
|
}
|
|
@@ -14034,9 +14248,9 @@ function clearOrDrop(operation) {
|
|
|
14034
14248
|
const destination = SUBRULE1(graphRefAll);
|
|
14035
14249
|
return ACTION(() => C.astFactory.updateOperationClearDrop(unCapitalize(operation.name), Boolean(silent2), destination, C.astFactory.sourceLocation(opToken, destination)));
|
|
14036
14250
|
},
|
|
14037
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
14251
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
14038
14252
|
F2.printFilter(ast, () => {
|
|
14039
|
-
|
|
14253
|
+
PRINT_ON_EMPTY(operation.name.toUpperCase(), " ");
|
|
14040
14254
|
if (ast.silent) {
|
|
14041
14255
|
PRINT_WORD("SILENT");
|
|
14042
14256
|
}
|
|
@@ -14055,9 +14269,9 @@ var create2 = {
|
|
|
14055
14269
|
const destination = SUBRULE1(graphRef);
|
|
14056
14270
|
return ACTION(() => C.astFactory.updateOperationCreate(destination, Boolean(silent2), C.astFactory.sourceLocation(createToken3, destination)));
|
|
14057
14271
|
},
|
|
14058
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
14272
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
14059
14273
|
F2.printFilter(ast, () => {
|
|
14060
|
-
|
|
14274
|
+
PRINT_ON_EMPTY("CREATE ");
|
|
14061
14275
|
if (ast.silent) {
|
|
14062
14276
|
PRINT_WORD("SILENT");
|
|
14063
14277
|
}
|
|
@@ -14076,9 +14290,9 @@ function copyMoveAddOperation(operation) {
|
|
|
14076
14290
|
const destination = SUBRULE2(graphOrDefault);
|
|
14077
14291
|
return ACTION(() => C.astFactory.updateOperationAddMoveCopy(unCapitalize(operation.name), source, destination, Boolean(silent2), C.astFactory.sourceLocation(op, destination)));
|
|
14078
14292
|
},
|
|
14079
|
-
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F2 }) => {
|
|
14293
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, { astFactory: F2 }) => {
|
|
14080
14294
|
F2.printFilter(ast, () => {
|
|
14081
|
-
|
|
14295
|
+
PRINT_ON_EMPTY(operation.name.toUpperCase(), " ");
|
|
14082
14296
|
if (ast.silent) {
|
|
14083
14297
|
PRINT_WORD("SILENT");
|
|
14084
14298
|
}
|
|
@@ -14127,23 +14341,24 @@ function insertDeleteDelWhere(name, subType, cons1, dataRule) {
|
|
|
14127
14341
|
}
|
|
14128
14342
|
return ACTION(() => C.astFactory.updateOperationInsDelDataWhere(subType, data.val, C.astFactory.sourceLocation(insDelToken, data)));
|
|
14129
14343
|
},
|
|
14130
|
-
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, C) => {
|
|
14344
|
+
gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY, PRINT_ON_OWN_LINE, NEW_LINE }) => (ast, C) => {
|
|
14131
14345
|
const { astFactory: F2, indentInc } = C;
|
|
14132
14346
|
F2.printFilter(ast, () => {
|
|
14133
|
-
C[traqulaIndentation] += indentInc;
|
|
14134
14347
|
if (subType === "insertdata") {
|
|
14135
|
-
|
|
14348
|
+
PRINT_ON_EMPTY("INSERT DATA ");
|
|
14136
14349
|
} else if (subType === "deletedata") {
|
|
14137
|
-
|
|
14350
|
+
PRINT_ON_EMPTY("DELETE DATA ");
|
|
14138
14351
|
} else if (subType === "deletewhere") {
|
|
14139
|
-
|
|
14352
|
+
PRINT_ON_EMPTY("DELETE WHERE ");
|
|
14140
14353
|
}
|
|
14141
|
-
|
|
14354
|
+
C[traqulaIndentation] += indentInc;
|
|
14355
|
+
PRINT_WORD("{");
|
|
14356
|
+
NEW_LINE();
|
|
14142
14357
|
});
|
|
14143
14358
|
SUBRULE(quads, F2.wrap(ast.data, ast.loc));
|
|
14144
14359
|
F2.printFilter(ast, () => {
|
|
14145
14360
|
C[traqulaIndentation] -= indentInc;
|
|
14146
|
-
|
|
14361
|
+
PRINT_ON_OWN_LINE("}");
|
|
14147
14362
|
});
|
|
14148
14363
|
}
|
|
14149
14364
|
};
|
|
@@ -14175,36 +14390,40 @@ var modify = {
|
|
|
14175
14390
|
const where2 = SUBRULE1(groupGraphPattern);
|
|
14176
14391
|
return ACTION(() => C.astFactory.updateOperationModify(C.astFactory.sourceLocation(graph2?.withToken, del, insert, where2), insert?.val ?? [], del?.val ?? [], where2, using, graph2?.graph));
|
|
14177
14392
|
},
|
|
14178
|
-
gImpl: ({ SUBRULE,
|
|
14393
|
+
gImpl: ({ SUBRULE, PRINT_WORDS, PRINT_ON_EMPTY, NEW_LINE }) => (ast, C) => {
|
|
14179
14394
|
const { astFactory: F2, indentInc } = C;
|
|
14180
14395
|
if (ast.graph) {
|
|
14181
|
-
F2.printFilter(ast, () =>
|
|
14396
|
+
F2.printFilter(ast, () => PRINT_WORDS("WITH"));
|
|
14182
14397
|
SUBRULE(iri2, ast.graph);
|
|
14183
14398
|
}
|
|
14184
14399
|
if (ast.delete.length > 0) {
|
|
14185
14400
|
F2.printFilter(ast, () => {
|
|
14186
14401
|
C[traqulaIndentation] += indentInc;
|
|
14187
|
-
|
|
14402
|
+
PRINT_WORDS("DELETE", "{");
|
|
14403
|
+
NEW_LINE();
|
|
14188
14404
|
});
|
|
14189
14405
|
SUBRULE(quads, F2.wrap(ast.delete, ast.loc));
|
|
14190
14406
|
F2.printFilter(ast, () => {
|
|
14191
14407
|
C[traqulaIndentation] -= indentInc;
|
|
14192
|
-
PRINT_ON_EMPTY("}
|
|
14408
|
+
PRINT_ON_EMPTY("}");
|
|
14409
|
+
NEW_LINE();
|
|
14193
14410
|
});
|
|
14194
14411
|
}
|
|
14195
14412
|
if (ast.insert.length > 0) {
|
|
14196
14413
|
F2.printFilter(ast, () => {
|
|
14197
14414
|
C[traqulaIndentation] += indentInc;
|
|
14198
|
-
|
|
14415
|
+
PRINT_WORDS("INSERT", "{");
|
|
14416
|
+
NEW_LINE();
|
|
14199
14417
|
});
|
|
14200
14418
|
SUBRULE(quads, F2.wrap(ast.insert, ast.loc));
|
|
14201
14419
|
F2.printFilter(ast, () => {
|
|
14202
14420
|
C[traqulaIndentation] -= indentInc;
|
|
14203
|
-
PRINT_ON_EMPTY("}
|
|
14421
|
+
PRINT_ON_EMPTY("} ");
|
|
14422
|
+
NEW_LINE();
|
|
14204
14423
|
});
|
|
14205
14424
|
}
|
|
14206
14425
|
SUBRULE(usingClauseStar, ast.from);
|
|
14207
|
-
F2.printFilter(ast, () =>
|
|
14426
|
+
F2.printFilter(ast, () => PRINT_WORDS("WHERE"));
|
|
14208
14427
|
SUBRULE(groupGraphPattern, ast.where);
|
|
14209
14428
|
}
|
|
14210
14429
|
};
|
|
@@ -14328,18 +14547,19 @@ var quadsNotTriples = {
|
|
|
14328
14547
|
const close = CONSUME(symbols_exports.RCurly);
|
|
14329
14548
|
return ACTION(() => C.astFactory.graphQuads(name, triples ?? C.astFactory.patternBgp([], C.astFactory.sourceLocationNoMaterialize()), C.astFactory.sourceLocation(graph2, close)));
|
|
14330
14549
|
},
|
|
14331
|
-
gImpl: ({ SUBRULE, PRINT_WORD,
|
|
14550
|
+
gImpl: ({ SUBRULE, PRINT_WORD, NEW_LINE, PRINT_ON_OWN_LINE }) => (ast, C) => {
|
|
14332
14551
|
const { astFactory: F2, indentInc } = C;
|
|
14333
14552
|
F2.printFilter(ast, () => PRINT_WORD("GRAPH"));
|
|
14334
14553
|
SUBRULE(varOrTerm, ast.graph);
|
|
14335
14554
|
F2.printFilter(ast, () => {
|
|
14336
14555
|
C[traqulaIndentation] += indentInc;
|
|
14337
|
-
PRINT_WORD("{
|
|
14556
|
+
PRINT_WORD("{");
|
|
14557
|
+
NEW_LINE();
|
|
14338
14558
|
});
|
|
14339
14559
|
SUBRULE(triplesBlock, ast.triples);
|
|
14340
14560
|
F2.printFilter(ast, () => {
|
|
14341
14561
|
C[traqulaIndentation] -= indentInc;
|
|
14342
|
-
|
|
14562
|
+
PRINT_ON_OWN_LINE("}");
|
|
14343
14563
|
});
|
|
14344
14564
|
}
|
|
14345
14565
|
};
|