@traqula/rules-sparql-1-1 0.0.1-alpha.176 → 0.0.1
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/RoundTripTypes.d.ts +379 -0
- package/lib/RoundTripTypes.js +2 -0
- package/lib/RoundTripTypes.js.map +1 -0
- package/lib/Sparql11types.d.ts +18 -245
- package/lib/Sparql11types.js.map +1 -1
- package/lib/SparqlParser.d.ts +13 -4
- package/lib/SparqlParser.js +7 -4
- package/lib/SparqlParser.js.map +1 -1
- package/lib/expressionHelpers.d.ts +8 -19
- package/lib/expressionHelpers.js +40 -103
- package/lib/expressionHelpers.js.map +1 -1
- package/lib/factory.d.ts +447 -0
- package/lib/factory.js +105 -0
- package/lib/factory.js.map +1 -0
- package/lib/factoryMixins/ContextFactory.d.ts +38 -0
- package/lib/factoryMixins/ContextFactory.js +30 -0
- package/lib/factoryMixins/ContextFactory.js.map +1 -0
- package/lib/factoryMixins/ExpressionFactory.d.ts +60 -0
- package/lib/factoryMixins/ExpressionFactory.js +83 -0
- package/lib/factoryMixins/ExpressionFactory.js.map +1 -0
- package/lib/factoryMixins/GraphRefFactory.d.ts +43 -0
- package/lib/factoryMixins/GraphRefFactory.js +51 -0
- package/lib/factoryMixins/GraphRefFactory.js.map +1 -0
- package/lib/factoryMixins/PathFactory.d.ts +51 -0
- package/lib/factoryMixins/PathFactory.js +68 -0
- package/lib/factoryMixins/PathFactory.js.map +1 -0
- package/lib/factoryMixins/Patternfactory.d.ts +55 -0
- package/lib/factoryMixins/Patternfactory.js +98 -0
- package/lib/factoryMixins/Patternfactory.js.map +1 -0
- package/lib/factoryMixins/QueryFactory.d.ts +41 -0
- package/lib/factoryMixins/QueryFactory.js +43 -0
- package/lib/factoryMixins/QueryFactory.js.map +1 -0
- package/lib/factoryMixins/SolutionModifiersFactory.d.ts +43 -0
- package/lib/factoryMixins/SolutionModifiersFactory.js +55 -0
- package/lib/factoryMixins/SolutionModifiersFactory.js.map +1 -0
- package/lib/factoryMixins/TermFactory.d.ts +76 -0
- package/lib/factoryMixins/TermFactory.js +84 -0
- package/lib/factoryMixins/TermFactory.js.map +1 -0
- package/lib/factoryMixins/UpdateOperationFactory.d.ts +68 -0
- package/lib/factoryMixins/UpdateOperationFactory.js +126 -0
- package/lib/factoryMixins/UpdateOperationFactory.js.map +1 -0
- package/lib/factoryMixins/mixins.d.ts +14 -0
- package/lib/factoryMixins/mixins.js +20 -0
- package/lib/factoryMixins/mixins.js.map +1 -0
- package/lib/grammar/builtIn.d.ts +59 -59
- package/lib/grammar/builtIn.js +50 -57
- package/lib/grammar/builtIn.js.map +1 -1
- package/lib/grammar/dataSetClause.d.ts +22 -9
- package/lib/grammar/dataSetClause.js +57 -14
- package/lib/grammar/dataSetClause.js.map +1 -1
- package/lib/grammar/expression.d.ts +12 -16
- package/lib/grammar/expression.js +224 -296
- package/lib/grammar/expression.js.map +1 -1
- package/lib/grammar/general.d.ts +8 -8
- package/lib/grammar/general.js +59 -94
- package/lib/grammar/general.js.map +1 -1
- package/lib/grammar/literals.d.ts +16 -13
- package/lib/grammar/literals.js +161 -144
- package/lib/grammar/literals.js.map +1 -1
- package/lib/grammar/propertyPaths.d.ts +16 -12
- package/lib/grammar/propertyPaths.js +100 -129
- package/lib/grammar/propertyPaths.js.map +1 -1
- package/lib/grammar/queryUnit/queryUnit.d.ts +13 -17
- package/lib/grammar/queryUnit/queryUnit.js +195 -329
- package/lib/grammar/queryUnit/queryUnit.js.map +1 -1
- package/lib/grammar/solutionModifier.d.ts +12 -11
- package/lib/grammar/solutionModifier.js +125 -109
- package/lib/grammar/solutionModifier.js.map +1 -1
- package/lib/grammar/tripleBlock.d.ts +24 -33
- package/lib/grammar/tripleBlock.js +172 -126
- package/lib/grammar/tripleBlock.js.map +1 -1
- package/lib/grammar/updateUnit/updateUnit.d.ts +28 -33
- package/lib/grammar/updateUnit/updateUnit.js +282 -367
- package/lib/grammar/updateUnit/updateUnit.js.map +1 -1
- package/lib/grammar/whereClause.d.ts +20 -19
- package/lib/grammar/whereClause.js +232 -245
- package/lib/grammar/whereClause.js.map +1 -1
- package/lib/grammar-helpers/utils.d.ts +0 -4
- package/lib/grammar-helpers/utils.js +0 -37
- package/lib/grammar-helpers/utils.js.map +1 -1
- package/lib/index.cjs +3061 -2438
- package/lib/index.d.ts +4 -2
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/lexer/lexer.d.ts +4 -3
- package/lib/lexer/lexer.js +11 -7
- package/lib/lexer/lexer.js.map +1 -1
- package/lib/lexer/terminals.d.ts +0 -34
- package/lib/lexer/terminals.js +35 -37
- package/lib/lexer/terminals.js.map +1 -1
- package/lib/utils.d.ts +0 -3
- package/lib/utils.js +0 -6
- package/lib/utils.js.map +1 -1
- package/lib/validation/validators.d.ts +14 -0
- package/lib/validation/validators.js +235 -0
- package/lib/validation/validators.js.map +1 -0
- package/package.json +6 -8
- package/lib/Wildcard.d.ts +0 -9
- package/lib/Wildcard.js +0 -19
- package/lib/Wildcard.js.map +0 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
const nodeType = 'updateOperation';
|
|
2
|
+
// eslint-disable-next-line ts/explicit-function-return-type
|
|
3
|
+
export function UpdateOperationFactoryMixin(Base) {
|
|
4
|
+
return class UpdateOperationFactory extends Base {
|
|
5
|
+
isUpdateOperation(obj) {
|
|
6
|
+
return this.isOfType(obj, nodeType);
|
|
7
|
+
}
|
|
8
|
+
updateOperationLoad(loc, source, silent, destination) {
|
|
9
|
+
return {
|
|
10
|
+
type: nodeType,
|
|
11
|
+
subType: 'load',
|
|
12
|
+
silent,
|
|
13
|
+
source,
|
|
14
|
+
...(destination && { destination }),
|
|
15
|
+
loc,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
isUpdateOperationLoad(obj) {
|
|
19
|
+
return this.isOfSubType(obj, nodeType, 'load');
|
|
20
|
+
}
|
|
21
|
+
updateOperationClearDrop(subType, silent, destination, loc) {
|
|
22
|
+
return {
|
|
23
|
+
type: 'updateOperation',
|
|
24
|
+
subType,
|
|
25
|
+
silent,
|
|
26
|
+
destination,
|
|
27
|
+
loc,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
updateOperationClear(destination, silent, loc) {
|
|
31
|
+
return this.updateOperationClearDrop('clear', silent, destination, loc);
|
|
32
|
+
}
|
|
33
|
+
;
|
|
34
|
+
isUpdateOperationClear(obj) {
|
|
35
|
+
return this.isOfSubType(obj, nodeType, 'clear');
|
|
36
|
+
}
|
|
37
|
+
updateOperationDrop(destination, silent, loc) {
|
|
38
|
+
return this.updateOperationClearDrop('drop', silent, destination, loc);
|
|
39
|
+
}
|
|
40
|
+
isUpdateOperationDrop(obj) {
|
|
41
|
+
return this.isOfSubType(obj, nodeType, 'drop');
|
|
42
|
+
}
|
|
43
|
+
updateOperationCreate(destination, silent, loc) {
|
|
44
|
+
return {
|
|
45
|
+
type: 'updateOperation',
|
|
46
|
+
subType: 'create',
|
|
47
|
+
silent,
|
|
48
|
+
destination,
|
|
49
|
+
loc,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
isUpdateOperationCreate(obj) {
|
|
53
|
+
return this.isOfSubType(obj, nodeType, 'create');
|
|
54
|
+
}
|
|
55
|
+
updateOperationAddMoveCopy(subType, source, destination, silent, loc) {
|
|
56
|
+
return {
|
|
57
|
+
type: 'updateOperation',
|
|
58
|
+
subType,
|
|
59
|
+
silent,
|
|
60
|
+
source,
|
|
61
|
+
destination,
|
|
62
|
+
loc,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
updateOperationAdd(source, destination, silent, loc) {
|
|
66
|
+
return this.updateOperationAddMoveCopy('add', source, destination, silent, loc);
|
|
67
|
+
}
|
|
68
|
+
isUpdateOperationAdd(obj) {
|
|
69
|
+
return this.isOfSubType(obj, nodeType, 'add');
|
|
70
|
+
}
|
|
71
|
+
updateOperationMove(source, destination, silent, loc) {
|
|
72
|
+
return this.updateOperationAddMoveCopy('move', source, destination, silent, loc);
|
|
73
|
+
}
|
|
74
|
+
isUpdateOperationMove(obj) {
|
|
75
|
+
return this.isOfSubType(obj, nodeType, 'move');
|
|
76
|
+
}
|
|
77
|
+
updateOperationCopy(source, destination, silent, loc) {
|
|
78
|
+
return this.updateOperationAddMoveCopy('copy', source, destination, silent, loc);
|
|
79
|
+
}
|
|
80
|
+
isUpdateOperationCopy(obj) {
|
|
81
|
+
return this.isOfSubType(obj, nodeType, 'copy');
|
|
82
|
+
}
|
|
83
|
+
updateOperationInsDelDataWhere(subType, data, loc) {
|
|
84
|
+
return {
|
|
85
|
+
type: 'updateOperation',
|
|
86
|
+
subType,
|
|
87
|
+
data,
|
|
88
|
+
loc,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
updateOperationInsertData(data, loc) {
|
|
92
|
+
return this.updateOperationInsDelDataWhere('insertdata', data, loc);
|
|
93
|
+
}
|
|
94
|
+
isUpdateOperationInsertData(obj) {
|
|
95
|
+
return this.isOfSubType(obj, nodeType, 'insertdata');
|
|
96
|
+
}
|
|
97
|
+
updateOperationDeleteData(data, loc) {
|
|
98
|
+
return this.updateOperationInsDelDataWhere('deletedata', data, loc);
|
|
99
|
+
}
|
|
100
|
+
isUpdateOperationDeleteData(obj) {
|
|
101
|
+
return this.isOfSubType(obj, nodeType, 'deletedata');
|
|
102
|
+
}
|
|
103
|
+
updateOperationDeleteWhere(data, loc) {
|
|
104
|
+
return this.updateOperationInsDelDataWhere('deletewhere', data, loc);
|
|
105
|
+
}
|
|
106
|
+
isUpdateOperationDeleteWhere(obj) {
|
|
107
|
+
return this.isOfSubType(obj, nodeType, 'deletewhere');
|
|
108
|
+
}
|
|
109
|
+
updateOperationModify(loc, insert, del, where, from, graph) {
|
|
110
|
+
return {
|
|
111
|
+
type: 'updateOperation',
|
|
112
|
+
subType: 'modify',
|
|
113
|
+
insert: insert ?? [],
|
|
114
|
+
delete: del ?? [],
|
|
115
|
+
graph,
|
|
116
|
+
where,
|
|
117
|
+
from,
|
|
118
|
+
loc,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
isUpdateOperationModify(obj) {
|
|
122
|
+
return this.isOfSubType(obj, nodeType, 'modify');
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=UpdateOperationFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UpdateOperationFactory.js","sourceRoot":"","sources":["UpdateOperationFactory.ts"],"names":[],"mappings":"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","sourcesContent":["import type { CoreFactory, SourceLocation, SubTyped, Typed } from '@traqula/core';\nimport type {\n DatasetClauses,\n GraphRef,\n GraphRefDefault,\n GraphRefSpecific,\n PatternGroup,\n Quads,\n TermIri,\n UpdateOperationAdd,\n UpdateOperationClear,\n UpdateOperationCopy,\n UpdateOperationCreate,\n UpdateOperationDeleteData,\n UpdateOperationDeleteWhere,\n UpdateOperationDrop,\n UpdateOperationInsertData,\n UpdateOperationLoad,\n UpdateOperationModify,\n UpdateOperationMove,\n} from '../RoundTripTypes';\nimport type { Constructor } from './mixins';\n\ntype NodeType = 'updateOperation';\nconst nodeType: NodeType = 'updateOperation';\n\n// eslint-disable-next-line ts/explicit-function-return-type\nexport function UpdateOperationFactoryMixin<TBase extends Constructor<CoreFactory>>(Base: TBase) {\n return class UpdateOperationFactory extends Base {\n public isUpdateOperation(obj: object): obj is Typed<NodeType> {\n return this.isOfType(obj, nodeType);\n }\n\n public updateOperationLoad(\n loc: SourceLocation,\n source: TermIri,\n silent: boolean,\n destination?: GraphRefSpecific | undefined,\n ): UpdateOperationLoad {\n return {\n type: nodeType,\n subType: 'load',\n silent,\n source,\n ...(destination && { destination }),\n loc,\n };\n }\n\n public isUpdateOperationLoad(obj: object): obj is SubTyped<NodeType, 'load'> {\n return this.isOfSubType(obj, nodeType, 'load');\n }\n\n public updateOperationClearDrop(subType: 'clear', silent: boolean, destination: GraphRef, loc: SourceLocation):\n UpdateOperationClear;\n public updateOperationClearDrop(subType: 'drop', silent: boolean, destination: GraphRef, loc: SourceLocation):\n UpdateOperationDrop;\n public updateOperationClearDrop(\n subType: 'clear' | 'drop',\n silent: boolean,\n destination: GraphRef,\n loc: SourceLocation\n ): UpdateOperationClear | UpdateOperationDrop;\n public updateOperationClearDrop(\n subType: 'clear' | 'drop',\n silent: boolean,\n destination: GraphRef,\n loc: SourceLocation,\n ): UpdateOperationClear | UpdateOperationDrop {\n return {\n type: 'updateOperation',\n subType,\n silent,\n destination,\n loc,\n };\n }\n\n public updateOperationClear(\n destination: GraphRef,\n silent: boolean,\n loc: SourceLocation,\n ): UpdateOperationClear {\n return this.updateOperationClearDrop('clear', silent, destination, loc);\n };\n\n public isUpdateOperationClear(obj: object): obj is SubTyped<NodeType, 'clear'> {\n return this.isOfSubType(obj, nodeType, 'clear');\n }\n\n public updateOperationDrop(\n destination: GraphRef,\n silent: boolean,\n loc: SourceLocation,\n ): UpdateOperationDrop {\n return this.updateOperationClearDrop('drop', silent, destination, loc);\n }\n\n public isUpdateOperationDrop(obj: object): obj is SubTyped<NodeType, 'drop'> {\n return this.isOfSubType(obj, nodeType, 'drop');\n }\n\n public updateOperationCreate(\n destination: GraphRefSpecific,\n silent: boolean,\n loc: SourceLocation,\n ): UpdateOperationCreate {\n return {\n type: 'updateOperation',\n subType: 'create',\n silent,\n destination,\n loc,\n };\n }\n\n public isUpdateOperationCreate(obj: object): obj is SubTyped<NodeType, 'create'> {\n return this.isOfSubType(obj, nodeType, 'create');\n }\n\n public updateOperationAddMoveCopy(\n subType: 'add',\n source: GraphRefDefault | GraphRefSpecific,\n destination: GraphRefDefault | GraphRefSpecific,\n silent: boolean,\n loc: SourceLocation,\n ): UpdateOperationAdd;\n public updateOperationAddMoveCopy(\n subType: 'move',\n source: GraphRefDefault | GraphRefSpecific,\n destination: GraphRefDefault | GraphRefSpecific,\n silent: boolean,\n loc: SourceLocation,\n ): UpdateOperationMove ;\n public updateOperationAddMoveCopy(\n subType: 'copy',\n source: GraphRefDefault | GraphRefSpecific,\n destination: GraphRefDefault | GraphRefSpecific,\n silent: boolean,\n loc: SourceLocation,\n ): UpdateOperationCopy;\n public updateOperationAddMoveCopy(\n subType: 'add' | 'move' | 'copy',\n source: GraphRefDefault | GraphRefSpecific,\n destination: GraphRefDefault | GraphRefSpecific,\n silent: boolean,\n loc: SourceLocation,\n ): UpdateOperationAdd | UpdateOperationMove | UpdateOperationCopy;\n public updateOperationAddMoveCopy(\n subType: 'add' | 'move' | 'copy',\n source: GraphRefDefault | GraphRefSpecific,\n destination: GraphRefDefault | GraphRefSpecific,\n silent: boolean,\n loc: SourceLocation,\n ): UpdateOperationAdd | UpdateOperationMove | UpdateOperationCopy {\n return {\n type: 'updateOperation',\n subType,\n silent,\n source,\n destination,\n loc,\n };\n }\n\n public updateOperationAdd(\n source: GraphRefDefault | GraphRefSpecific,\n destination: GraphRefDefault | GraphRefSpecific,\n silent: boolean,\n loc: SourceLocation,\n ): UpdateOperationAdd {\n return this.updateOperationAddMoveCopy('add', source, destination, silent, loc);\n }\n\n public isUpdateOperationAdd(obj: object): obj is SubTyped<NodeType, 'add'> {\n return this.isOfSubType(obj, nodeType, 'add');\n }\n\n public updateOperationMove(\n source: GraphRefDefault | GraphRefSpecific,\n destination: GraphRefDefault | GraphRefSpecific,\n silent: boolean,\n loc: SourceLocation,\n ): UpdateOperationMove {\n return this.updateOperationAddMoveCopy('move', source, destination, silent, loc);\n }\n\n public isUpdateOperationMove(obj: object): obj is SubTyped<NodeType, 'move'> {\n return this.isOfSubType(obj, nodeType, 'move');\n }\n\n public updateOperationCopy(\n source: GraphRefDefault | GraphRefSpecific,\n destination: GraphRefDefault | GraphRefSpecific,\n silent: boolean,\n loc: SourceLocation,\n ): UpdateOperationCopy {\n return this.updateOperationAddMoveCopy('copy', source, destination, silent, loc);\n }\n\n public isUpdateOperationCopy(obj: object): obj is SubTyped<NodeType, 'copy'> {\n return this.isOfSubType(obj, nodeType, 'copy');\n }\n\n public updateOperationInsDelDataWhere(subType: 'insertdata', data: Quads[], loc: SourceLocation):\n UpdateOperationInsertData;\n public updateOperationInsDelDataWhere(subType: 'deletedata', data: Quads[], loc: SourceLocation):\n UpdateOperationDeleteData;\n public updateOperationInsDelDataWhere(subType: 'deletewhere', data: Quads[], loc: SourceLocation):\n UpdateOperationDeleteWhere;\n public updateOperationInsDelDataWhere(\n subType: 'insertdata' | 'deletedata' | 'deletewhere',\n data: Quads[],\n loc: SourceLocation,\n ): UpdateOperationInsertData | UpdateOperationDeleteData | UpdateOperationDeleteWhere;\n public updateOperationInsDelDataWhere(\n subType: 'insertdata' | 'deletedata' | 'deletewhere',\n data: Quads[],\n loc: SourceLocation,\n ): UpdateOperationInsertData | UpdateOperationDeleteData | UpdateOperationDeleteWhere {\n return {\n type: 'updateOperation',\n subType,\n data,\n loc,\n };\n }\n\n public updateOperationInsertData(data: Quads[], loc: SourceLocation): UpdateOperationInsertData {\n return this.updateOperationInsDelDataWhere('insertdata', data, loc);\n }\n\n public isUpdateOperationInsertData(obj: object): obj is SubTyped<NodeType, 'insertdata'> {\n return this.isOfSubType(obj, nodeType, 'insertdata');\n }\n\n public updateOperationDeleteData(data: Quads[], loc: SourceLocation): UpdateOperationDeleteData {\n return this.updateOperationInsDelDataWhere('deletedata', data, loc);\n }\n\n public isUpdateOperationDeleteData(obj: object): obj is SubTyped<NodeType, 'deletedata'> {\n return this.isOfSubType(obj, nodeType, 'deletedata');\n }\n\n public updateOperationDeleteWhere(data: Quads[], loc: SourceLocation): UpdateOperationDeleteWhere {\n return this.updateOperationInsDelDataWhere('deletewhere', data, loc);\n }\n\n public isUpdateOperationDeleteWhere(obj: object): obj is SubTyped<NodeType, 'deletewhere'> {\n return this.isOfSubType(obj, nodeType, 'deletewhere');\n }\n\n public updateOperationModify(\n loc: SourceLocation,\n insert: Quads[] | undefined,\n del: Quads[] | undefined,\n where: PatternGroup,\n from: DatasetClauses,\n graph?: TermIri | undefined,\n ): UpdateOperationModify {\n return {\n type: 'updateOperation',\n subType: 'modify',\n insert: insert ?? [],\n delete: del ?? [],\n graph,\n where,\n from,\n loc,\n };\n }\n\n public isUpdateOperationModify(obj: object): obj is SubTyped<NodeType, 'modify'> {\n return this.isOfSubType(obj, nodeType, 'modify');\n }\n };\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* We use mixins as explained by the official TypeScript documentation:
|
|
3
|
+
* https://www.typescriptlang.org/docs/handbook/mixins.html
|
|
4
|
+
*/
|
|
5
|
+
export type Constructor<T = object> = new (...args: any[]) => T;
|
|
6
|
+
export type Mixin<Base = object, U extends Base = Base> = (superclass: Constructor<Base>) => Constructor<U>;
|
|
7
|
+
export declare function asArg<T>(arg: T): FlatCall<T>;
|
|
8
|
+
declare class FlatCall<Input> {
|
|
9
|
+
private input;
|
|
10
|
+
constructor(input: Input);
|
|
11
|
+
call<Out>(func: (input: Input) => Out): FlatCall<Out>;
|
|
12
|
+
returns(): Input;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* We use mixins as explained by the official TypeScript documentation:
|
|
3
|
+
* https://www.typescriptlang.org/docs/handbook/mixins.html
|
|
4
|
+
*/
|
|
5
|
+
export function asArg(arg) {
|
|
6
|
+
return new FlatCall(arg);
|
|
7
|
+
}
|
|
8
|
+
class FlatCall {
|
|
9
|
+
constructor(input) {
|
|
10
|
+
this.input = input;
|
|
11
|
+
}
|
|
12
|
+
call(func) {
|
|
13
|
+
this.input = func(this.input);
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
returns() {
|
|
17
|
+
return this.input;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=mixins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mixins.js","sourceRoot":"","sources":["mixins.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,UAAU,KAAK,CAAI,GAAM;IAC7B,OAAO,IAAI,QAAQ,CAAI,GAAG,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,QAAQ;IACZ,YAA2B,KAAY;QAAZ,UAAK,GAAL,KAAK,CAAO;IAAG,CAAC;IACpC,IAAI,CAAM,IAA2B;QAC1C,IAAI,CAAC,KAAK,GAAqB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChD,OAAiC,IAAI,CAAC;IACxC,CAAC;IAEM,OAAO;QACZ,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF","sourcesContent":["/**\n * We use mixins as explained by the official TypeScript documentation:\n * https://www.typescriptlang.org/docs/handbook/mixins.html\n */\n\nexport type Constructor<T = object> = new (...args: any[]) => T;\n\nexport type Mixin<Base = object, U extends Base = Base> = (superclass: Constructor<Base>) => Constructor<U>;\n\nexport function asArg<T>(arg: T): FlatCall<T> {\n return new FlatCall<T>(arg);\n}\n\nclass FlatCall<Input> {\n public constructor(private input: Input) {}\n public call<Out>(func: (input: Input) => Out): FlatCall<Out> {\n this.input = <Input> <unknown> func(this.input);\n return <FlatCall<Out>> <unknown> this;\n }\n\n public returns(): Input {\n return this.input;\n }\n}\n"]}
|
package/lib/grammar/builtIn.d.ts
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
import type { IOrAlt } from '@chevrotain/types';
|
|
2
2
|
import type { ImplArgs } from '@traqula/core';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
export declare const builtInStr: RuleDefExpressionFunctionX<"builtInStr", [Expression]>;
|
|
6
|
-
export declare const builtInLang: RuleDefExpressionFunctionX<"builtInLang", [Expression]>;
|
|
7
|
-
export declare const builtInLangmatches: RuleDefExpressionFunctionX<"builtInLangmatches", [Expression, Expression]>;
|
|
8
|
-
export declare const builtInDatatype: RuleDefExpressionFunctionX<"builtInDatatype", [Expression]>;
|
|
9
|
-
export declare const builtInBound: RuleDefExpressionFunctionX<"builtInBound", [import("
|
|
10
|
-
export declare const builtInIri: RuleDefExpressionFunctionX<"builtInIri", [Expression]>;
|
|
11
|
-
export declare const builtInUri: RuleDefExpressionFunctionX<"builtInUri", [Expression]>;
|
|
12
|
-
export declare const builtInBnodeSparqlJs: RuleDefExpressionFunctionX<
|
|
13
|
-
export declare const builtInRand: RuleDefExpressionFunctionX<"builtInRand", []>;
|
|
14
|
-
export declare const builtInAbs: RuleDefExpressionFunctionX<"builtInAbs", [Expression]>;
|
|
15
|
-
export declare const builtInCeil: RuleDefExpressionFunctionX<"builtInCeil", [Expression]>;
|
|
16
|
-
export declare const builtInFloor: RuleDefExpressionFunctionX<"builtInFloor", [Expression]>;
|
|
17
|
-
export declare const builtInRound: RuleDefExpressionFunctionX<"builtInRound", [Expression]>;
|
|
18
|
-
export declare const builtInConcat: RuleDefExpressionFunctionX<"builtInConcat", Expression[]>;
|
|
19
|
-
export declare const builtInStrlen: RuleDefExpressionFunctionX<"builtInStrlen", [Expression]>;
|
|
20
|
-
export declare const builtInUcase: RuleDefExpressionFunctionX<"builtInUcase", [Expression]>;
|
|
21
|
-
export declare const builtInLcase: RuleDefExpressionFunctionX<"builtInLcase", [Expression]>;
|
|
22
|
-
export declare const builtInEncode_for_uri: RuleDefExpressionFunctionX<"builtInEncode_for_uri", [Expression]>;
|
|
23
|
-
export declare const builtInContains: RuleDefExpressionFunctionX<"builtInContains", [Expression, Expression]>;
|
|
24
|
-
export declare const builtInStrstarts: RuleDefExpressionFunctionX<"builtInStrstarts", [Expression, Expression]>;
|
|
25
|
-
export declare const builtInStrends: RuleDefExpressionFunctionX<"builtInStrends", [Expression, Expression]>;
|
|
26
|
-
export declare const builtInStrbefore: RuleDefExpressionFunctionX<"builtInStrbefore", [Expression, Expression]>;
|
|
27
|
-
export declare const builtInStrafter: RuleDefExpressionFunctionX<"builtInStrafter", [Expression, Expression]>;
|
|
28
|
-
export declare const builtInYear: RuleDefExpressionFunctionX<"builtInYear", [Expression]>;
|
|
29
|
-
export declare const builtInMonth: RuleDefExpressionFunctionX<"builtInMonth", [Expression]>;
|
|
30
|
-
export declare const builtInDay: RuleDefExpressionFunctionX<"builtInDay", [Expression]>;
|
|
31
|
-
export declare const builtInHours: RuleDefExpressionFunctionX<"builtInHours", [Expression]>;
|
|
32
|
-
export declare const builtInMinutes: RuleDefExpressionFunctionX<"builtInMinutes", [Expression]>;
|
|
33
|
-
export declare const builtInSeconds: RuleDefExpressionFunctionX<"builtInSeconds", [Expression]>;
|
|
34
|
-
export declare const builtInTimezone: RuleDefExpressionFunctionX<"builtInTimezone", [Expression]>;
|
|
35
|
-
export declare const builtInTz: RuleDefExpressionFunctionX<"builtInTz", [Expression]>;
|
|
36
|
-
export declare const builtInNow: RuleDefExpressionFunctionX<"builtInNow", []>;
|
|
37
|
-
export declare const builtInUuid: RuleDefExpressionFunctionX<"builtInUuid", []>;
|
|
38
|
-
export declare const builtInStruuid: RuleDefExpressionFunctionX<"builtInStruuid", []>;
|
|
39
|
-
export declare const builtInMd5: RuleDefExpressionFunctionX<"builtInMd5", [Expression]>;
|
|
40
|
-
export declare const builtInSha1: RuleDefExpressionFunctionX<"builtInSha1", [Expression]>;
|
|
41
|
-
export declare const builtInSha256: RuleDefExpressionFunctionX<"builtInSha256", [Expression]>;
|
|
42
|
-
export declare const builtInSha384: RuleDefExpressionFunctionX<"builtInSha384", [Expression]>;
|
|
43
|
-
export declare const builtInSha512: RuleDefExpressionFunctionX<"builtInSha512", [Expression]>;
|
|
44
|
-
export declare const builtInCoalesce: RuleDefExpressionFunctionX<"builtInCoalesce", Expression[]>;
|
|
45
|
-
export declare const builtInIf: RuleDefExpressionFunctionX<"builtInIf", [Expression, Expression, Expression]>;
|
|
46
|
-
export declare const builtInStrlang: RuleDefExpressionFunctionX<"builtInStrlang", [Expression, Expression]>;
|
|
47
|
-
export declare const builtInStrdt: RuleDefExpressionFunctionX<"builtInStrdt", [Expression, Expression]>;
|
|
48
|
-
export declare const builtInSameterm: RuleDefExpressionFunctionX<"builtInSameterm", [Expression, Expression]>;
|
|
49
|
-
export declare const builtInIsiri: RuleDefExpressionFunctionX<"builtInIsiri", [Expression]>;
|
|
50
|
-
export declare const builtInIsuri: RuleDefExpressionFunctionX<"builtInIsuri", [Expression]>;
|
|
51
|
-
export declare const builtInIsblank: RuleDefExpressionFunctionX<"builtInIsblank", [Expression]>;
|
|
52
|
-
export declare const builtInIsliteral: RuleDefExpressionFunctionX<"builtInIsliteral", [Expression]>;
|
|
53
|
-
export declare const builtInIsnumeric: RuleDefExpressionFunctionX<"builtInIsnumeric", [Expression]>;
|
|
3
|
+
import type { Expression, ExpressionAggregate, ExpressionAggregateDefault, ExpressionAggregateOnWildcard, ExpressionAggregateSeparator } from '../RoundTripTypes';
|
|
4
|
+
import type { SparqlGrammarRule, SparqlRule } from '../Sparql11types';
|
|
5
|
+
export declare const builtInStr: import(".").RuleDefExpressionFunctionX<"builtInStr", [Expression]>;
|
|
6
|
+
export declare const builtInLang: import(".").RuleDefExpressionFunctionX<"builtInLang", [Expression]>;
|
|
7
|
+
export declare const builtInLangmatches: import(".").RuleDefExpressionFunctionX<"builtInLangmatches", [Expression, Expression]>;
|
|
8
|
+
export declare const builtInDatatype: import(".").RuleDefExpressionFunctionX<"builtInDatatype", [Expression]>;
|
|
9
|
+
export declare const builtInBound: import(".").RuleDefExpressionFunctionX<"builtInBound", [import("..").TermVariable]>;
|
|
10
|
+
export declare const builtInIri: import(".").RuleDefExpressionFunctionX<"builtInIri", [Expression]>;
|
|
11
|
+
export declare const builtInUri: import(".").RuleDefExpressionFunctionX<"builtInUri", [Expression]>;
|
|
12
|
+
export declare const builtInBnodeSparqlJs: import(".").RuleDefExpressionFunctionX<"builtInBnode", [] | [Expression]>;
|
|
13
|
+
export declare const builtInRand: import(".").RuleDefExpressionFunctionX<"builtInRand", []>;
|
|
14
|
+
export declare const builtInAbs: import(".").RuleDefExpressionFunctionX<"builtInAbs", [Expression]>;
|
|
15
|
+
export declare const builtInCeil: import(".").RuleDefExpressionFunctionX<"builtInCeil", [Expression]>;
|
|
16
|
+
export declare const builtInFloor: import(".").RuleDefExpressionFunctionX<"builtInFloor", [Expression]>;
|
|
17
|
+
export declare const builtInRound: import(".").RuleDefExpressionFunctionX<"builtInRound", [Expression]>;
|
|
18
|
+
export declare const builtInConcat: import(".").RuleDefExpressionFunctionX<"builtInConcat", Expression[]>;
|
|
19
|
+
export declare const builtInStrlen: import(".").RuleDefExpressionFunctionX<"builtInStrlen", [Expression]>;
|
|
20
|
+
export declare const builtInUcase: import(".").RuleDefExpressionFunctionX<"builtInUcase", [Expression]>;
|
|
21
|
+
export declare const builtInLcase: import(".").RuleDefExpressionFunctionX<"builtInLcase", [Expression]>;
|
|
22
|
+
export declare const builtInEncode_for_uri: import(".").RuleDefExpressionFunctionX<"builtInEncode_for_uri", [Expression]>;
|
|
23
|
+
export declare const builtInContains: import(".").RuleDefExpressionFunctionX<"builtInContains", [Expression, Expression]>;
|
|
24
|
+
export declare const builtInStrstarts: import(".").RuleDefExpressionFunctionX<"builtInStrstarts", [Expression, Expression]>;
|
|
25
|
+
export declare const builtInStrends: import(".").RuleDefExpressionFunctionX<"builtInStrends", [Expression, Expression]>;
|
|
26
|
+
export declare const builtInStrbefore: import(".").RuleDefExpressionFunctionX<"builtInStrbefore", [Expression, Expression]>;
|
|
27
|
+
export declare const builtInStrafter: import(".").RuleDefExpressionFunctionX<"builtInStrafter", [Expression, Expression]>;
|
|
28
|
+
export declare const builtInYear: import(".").RuleDefExpressionFunctionX<"builtInYear", [Expression]>;
|
|
29
|
+
export declare const builtInMonth: import(".").RuleDefExpressionFunctionX<"builtInMonth", [Expression]>;
|
|
30
|
+
export declare const builtInDay: import(".").RuleDefExpressionFunctionX<"builtInDay", [Expression]>;
|
|
31
|
+
export declare const builtInHours: import(".").RuleDefExpressionFunctionX<"builtInHours", [Expression]>;
|
|
32
|
+
export declare const builtInMinutes: import(".").RuleDefExpressionFunctionX<"builtInMinutes", [Expression]>;
|
|
33
|
+
export declare const builtInSeconds: import(".").RuleDefExpressionFunctionX<"builtInSeconds", [Expression]>;
|
|
34
|
+
export declare const builtInTimezone: import(".").RuleDefExpressionFunctionX<"builtInTimezone", [Expression]>;
|
|
35
|
+
export declare const builtInTz: import(".").RuleDefExpressionFunctionX<"builtInTz", [Expression]>;
|
|
36
|
+
export declare const builtInNow: import(".").RuleDefExpressionFunctionX<"builtInNow", []>;
|
|
37
|
+
export declare const builtInUuid: import(".").RuleDefExpressionFunctionX<"builtInUuid", []>;
|
|
38
|
+
export declare const builtInStruuid: import(".").RuleDefExpressionFunctionX<"builtInStruuid", []>;
|
|
39
|
+
export declare const builtInMd5: import(".").RuleDefExpressionFunctionX<"builtInMd5", [Expression]>;
|
|
40
|
+
export declare const builtInSha1: import(".").RuleDefExpressionFunctionX<"builtInSha1", [Expression]>;
|
|
41
|
+
export declare const builtInSha256: import(".").RuleDefExpressionFunctionX<"builtInSha256", [Expression]>;
|
|
42
|
+
export declare const builtInSha384: import(".").RuleDefExpressionFunctionX<"builtInSha384", [Expression]>;
|
|
43
|
+
export declare const builtInSha512: import(".").RuleDefExpressionFunctionX<"builtInSha512", [Expression]>;
|
|
44
|
+
export declare const builtInCoalesce: import(".").RuleDefExpressionFunctionX<"builtInCoalesce", Expression[]>;
|
|
45
|
+
export declare const builtInIf: import(".").RuleDefExpressionFunctionX<"builtInIf", [Expression, Expression, Expression]>;
|
|
46
|
+
export declare const builtInStrlang: import(".").RuleDefExpressionFunctionX<"builtInStrlang", [Expression, Expression]>;
|
|
47
|
+
export declare const builtInStrdt: import(".").RuleDefExpressionFunctionX<"builtInStrdt", [Expression, Expression]>;
|
|
48
|
+
export declare const builtInSameterm: import(".").RuleDefExpressionFunctionX<"builtInSameterm", [Expression, Expression]>;
|
|
49
|
+
export declare const builtInIsiri: import(".").RuleDefExpressionFunctionX<"builtInIsiri", [Expression]>;
|
|
50
|
+
export declare const builtInIsuri: import(".").RuleDefExpressionFunctionX<"builtInIsuri", [Expression]>;
|
|
51
|
+
export declare const builtInIsblank: import(".").RuleDefExpressionFunctionX<"builtInIsblank", [Expression]>;
|
|
52
|
+
export declare const builtInIsliteral: import(".").RuleDefExpressionFunctionX<"builtInIsliteral", [Expression]>;
|
|
53
|
+
export declare const builtInIsnumeric: import(".").RuleDefExpressionFunctionX<"builtInIsnumeric", [Expression]>;
|
|
54
54
|
export declare function builtInCallList(SUBRULE: ImplArgs['SUBRULE']): IOrAlt<Expression>[];
|
|
55
55
|
/**
|
|
56
56
|
* [[121]](https://www.w3.org/TR/sparql11-query/#rBuiltInCall)
|
|
@@ -59,31 +59,31 @@ export declare const builtInCall: SparqlGrammarRule<'builtInCall', Expression>;
|
|
|
59
59
|
/**
|
|
60
60
|
* [[122]](https://www.w3.org/TR/sparql11-query/#rBuiltInCall)
|
|
61
61
|
*/
|
|
62
|
-
export declare const regexExpression: RuleDefExpressionFunctionX<"builtInRegex", [Expression, Expression] | [Expression, Expression, Expression]>;
|
|
62
|
+
export declare const regexExpression: import(".").RuleDefExpressionFunctionX<"builtInRegex", [Expression, Expression] | [Expression, Expression, Expression]>;
|
|
63
63
|
/**
|
|
64
64
|
* [[123]](https://www.w3.org/TR/sparql11-query/#rBuiltInCall)
|
|
65
65
|
*/
|
|
66
|
-
export declare const substringExpression: RuleDefExpressionFunctionX<"builtInSubstr", [Expression, Expression] | [Expression, Expression, Expression]>;
|
|
66
|
+
export declare const substringExpression: import(".").RuleDefExpressionFunctionX<"builtInSubstr", [Expression, Expression] | [Expression, Expression, Expression]>;
|
|
67
67
|
/**
|
|
68
68
|
* [[124]](https://www.w3.org/TR/sparql11-query/#rBuiltInCall)
|
|
69
69
|
*/
|
|
70
|
-
export declare const strReplaceExpression: RuleDefExpressionFunctionX<"builtInReplace", [Expression, Expression, Expression] | [Expression, Expression, Expression, Expression]>;
|
|
70
|
+
export declare const strReplaceExpression: import(".").RuleDefExpressionFunctionX<"builtInReplace", [Expression, Expression, Expression] | [Expression, Expression, Expression, Expression]>;
|
|
71
71
|
/**
|
|
72
72
|
* [[125]](https://www.w3.org/TR/sparql11-query/#rBuiltInCall)
|
|
73
73
|
*/
|
|
74
|
-
export declare const existsFunc:
|
|
74
|
+
export declare const existsFunc: SparqlGrammarRule<"builtInExists", import("..").ExpressionPatternOperation>;
|
|
75
75
|
/**
|
|
76
76
|
* [[126]](https://www.w3.org/TR/sparql11-query/#rBuiltInCall)
|
|
77
77
|
*/
|
|
78
|
-
export declare const notExistsFunc:
|
|
79
|
-
export declare const aggregateCount:
|
|
78
|
+
export declare const notExistsFunc: SparqlGrammarRule<"builtInNotexists", import("..").ExpressionPatternOperation>;
|
|
79
|
+
export declare const aggregateCount: SparqlGrammarRule<'builtInCount', ExpressionAggregateOnWildcard | ExpressionAggregateDefault>;
|
|
80
80
|
export declare const aggregateSum: import(".").RuleDefExpressionAggregatorX<"builtInSum">;
|
|
81
81
|
export declare const aggregateMin: import(".").RuleDefExpressionAggregatorX<"builtInMin">;
|
|
82
82
|
export declare const aggregateMax: import(".").RuleDefExpressionAggregatorX<"builtInMax">;
|
|
83
83
|
export declare const aggregateAvg: import(".").RuleDefExpressionAggregatorX<"builtInAvg">;
|
|
84
84
|
export declare const aggregateSample: import(".").RuleDefExpressionAggregatorX<"builtInSample">;
|
|
85
|
-
export declare const aggregateGroup_concat: SparqlGrammarRule<'builtInGroup_concat',
|
|
85
|
+
export declare const aggregateGroup_concat: SparqlGrammarRule<'builtInGroup_concat', ExpressionAggregateDefault | ExpressionAggregateSeparator>;
|
|
86
86
|
/**
|
|
87
87
|
* [[127]](https://www.w3.org/TR/sparql11-query/#rBuiltInCall)
|
|
88
88
|
*/
|
|
89
|
-
export declare const aggregate: SparqlRule<'aggregate',
|
|
89
|
+
export declare const aggregate: SparqlRule<'aggregate', ExpressionAggregate>;
|
package/lib/grammar/builtIn.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { unCapitalize, } from '@traqula/core';
|
|
2
|
-
import { baseAggregateFunc, funcExpr1, funcExpr2, funcExpr2or3, funcExpr3, funcExpr3or4, funcExprList1, funcGroupGraphPattern, funcNil1, funcVar1, } from '../expressionHelpers';
|
|
2
|
+
import { funcExprOrNil1, baseAggregateFunc, funcExpr1, funcExpr2, funcExpr2or3, funcExpr3, funcExpr3or4, funcExprList1, funcGroupGraphPattern, funcNil1, funcVar1, } from '../expressionHelpers';
|
|
3
3
|
import * as l from '../lexer';
|
|
4
4
|
import { expression } from './expression';
|
|
5
|
-
import { string } from './literals';
|
|
5
|
+
import { string, stringEscapedLexical } from './literals';
|
|
6
6
|
export const builtInStr = funcExpr1(l.builtIn.str);
|
|
7
7
|
export const builtInLang = funcExpr1(l.builtIn.lang);
|
|
8
8
|
export const builtInLangmatches = funcExpr2(l.builtIn.langmatches);
|
|
@@ -10,35 +10,7 @@ export const builtInDatatype = funcExpr1(l.builtIn.datatype);
|
|
|
10
10
|
export const builtInBound = funcVar1(l.builtIn.bound);
|
|
11
11
|
export const builtInIri = funcExpr1(l.builtIn.iri);
|
|
12
12
|
export const builtInUri = funcExpr1(l.builtIn.uri);
|
|
13
|
-
|
|
14
|
-
export const builtInBnodeSparqlJs = {
|
|
15
|
-
name: 'builtInBnode',
|
|
16
|
-
impl: ({ CONSUME, OR, SUBRULE }) => () => {
|
|
17
|
-
const operator = CONSUME(l.builtIn.bnode);
|
|
18
|
-
const args = OR([
|
|
19
|
-
{
|
|
20
|
-
ALT: () => {
|
|
21
|
-
CONSUME(l.symbols.LParen);
|
|
22
|
-
const arg = SUBRULE(expression, undefined);
|
|
23
|
-
CONSUME(l.symbols.RParen);
|
|
24
|
-
return [arg];
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
ALT: () => {
|
|
29
|
-
CONSUME(l.terminals.nil);
|
|
30
|
-
return [];
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
]);
|
|
34
|
-
return {
|
|
35
|
-
type: 'operation',
|
|
36
|
-
operator: operator.image,
|
|
37
|
-
args,
|
|
38
|
-
};
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
// Export const builtInBnode = funcExprOrNil1(l.builtIn.bnode);
|
|
13
|
+
export const builtInBnodeSparqlJs = funcExprOrNil1(l.builtIn.bnode);
|
|
42
14
|
export const builtInRand = funcNil1(l.builtIn.rand);
|
|
43
15
|
export const builtInAbs = funcExpr1(l.builtIn.abs);
|
|
44
16
|
export const builtInCeil = funcExpr1(l.builtIn.ceil);
|
|
@@ -174,7 +146,29 @@ export const existsFunc = funcGroupGraphPattern(l.builtIn.exists);
|
|
|
174
146
|
* [[126]](https://www.w3.org/TR/sparql11-query/#rBuiltInCall)
|
|
175
147
|
*/
|
|
176
148
|
export const notExistsFunc = funcGroupGraphPattern(l.builtIn.notexists);
|
|
177
|
-
export const aggregateCount =
|
|
149
|
+
export const aggregateCount = {
|
|
150
|
+
name: unCapitalize(l.builtIn.count.name),
|
|
151
|
+
impl: ({ ACTION, CONSUME, SUBRULE, OR, OPTION }) => (C) => {
|
|
152
|
+
const operatorToken = CONSUME(l.builtIn.count);
|
|
153
|
+
CONSUME(l.symbols.LParen);
|
|
154
|
+
const distinctToken = OPTION(() => CONSUME(l.distinct));
|
|
155
|
+
const expressionVal = OR([
|
|
156
|
+
{ ALT: () => {
|
|
157
|
+
const starToken = CONSUME(l.symbols.star);
|
|
158
|
+
return ACTION(() => C.factory.wildcard(C.factory.sourceLocation(starToken)));
|
|
159
|
+
} },
|
|
160
|
+
{ ALT: () => SUBRULE(expression, undefined) },
|
|
161
|
+
]);
|
|
162
|
+
const closeToken = CONSUME(l.symbols.RParen);
|
|
163
|
+
return ACTION(() => {
|
|
164
|
+
const F = C.factory;
|
|
165
|
+
if (C.factory.isWildcard(expressionVal)) {
|
|
166
|
+
return F.aggregate(operatorToken.image, Boolean(distinctToken), expressionVal, undefined, C.factory.sourceLocation(operatorToken, closeToken));
|
|
167
|
+
}
|
|
168
|
+
return F.aggregate(operatorToken.image, Boolean(distinctToken), expressionVal, undefined, C.factory.sourceLocation(operatorToken, closeToken));
|
|
169
|
+
});
|
|
170
|
+
},
|
|
171
|
+
};
|
|
178
172
|
export const aggregateSum = baseAggregateFunc(l.builtIn.sum);
|
|
179
173
|
export const aggregateMin = baseAggregateFunc(l.builtIn.min);
|
|
180
174
|
export const aggregateMax = baseAggregateFunc(l.builtIn.max);
|
|
@@ -182,25 +176,22 @@ export const aggregateAvg = baseAggregateFunc(l.builtIn.avg);
|
|
|
182
176
|
export const aggregateSample = baseAggregateFunc(l.builtIn.sample);
|
|
183
177
|
export const aggregateGroup_concat = {
|
|
184
178
|
name: unCapitalize(l.builtIn.groupConcat.name),
|
|
185
|
-
impl: ({ CONSUME, OPTION1, SUBRULE, OPTION2 }) => () => {
|
|
186
|
-
CONSUME(l.builtIn.groupConcat);
|
|
179
|
+
impl: ({ ACTION, CONSUME, OPTION1, SUBRULE, OPTION2 }) => (C) => {
|
|
180
|
+
const operatorToken = CONSUME(l.builtIn.groupConcat);
|
|
187
181
|
CONSUME(l.symbols.LParen);
|
|
188
|
-
const
|
|
182
|
+
const distinctToken = OPTION1(() => CONSUME(l.distinct));
|
|
189
183
|
const expr = SUBRULE(expression, undefined);
|
|
190
|
-
const
|
|
184
|
+
const sep = OPTION2(() => {
|
|
191
185
|
CONSUME(l.symbols.semi);
|
|
192
186
|
CONSUME(l.separator);
|
|
193
187
|
CONSUME(l.symbols.equal);
|
|
194
188
|
return SUBRULE(string, undefined);
|
|
195
|
-
})
|
|
196
|
-
CONSUME(l.symbols.RParen);
|
|
197
|
-
return {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
distinct: Boolean(distinct),
|
|
202
|
-
separator,
|
|
203
|
-
};
|
|
189
|
+
});
|
|
190
|
+
const closeToken = CONSUME(l.symbols.RParen);
|
|
191
|
+
return ACTION(() => {
|
|
192
|
+
const F = C.factory;
|
|
193
|
+
return F.aggregate(operatorToken.image, Boolean(distinctToken), expr, sep?.value ?? ' ', F.sourceLocation(operatorToken, closeToken));
|
|
194
|
+
});
|
|
204
195
|
},
|
|
205
196
|
};
|
|
206
197
|
/**
|
|
@@ -233,22 +224,24 @@ export const aggregate = {
|
|
|
233
224
|
});
|
|
234
225
|
return result;
|
|
235
226
|
},
|
|
236
|
-
gImpl: ({ SUBRULE }) => (ast) => {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
227
|
+
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F }) => {
|
|
228
|
+
F.printFilter(ast, () => {
|
|
229
|
+
PRINT_WORD(ast.aggregation, '(');
|
|
230
|
+
if (ast.distinct) {
|
|
231
|
+
PRINT_WORD('DISTINCT');
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
const arg = ast.expression[0];
|
|
235
|
+
if (F.isWildcard(arg)) {
|
|
236
|
+
F.printFilter(ast, () => PRINT_WORD('*'));
|
|
243
237
|
}
|
|
244
238
|
else {
|
|
245
|
-
|
|
239
|
+
SUBRULE(expression, arg, undefined);
|
|
246
240
|
}
|
|
247
|
-
if (
|
|
248
|
-
|
|
241
|
+
if (F.isExpressionAggregateSeparator(ast)) {
|
|
242
|
+
F.printFilter(ast, () => PRINT_WORD(';', 'SEPARATOR', '=', stringEscapedLexical(ast.separator)));
|
|
249
243
|
}
|
|
250
|
-
|
|
251
|
-
return builder.join(' ');
|
|
244
|
+
F.printFilter(ast, () => PRINT_WORD(')'));
|
|
252
245
|
},
|
|
253
246
|
};
|
|
254
247
|
//# sourceMappingURL=builtIn.js.map
|