@traqula/generator-sparql-1-2 0.0.3 → 0.0.5
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/README.md +2 -2
- package/lib/index.cjs +1852 -1786
- package/lib/index.d.ts +221 -2
- package/lib/index.js +9 -20
- package/lib/index.js.map +1 -1
- package/package.json +9 -9
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,226 @@
|
|
|
1
|
+
import { GeneratorBuilder } from '@traqula/core';
|
|
2
|
+
import type { Wrap, Patch } from '@traqula/core';
|
|
3
|
+
import type * as T11 from '@traqula/rules-sparql-1-1';
|
|
4
|
+
import { Factory } from '@traqula/rules-sparql-1-2';
|
|
1
5
|
import type * as T12 from '@traqula/rules-sparql-1-2';
|
|
6
|
+
declare const sparql12GeneratorBuilder: GeneratorBuilder<{
|
|
7
|
+
factory: Factory;
|
|
8
|
+
}, "filter" | "add" | "clear" | "copy" | "move" | "var" | "path" | "drop" | "load" | "update" | "query" | "quads" | "graphRef" | "create" | "modify" | "datasetClauses" | "bind" | "solutionModifier" | "expression" | "aggregate" | "blankNode" | "rdfLiteral" | "iri" | "iriFull" | "prefixedName" | "prologue" | "baseDecl" | "prefixDecl" | "varOrTerm" | "graphTerm" | "usingClauses" | "groupGraphPattern" | "triplesBlock" | "triplesNodePath" | "graphNodePath" | "collectionPath" | "blankNodePropertyListPath" | "whereClause" | "generatePattern" | "graphPatternNotTriples" | "groupOrUnionGraphPattern" | "optionalGraphPattern" | "minusGraphPattern" | "graphGraphPattern" | "serviceGraphPattern" | "inlineData" | "argList" | "iriOrFunction" | "limitOffsetClauses" | "groupClause" | "havingClause" | "orderClause" | "selectQuery" | "constructQuery" | "describeQuery" | "askQuery" | "selectClause" | "update1" | "insertData" | "deleteData" | "deleteWhere" | "graphRefAll" | "quadsNotTriples" | "queryOrUpdate" | "reifiedTriple" | "versionDecl" | "annotationPath" | "annotationBlockPath" | "tripleTerm", {
|
|
9
|
+
filter: import("@traqula/core").GeneratorRule<{
|
|
10
|
+
factory: Factory;
|
|
11
|
+
}, "filter", T12.PatternFilter, []>;
|
|
12
|
+
add: import("@traqula/core").GeneratorRule<{
|
|
13
|
+
factory: Factory;
|
|
14
|
+
}, "add", T12.UpdateOperationAdd, []>;
|
|
15
|
+
clear: import("@traqula/core").GeneratorRule<{
|
|
16
|
+
factory: Factory;
|
|
17
|
+
}, "clear", T12.UpdateOperationClear, []>;
|
|
18
|
+
copy: import("@traqula/core").GeneratorRule<{
|
|
19
|
+
factory: Factory;
|
|
20
|
+
}, "copy", T12.UpdateOperationCopy, []>;
|
|
21
|
+
move: import("@traqula/core").GeneratorRule<{
|
|
22
|
+
factory: Factory;
|
|
23
|
+
}, "move", T12.UpdateOperationMove, []>;
|
|
24
|
+
var: import("@traqula/core").GeneratorRule<any, "var"> & T11.SparqlGrammarRule<"var", T11.TermVariable, []> & T11.SparqlGeneratorRule<"var", T11.TermVariable, []>;
|
|
25
|
+
path: import("@traqula/core").GeneratorRule<{
|
|
26
|
+
factory: T11.Factory;
|
|
27
|
+
}, "path", T11.Path, [boolean | undefined]>;
|
|
28
|
+
drop: import("@traqula/core").GeneratorRule<{
|
|
29
|
+
factory: Factory;
|
|
30
|
+
}, "drop", T12.UpdateOperationDrop, []>;
|
|
31
|
+
load: import("@traqula/core").GeneratorRule<{
|
|
32
|
+
factory: Factory;
|
|
33
|
+
}, "load", T12.UpdateOperationLoad, []>;
|
|
34
|
+
update: import("@traqula/core").GeneratorRule<{
|
|
35
|
+
factory: Factory;
|
|
36
|
+
}, "update", T12.Update, []>;
|
|
37
|
+
query: import("@traqula/core").GeneratorRule<{
|
|
38
|
+
factory: Factory;
|
|
39
|
+
}, "query", T12.Query, []>;
|
|
40
|
+
quads: import("@traqula/core").GeneratorRule<{
|
|
41
|
+
factory: Factory;
|
|
42
|
+
}, "quads", Wrap<T12.Quads[]>, []>;
|
|
43
|
+
graphRef: import("@traqula/core").GeneratorRule<{
|
|
44
|
+
factory: Factory;
|
|
45
|
+
}, "graphRef", T11.TermIri, []>;
|
|
46
|
+
create: import("@traqula/core").GeneratorRule<{
|
|
47
|
+
factory: Factory;
|
|
48
|
+
}, "create", T12.UpdateOperationCreate, []>;
|
|
49
|
+
modify: import("@traqula/core").GeneratorRule<{
|
|
50
|
+
factory: Factory;
|
|
51
|
+
}, "modify", T12.UpdateOperationModify, []>;
|
|
52
|
+
datasetClauses: import("@traqula/core").GeneratorRule<{
|
|
53
|
+
factory: Factory;
|
|
54
|
+
}, "datasetClauses", T12.DatasetClauses, []>;
|
|
55
|
+
bind: import("@traqula/core").GeneratorRule<{
|
|
56
|
+
factory: Factory;
|
|
57
|
+
}, "bind", T12.PatternBind, []>;
|
|
58
|
+
solutionModifier: import("@traqula/core").GeneratorRule<{
|
|
59
|
+
factory: Factory;
|
|
60
|
+
}, "solutionModifier", T12.SolutionModifiers, []>;
|
|
61
|
+
expression: import("@traqula/core").GeneratorRule<{
|
|
62
|
+
factory: Factory;
|
|
63
|
+
}, "expression", T12.Expression, []>;
|
|
64
|
+
aggregate: import("@traqula/core").GeneratorRule<{
|
|
65
|
+
factory: Factory;
|
|
66
|
+
}, "aggregate", T12.ExpressionAggregate, []>;
|
|
67
|
+
blankNode: import("@traqula/core").GeneratorRule<any, "blankNode"> & T11.SparqlGrammarRule<"blankNode", T11.TermBlank, []> & T11.SparqlGeneratorRule<"blankNode", T11.TermBlank, []>;
|
|
68
|
+
rdfLiteral: import("@traqula/core").GeneratorRule<{
|
|
69
|
+
factory: Factory;
|
|
70
|
+
}, "rdfLiteral", T11.TermLiteral, []>;
|
|
71
|
+
iri: import("@traqula/core").GeneratorRule<any, "iri"> & T11.SparqlGrammarRule<"iri", T11.TermIri, []> & T11.SparqlGeneratorRule<"iri", T11.TermIri, []>;
|
|
72
|
+
iriFull: import("@traqula/core").GeneratorRule<any, "iriFull"> & T11.SparqlGrammarRule<"iriFull", T11.TermIriFull, []> & T11.SparqlGeneratorRule<"iriFull", T11.TermIriFull, []>;
|
|
73
|
+
prefixedName: import("@traqula/core").GeneratorRule<any, "prefixedName"> & T11.SparqlGrammarRule<"prefixedName", T11.TermIriPrefixed, []> & T11.SparqlGeneratorRule<"prefixedName", T11.TermIriPrefixed, []>;
|
|
74
|
+
prologue: import("@traqula/core").GeneratorRule<{
|
|
75
|
+
factory: Factory;
|
|
76
|
+
}, "prologue", T12.ContextDefinition[], []>;
|
|
77
|
+
baseDecl: import("@traqula/core").GeneratorRule<{
|
|
78
|
+
factory: Factory;
|
|
79
|
+
}, "baseDecl", T11.ContextDefinitionBase, []>;
|
|
80
|
+
prefixDecl: import("@traqula/core").GeneratorRule<{
|
|
81
|
+
factory: Factory;
|
|
82
|
+
}, "prefixDecl", T11.ContextDefinitionPrefix, []>;
|
|
83
|
+
varOrTerm: import("@traqula/core").GeneratorRule<{
|
|
84
|
+
factory: Factory;
|
|
85
|
+
}, "varOrTerm", T12.Term, []>;
|
|
86
|
+
graphTerm: import("@traqula/core").GeneratorRule<{
|
|
87
|
+
factory: Factory;
|
|
88
|
+
}, "graphTerm", T12.GraphTerm, []>;
|
|
89
|
+
usingClauses: import("@traqula/core").GeneratorRule<{
|
|
90
|
+
factory: Factory;
|
|
91
|
+
}, "usingClauses", T12.DatasetClauses, []>;
|
|
92
|
+
groupGraphPattern: import("@traqula/core").GeneratorRule<{
|
|
93
|
+
factory: Factory;
|
|
94
|
+
}, "groupGraphPattern", T12.PatternGroup, []>;
|
|
95
|
+
triplesBlock: import("@traqula/core").GeneratorRule<{
|
|
96
|
+
factory: Factory;
|
|
97
|
+
}, "triplesBlock", T12.PatternBgp, []>;
|
|
98
|
+
triplesNodePath: import("@traqula/core").GeneratorRule<{
|
|
99
|
+
factory: Factory;
|
|
100
|
+
}, "triplesNodePath", T12.TripleCollection, []>;
|
|
101
|
+
graphNodePath: import("@traqula/core").GeneratorRule<{
|
|
102
|
+
factory: Factory;
|
|
103
|
+
}, "graphNodePath", T12.GraphNode, []>;
|
|
104
|
+
collectionPath: import("@traqula/core").GeneratorRule<{
|
|
105
|
+
factory: Factory;
|
|
106
|
+
}, "collectionPath", T12.TripleCollectionList, []>;
|
|
107
|
+
blankNodePropertyListPath: import("@traqula/core").GeneratorRule<{
|
|
108
|
+
factory: Factory;
|
|
109
|
+
}, "blankNodePropertyListPath", Patch<T11.TripleCollectionBlankNodeProperties, {
|
|
110
|
+
triples: T12.TripleNesting[];
|
|
111
|
+
identifier: T12.TermBlank | T12.TermVariable | T12.TermIri;
|
|
112
|
+
}>, []>;
|
|
113
|
+
whereClause: import("@traqula/core").GeneratorRule<{
|
|
114
|
+
factory: Factory;
|
|
115
|
+
}, "whereClause", Wrap<T12.PatternGroup>, []>;
|
|
116
|
+
generatePattern: import("@traqula/core").GeneratorRule<{
|
|
117
|
+
factory: Factory;
|
|
118
|
+
}, "generatePattern", T12.Pattern, []>;
|
|
119
|
+
graphPatternNotTriples: import("@traqula/core").GeneratorRule<{
|
|
120
|
+
factory: Factory;
|
|
121
|
+
}, "graphPatternNotTriples", T12.PatternGroup | T12.PatternUnion | T12.PatternOptional | T12.PatternMinus | T12.PatternGraph | T12.PatternService | T12.PatternFilter | T12.PatternBind | T12.PatternValues, []>;
|
|
122
|
+
groupOrUnionGraphPattern: import("@traqula/core").GeneratorRule<{
|
|
123
|
+
factory: Factory;
|
|
124
|
+
}, "groupOrUnionGraphPattern", T12.PatternGroup | T12.PatternUnion, []>;
|
|
125
|
+
optionalGraphPattern: import("@traqula/core").GeneratorRule<{
|
|
126
|
+
factory: Factory;
|
|
127
|
+
}, "optionalGraphPattern", T12.PatternOptional, []>;
|
|
128
|
+
minusGraphPattern: import("@traqula/core").GeneratorRule<{
|
|
129
|
+
factory: Factory;
|
|
130
|
+
}, "minusGraphPattern", T12.PatternMinus, []>;
|
|
131
|
+
graphGraphPattern: import("@traqula/core").GeneratorRule<{
|
|
132
|
+
factory: Factory;
|
|
133
|
+
}, "graphGraphPattern", T12.PatternGroup, []>;
|
|
134
|
+
serviceGraphPattern: import("@traqula/core").GeneratorRule<{
|
|
135
|
+
factory: Factory;
|
|
136
|
+
}, "serviceGraphPattern", T12.PatternService, []>;
|
|
137
|
+
inlineData: import("@traqula/core").GeneratorRule<{
|
|
138
|
+
factory: Factory;
|
|
139
|
+
}, "inlineData", T12.PatternValues, []>;
|
|
140
|
+
argList: import("@traqula/core").GeneratorRule<{
|
|
141
|
+
factory: Factory;
|
|
142
|
+
}, "argList", Patch<T11.gram.IArgList, {
|
|
143
|
+
args: T12.Expression[];
|
|
144
|
+
}>, []>;
|
|
145
|
+
iriOrFunction: import("@traqula/core").GeneratorRule<{
|
|
146
|
+
factory: Factory;
|
|
147
|
+
}, "iriOrFunction", T11.TermIri | T12.ExpressionFunctionCall, []>;
|
|
148
|
+
limitOffsetClauses: import("@traqula/core").GeneratorRule<{
|
|
149
|
+
factory: Factory;
|
|
150
|
+
}, "limitOffsetClauses", T11.SolutionModifierLimitOffset, []>;
|
|
151
|
+
groupClause: import("@traqula/core").GeneratorRule<{
|
|
152
|
+
factory: Factory;
|
|
153
|
+
}, "groupClause", T12.SolutionModifierGroup, []>;
|
|
154
|
+
havingClause: import("@traqula/core").GeneratorRule<{
|
|
155
|
+
factory: Factory;
|
|
156
|
+
}, "havingClause", T12.SolutionModifierHaving, []>;
|
|
157
|
+
orderClause: import("@traqula/core").GeneratorRule<{
|
|
158
|
+
factory: Factory;
|
|
159
|
+
}, "orderClause", T12.SolutionModifierOrder, []>;
|
|
160
|
+
selectQuery: import("@traqula/core").GeneratorRule<{
|
|
161
|
+
factory: Factory;
|
|
162
|
+
}, "selectQuery", Omit<T12.QuerySelect, T11.gram.HandledByBase>, []>;
|
|
163
|
+
constructQuery: import("@traqula/core").GeneratorRule<{
|
|
164
|
+
factory: Factory;
|
|
165
|
+
}, "constructQuery", Omit<T12.QueryConstruct, T11.gram.HandledByBase>, []>;
|
|
166
|
+
describeQuery: import("@traqula/core").GeneratorRule<{
|
|
167
|
+
factory: Factory;
|
|
168
|
+
}, "describeQuery", Omit<T12.QueryDescribe, T11.gram.HandledByBase>, []>;
|
|
169
|
+
askQuery: import("@traqula/core").GeneratorRule<{
|
|
170
|
+
factory: Factory;
|
|
171
|
+
}, "askQuery", Omit<T12.QueryAsk, T11.gram.HandledByBase>, []>;
|
|
172
|
+
selectClause: import("@traqula/core").GeneratorRule<{
|
|
173
|
+
factory: Factory;
|
|
174
|
+
}, "selectClause", Wrap<Pick<T12.QuerySelect, "distinct" | "variables" | "reduced">>, []>;
|
|
175
|
+
update1: import("@traqula/core").GeneratorRule<{
|
|
176
|
+
factory: Factory;
|
|
177
|
+
}, "update1", T12.UpdateOperation, []>;
|
|
178
|
+
insertData: import("@traqula/core").GeneratorRule<{
|
|
179
|
+
factory: Factory;
|
|
180
|
+
}, "insertData", T12.UpdateOperationInsertData, []>;
|
|
181
|
+
deleteData: import("@traqula/core").GeneratorRule<{
|
|
182
|
+
factory: Factory;
|
|
183
|
+
}, "deleteData", T12.UpdateOperationDeleteData, []>;
|
|
184
|
+
deleteWhere: import("@traqula/core").GeneratorRule<{
|
|
185
|
+
factory: Factory;
|
|
186
|
+
}, "deleteWhere", T12.UpdateOperationDeleteWhere, []>;
|
|
187
|
+
graphRefAll: import("@traqula/core").GeneratorRule<{
|
|
188
|
+
factory: Factory;
|
|
189
|
+
}, "graphRefAll", T11.GraphRef, []>;
|
|
190
|
+
quadsNotTriples: import("@traqula/core").GeneratorRule<{
|
|
191
|
+
factory: Factory;
|
|
192
|
+
}, "quadsNotTriples", T12.GraphQuads, []>;
|
|
193
|
+
queryOrUpdate: import("@traqula/core").GeneratorRule<{
|
|
194
|
+
factory: Factory;
|
|
195
|
+
}, "queryOrUpdate", T12.Update | T12.Query, []>;
|
|
196
|
+
reifiedTriple: import("@traqula/core").GeneratorRule<{
|
|
197
|
+
factory: Factory;
|
|
198
|
+
}, "reifiedTriple", T12.TripleCollectionReifiedTriple, []>;
|
|
199
|
+
versionDecl: import("@traqula/core").GeneratorRule<{
|
|
200
|
+
factory: Factory;
|
|
201
|
+
}, "versionDecl", T12.ContextDefinitionVersion, []>;
|
|
202
|
+
annotationPath: import("@traqula/core").GeneratorRule<{
|
|
203
|
+
factory: Factory;
|
|
204
|
+
}, "annotationPath", T12.Annotation[], []>;
|
|
205
|
+
annotationBlockPath: import("@traqula/core").GeneratorRule<{
|
|
206
|
+
factory: Factory;
|
|
207
|
+
}, "annotationBlockPath", Patch<T11.TripleCollectionBlankNodeProperties, {
|
|
208
|
+
triples: T12.TripleNesting[];
|
|
209
|
+
identifier: T12.TermBlank | T12.TermVariable | T12.TermIri;
|
|
210
|
+
}>, []>;
|
|
211
|
+
tripleTerm: import("@traqula/core").GeneratorRule<{
|
|
212
|
+
factory: Factory;
|
|
213
|
+
}, "tripleTerm", T12.TermTriple, []>;
|
|
214
|
+
}>;
|
|
215
|
+
export type SparqlGenerator = ReturnType<typeof sparql12GeneratorBuilder.build>;
|
|
2
216
|
export declare class Generator {
|
|
3
217
|
private readonly generator;
|
|
4
218
|
private readonly F;
|
|
5
|
-
generate(ast: T12.Query | T12.Update,
|
|
6
|
-
|
|
219
|
+
generate(ast: T12.Query | T12.Update, context?: Partial<T12.SparqlContext & {
|
|
220
|
+
origSource: string;
|
|
221
|
+
}>): string;
|
|
222
|
+
generatePath(ast: T12.Path, context?: Partial<T12.SparqlContext & {
|
|
223
|
+
origSource: string;
|
|
224
|
+
}>): string;
|
|
7
225
|
}
|
|
226
|
+
export {};
|
package/lib/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { GeneratorBuilder } from '@traqula/core';
|
|
2
2
|
import { sparql11GeneratorBuilder } from '@traqula/generator-sparql-1-1';
|
|
3
3
|
import { gram as g11, } from '@traqula/rules-sparql-1-1';
|
|
4
|
-
import { Factory, gram as g12 } from '@traqula/rules-sparql-1-2';
|
|
4
|
+
import { completeParseContext, Factory, gram as g12 } from '@traqula/rules-sparql-1-2';
|
|
5
5
|
const queryOrUpdate = {
|
|
6
6
|
name: 'queryOrUpdate',
|
|
7
7
|
gImpl: ({ SUBRULE }) => (ast, { factory: F }) => {
|
|
8
8
|
if (F.isQuery(ast)) {
|
|
9
|
-
SUBRULE(g11.query, ast
|
|
9
|
+
SUBRULE(g11.query, ast);
|
|
10
10
|
}
|
|
11
11
|
else {
|
|
12
|
-
SUBRULE(g11.update, ast
|
|
12
|
+
SUBRULE(g11.update, ast);
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
};
|
|
@@ -26,25 +26,14 @@ const sparql12GeneratorBuilder = GeneratorBuilder.create(sparql11GeneratorBuilde
|
|
|
26
26
|
.patchRule(queryOrUpdate)
|
|
27
27
|
.patchRule(g12.generateTriplesBlock)
|
|
28
28
|
.patchRule(g12.generateGraphTerm);
|
|
29
|
-
// .patchRule(g12.dataBlock);
|
|
30
29
|
export class Generator {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
generator = sparql12GeneratorBuilder.build();
|
|
31
|
+
F = new Factory();
|
|
32
|
+
generate(ast, context = {}) {
|
|
33
|
+
return this.generator.queryOrUpdate(ast, completeParseContext(context));
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
return this.generator.
|
|
37
|
-
factory: this.F,
|
|
38
|
-
offset: 0,
|
|
39
|
-
origSource,
|
|
40
|
-
}, undefined);
|
|
41
|
-
}
|
|
42
|
-
generatePath(ast, origSource = '') {
|
|
43
|
-
return this.generator.path(ast, {
|
|
44
|
-
factory: this.F,
|
|
45
|
-
offset: 0,
|
|
46
|
-
origSource,
|
|
47
|
-
}, undefined);
|
|
35
|
+
generatePath(ast, context = {}) {
|
|
36
|
+
return this.generator.path(ast, completeParseContext(context), undefined);
|
|
48
37
|
}
|
|
49
38
|
}
|
|
50
39
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EACL,IAAI,IAAI,GAAG,GACZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,IAAI,IAAI,GAAG,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EACL,IAAI,IAAI,GAAG,GACZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,IAAI,IAAI,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAGvF,MAAM,aAAa,GAAqE;IACtF,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE;QAC9C,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YACnB,OAAO,CAAC,GAAG,CAAC,KAAK,EAAc,GAAG,CAAC,CAAC;QACtC,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,MAAM,EAAe,GAAG,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;CACF,CAAC;AAEF,MAAM,wBAAwB,GAC5B,gBAAgB,CAAC,MAAM,CAAC,wBAAwB,CAAC;KAC9C,YAAY,EAAwB;KACpC,SAAS,EA4EN;KACH,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;KACvB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;KAC1B,SAAS,CAAC,GAAG,CAAC,aAAa,CAAC;KAC5B,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;KAChC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;KAC3B,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;KACxB,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC;KACvB,SAAS,CAAC,aAAa,CAAC;KACxB,SAAS,CAAC,GAAG,CAAC,oBAAoB,CAAC;KACnC,SAAS,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;AAItC,MAAM,OAAO,SAAS;IACH,SAAS,GAAoB,wBAAwB,CAAC,KAAK,EAAE,CAAC;IAC9D,CAAC,GAAG,IAAI,OAAO,EAAE,CAAC;IAE5B,QAAQ,CACb,GAA2B,EAC/B,UAA+D,EAAE;QAE7D,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1E,CAAC;IAEM,YAAY,CAAC,GAAa,EAAE,UAA+D,EAAE;QAClG,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,oBAAoB,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,CAAC;IAC5E,CAAC;CACF","sourcesContent":["import { GeneratorBuilder } from '@traqula/core';\nimport type { Wrap, Patch } from '@traqula/core';\nimport { sparql11GeneratorBuilder } from '@traqula/generator-sparql-1-1';\nimport type * as T11 from '@traqula/rules-sparql-1-1';\nimport {\n gram as g11,\n} from '@traqula/rules-sparql-1-1';\nimport { completeParseContext, Factory, gram as g12 } from '@traqula/rules-sparql-1-2';\nimport type * as T12 from '@traqula/rules-sparql-1-2';\n\nconst queryOrUpdate: T12.SparqlGeneratorRule<'queryOrUpdate', T12.Query | T12.Update> = {\n name: 'queryOrUpdate',\n gImpl: ({ SUBRULE }) => (ast, { factory: F }) => {\n if (F.isQuery(ast)) {\n SUBRULE(g11.query, <T11.Query> ast);\n } else {\n SUBRULE(g11.update, <T11.Update> ast);\n }\n },\n};\n\nconst sparql12GeneratorBuilder =\n GeneratorBuilder.create(sparql11GeneratorBuilder)\n .widenContext<{ factory: Factory }>()\n .typePatch<{\n [g11.query.name]: T12.Query;\n [g11.selectQuery.name]: Omit<T12.QuerySelect, g11.HandledByBase>;\n [g11.constructQuery.name]: Omit<T12.QueryConstruct, g11.HandledByBase>;\n [g11.describeQuery.name]: Omit<T12.QueryDescribe, g11.HandledByBase>;\n [g11.askQuery.name]: Omit<T12.QueryAsk, g11.HandledByBase>;\n [g11.selectClause.name]: Wrap<Pick<T12.QuerySelect, 'variables' | 'distinct' | 'reduced'>>;\n\n [g11.update.name]: T12.Update;\n [g11.update1.name]: T12.UpdateOperation;\n [g11.load.name]: T12.UpdateOperationLoad;\n [g11.clear.name]: T12.UpdateOperationClear;\n [g11.drop.name]: T12.UpdateOperationDrop;\n [g11.create.name]: T12.UpdateOperationCreate;\n [g11.copy.name]: T12.UpdateOperationCopy;\n [g11.move.name]: T12.UpdateOperationMove;\n [g11.add.name]: T12.UpdateOperationAdd;\n [g11.insertData.name]: T12.UpdateOperationInsertData;\n [g11.deleteData.name]: T12.UpdateOperationDeleteData;\n [g11.deleteWhere.name]: T12.UpdateOperationDeleteWhere;\n [g11.modify.name]: T12.UpdateOperationModify;\n [g11.graphRef.name]: T12.TermIri;\n [g11.graphRefAll.name]: T12.GraphRef;\n [g11.quads.name]: Wrap<T12.Quads[]>;\n [g11.quadsNotTriples.name]: T12.GraphQuads;\n\n [g11.aggregate.name]: T12.ExpressionAggregate;\n\n [g11.datasetClauseStar.name]: T12.DatasetClauses;\n [g11.usingClauseStar.name]: T12.DatasetClauses;\n\n // [g11.datasetClause.name]: unchanged;\n [g11.argList.name]: Patch<g11.IArgList, { args: T12.Expression[] }>;\n [g11.expression.name]: T12.Expression;\n [g11.iriOrFunction.name]: T12.TermIri | T12.ExpressionFunctionCall;\n\n [g11.prologue.name]: T12.ContextDefinition[];\n [g11.prefixDecl.name]: T12.ContextDefinitionPrefix;\n [g11.baseDecl.name]: T12.ContextDefinitionBase;\n // [g11.var_.name]: unchanged;\n [g11.varOrTerm.name]: T12.Term;\n [g11.graphTerm.name]: T12.GraphTerm;\n\n [g11.rdfLiteral.name]: T12.TermLiteral;\n // [g11.string.name]: unchanged;\n // [g11.iri.name]: unchanged;\n // [g11.iriFull.name]: unchanged;\n // [g11.prefixedName.name]: unchanged;\n // [g11.blankNode.name]: unchanged;\n\n // [g11.path.name]: unchanged;\n\n [g11.solutionModifier.name]: T12.SolutionModifiers;\n [g11.groupClause.name]: T12.SolutionModifierGroup;\n [g11.havingClause.name]: T12.SolutionModifierHaving;\n [g11.orderClause.name]: T12.SolutionModifierOrder;\n [g11.limitOffsetClauses.name]: T12.SolutionModifierLimitOffset;\n\n [g11.triplesBlock.name]: T12.PatternBgp;\n [g11.collectionPath.name]: T12.TripleCollectionList;\n [g11.blankNodePropertyListPath.name]: T12.TripleCollectionBlankNodeProperties;\n [g11.triplesNodePath.name]: T12.TripleCollection;\n [g11.graphNodePath.name]: T12.Term | T12.TripleCollection;\n\n [g11.whereClause.name]: Wrap<T12.PatternGroup>;\n [g11.generatePattern.name]: T12.Pattern;\n [g11.groupGraphPattern.name]: T12.PatternGroup;\n [g11.graphPatternNotTriples.name]: Exclude<T12.Pattern, T12.SubSelect | T12.PatternBgp>;\n [g11.optionalGraphPattern.name]: T12.PatternOptional;\n [g11.graphGraphPattern.name]: T12.PatternGroup;\n [g11.serviceGraphPattern.name]: T12.PatternService;\n [g11.bind.name]: T12.PatternBind;\n [g11.inlineData.name]: T12.PatternValues;\n [g11.minusGraphPattern.name]: T12.PatternMinus;\n [g11.groupOrUnionGraphPattern.name]: T12.PatternGroup | T12.PatternUnion;\n [g11.filter.name]: T12.PatternFilter;\n }>()\n .addRule(g12.tripleTerm)\n .addRule(g12.reifiedTriple)\n .patchRule(g12.graphNodePath)\n .addRule(g12.annotationBlockPath)\n .addRule(g12.annotationPath)\n .addRule(g12.versionDecl)\n .patchRule(g12.prologue)\n .patchRule(queryOrUpdate)\n .patchRule(g12.generateTriplesBlock)\n .patchRule(g12.generateGraphTerm);\n\nexport type SparqlGenerator = ReturnType<typeof sparql12GeneratorBuilder.build>;\n\nexport class Generator {\n private readonly generator: SparqlGenerator = sparql12GeneratorBuilder.build();\n private readonly F = new Factory();\n\n public generate(\n ast: T12.Query | T12.Update,\ncontext: Partial<T12.SparqlContext & { origSource: string }> = {},\n ): string {\n return this.generator.queryOrUpdate(ast, completeParseContext(context));\n }\n\n public generatePath(ast: T12.Path, context: Partial<T12.SparqlContext & { origSource: string }> = {}): string {\n return this.generator.path(ast, completeParseContext(context), undefined);\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@traqula/generator-sparql-1-2",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
5
5
|
"description": "SPARQL 1.2 generator",
|
|
6
6
|
"lsd:module": true,
|
|
7
7
|
"license": "MIT",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"lib/**/*.js.map"
|
|
33
33
|
],
|
|
34
34
|
"engines": {
|
|
35
|
-
"node": ">=
|
|
35
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
36
36
|
},
|
|
37
37
|
"typings": "lib/index",
|
|
38
38
|
"scripts": {
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
"build:transpile": " node \"../../node_modules/esbuild/bin/esbuild\" --format=cjs --bundle --log-level=error --outfile=lib/index.cjs lib/index.ts"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@traqula/core": "^0.0.
|
|
45
|
-
"@traqula/generator-sparql-1-1": "^0.0.
|
|
46
|
-
"@traqula/rules-sparql-1-1": "^0.0.
|
|
47
|
-
"@traqula/rules-sparql-1-2": "^0.0.
|
|
44
|
+
"@traqula/core": "^0.0.5",
|
|
45
|
+
"@traqula/generator-sparql-1-1": "^0.0.5",
|
|
46
|
+
"@traqula/rules-sparql-1-1": "^0.0.5",
|
|
47
|
+
"@traqula/rules-sparql-1-2": "^0.0.5"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@traqula/parser-sparql-1-2": "^0.0.
|
|
50
|
+
"@traqula/parser-sparql-1-2": "^0.0.5",
|
|
51
51
|
"@traqula/rules-sparql-1-2": "^0.0.1",
|
|
52
|
-
"@traqula/test-utils": "^0.0.
|
|
52
|
+
"@traqula/test-utils": "^0.0.5"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "b3d2326976e4e3b41b13c8231e76d3c5116a12aa"
|
|
55
55
|
}
|