@traqula/generator-sparql-1-2 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs +22 -27
- package/lib/index.d.ts +45 -48
- package/lib/index.js +0 -13
- package/lib/index.js.map +1 -1
- package/package.json +8 -9
package/lib/index.cjs
CHANGED
|
@@ -13054,7 +13054,7 @@ var inlineData = {
|
|
|
13054
13054
|
return ACTION(() => C.factory.patternValues(datablock.val, C.factory.sourceLocation(values3, datablock)));
|
|
13055
13055
|
},
|
|
13056
13056
|
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
|
|
13057
|
-
const variables = Object.keys(ast.values
|
|
13057
|
+
const variables = Object.keys(ast.values.at(0) ?? {});
|
|
13058
13058
|
F3.printFilter(ast, () => {
|
|
13059
13059
|
PRINT_WORD("VALUES", "(");
|
|
13060
13060
|
for (const variable of variables) {
|
|
@@ -13279,7 +13279,7 @@ var argList = {
|
|
|
13279
13279
|
F3.printFilter(ast, () => {
|
|
13280
13280
|
PRINT_WORD("(");
|
|
13281
13281
|
if (ast.val.distinct) {
|
|
13282
|
-
PRINT_WORD("
|
|
13282
|
+
PRINT_WORD("DISTINCT");
|
|
13283
13283
|
}
|
|
13284
13284
|
});
|
|
13285
13285
|
const [head2, ...tail] = ast.val.args;
|
|
@@ -13333,7 +13333,7 @@ var expression = {
|
|
|
13333
13333
|
} else if (ast.operator === "in") {
|
|
13334
13334
|
PRINT_WORD("IN");
|
|
13335
13335
|
} else {
|
|
13336
|
-
PRINT_WORD(ast.operator);
|
|
13336
|
+
PRINT_WORD(ast.operator.toUpperCase());
|
|
13337
13337
|
}
|
|
13338
13338
|
});
|
|
13339
13339
|
if (right.length === 1) {
|
|
@@ -13344,10 +13344,10 @@ var expression = {
|
|
|
13344
13344
|
F3.printFilter(ast, () => PRINT_WORD(")"));
|
|
13345
13345
|
} else if (prefixOperator.has(ast.operator)) {
|
|
13346
13346
|
const [expr] = ast.args;
|
|
13347
|
-
F3.printFilter(ast, () => PRINT_WORD(ast.operator));
|
|
13347
|
+
F3.printFilter(ast, () => PRINT_WORD(ast.operator.toUpperCase()));
|
|
13348
13348
|
SUBRULE(expression, expr);
|
|
13349
13349
|
} else {
|
|
13350
|
-
F3.printFilter(ast, () => PRINT_WORD(ast.operator, "("));
|
|
13350
|
+
F3.printFilter(ast, () => PRINT_WORD(ast.operator.toUpperCase(), "("));
|
|
13351
13351
|
const [head2, ...tail] = ast.args;
|
|
13352
13352
|
if (head2) {
|
|
13353
13353
|
SUBRULE(expression, head2);
|
|
@@ -14257,11 +14257,18 @@ var update = {
|
|
|
14257
14257
|
});
|
|
14258
14258
|
},
|
|
14259
14259
|
gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
|
|
14260
|
-
|
|
14260
|
+
const [head2, ...tail] = ast.updates;
|
|
14261
|
+
if (head2) {
|
|
14262
|
+
SUBRULE(prologue, head2.context);
|
|
14263
|
+
if (head2.operation) {
|
|
14264
|
+
SUBRULE(update1, head2.operation);
|
|
14265
|
+
}
|
|
14266
|
+
}
|
|
14267
|
+
for (const update2 of tail) {
|
|
14268
|
+
F3.printFilter(ast, () => PRINT_WORD(";\n"));
|
|
14261
14269
|
SUBRULE(prologue, update2.context);
|
|
14262
14270
|
if (update2.operation) {
|
|
14263
14271
|
SUBRULE(update1, update2.operation);
|
|
14264
|
-
F3.printFilter(ast, () => PRINT_WORD(" ;\n"));
|
|
14265
14272
|
}
|
|
14266
14273
|
}
|
|
14267
14274
|
}
|
|
@@ -14724,28 +14731,26 @@ var queryOrUpdate = {
|
|
|
14724
14731
|
});
|
|
14725
14732
|
} }
|
|
14726
14733
|
]);
|
|
14727
|
-
}
|
|
14728
|
-
};
|
|
14729
|
-
|
|
14730
|
-
// ../generator-sparql-1-1/lib/index.js
|
|
14731
|
-
var queryOrUpdate2 = {
|
|
14732
|
-
name: "queryOrUpdate",
|
|
14734
|
+
},
|
|
14733
14735
|
gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
|
|
14734
14736
|
if (F3.isQuery(ast)) {
|
|
14735
|
-
SUBRULE(
|
|
14737
|
+
SUBRULE(query, ast);
|
|
14736
14738
|
} else {
|
|
14737
|
-
SUBRULE(
|
|
14739
|
+
SUBRULE(update, ast);
|
|
14738
14740
|
}
|
|
14739
14741
|
}
|
|
14740
14742
|
};
|
|
14743
|
+
|
|
14744
|
+
// ../generator-sparql-1-1/lib/index.js
|
|
14741
14745
|
var sparql11GeneratorBuilder = GeneratorBuilder.create([
|
|
14746
|
+
grammar_exports.queryOrUpdate,
|
|
14742
14747
|
grammar_exports.query,
|
|
14743
14748
|
grammar_exports.selectQuery,
|
|
14744
14749
|
grammar_exports.constructQuery,
|
|
14745
14750
|
grammar_exports.describeQuery,
|
|
14746
14751
|
grammar_exports.askQuery,
|
|
14747
14752
|
grammar_exports.selectClause
|
|
14748
|
-
]).addMany(grammar_exports.update, grammar_exports.update1, grammar_exports.load, grammar_exports.clear, grammar_exports.drop, grammar_exports.create, grammar_exports.copy, grammar_exports.move, grammar_exports.add, grammar_exports.insertData, grammar_exports.deleteData, grammar_exports.deleteWhere, grammar_exports.modify, grammar_exports.graphRef, grammar_exports.graphRefAll, grammar_exports.quads, grammar_exports.quadsNotTriples).addRule(grammar_exports.aggregate).addMany(grammar_exports.datasetClauseStar, grammar_exports.usingClauseStar).addMany(grammar_exports.argList, grammar_exports.expression, grammar_exports.iriOrFunction).addMany(grammar_exports.prologue, grammar_exports.prefixDecl, grammar_exports.baseDecl, grammar_exports.varOrTerm, grammar_exports.var_, grammar_exports.graphTerm).addMany(grammar_exports.rdfLiteral, grammar_exports.iri, grammar_exports.iriFull, grammar_exports.prefixedName, grammar_exports.blankNode).addRule(grammar_exports.pathGenerator).addMany(grammar_exports.solutionModifier, grammar_exports.groupClause, grammar_exports.havingClause, grammar_exports.orderClause, grammar_exports.limitOffsetClauses).addMany(grammar_exports.triplesBlock, grammar_exports.collectionPath, grammar_exports.blankNodePropertyListPath, grammar_exports.triplesNodePath, grammar_exports.graphNodePath).addMany(grammar_exports.whereClause, grammar_exports.generatePattern, grammar_exports.groupGraphPattern, grammar_exports.graphPatternNotTriples, grammar_exports.optionalGraphPattern, grammar_exports.graphGraphPattern, grammar_exports.serviceGraphPattern, grammar_exports.bind, grammar_exports.inlineData, grammar_exports.minusGraphPattern, grammar_exports.groupOrUnionGraphPattern, grammar_exports.filter)
|
|
14753
|
+
]).addMany(grammar_exports.update, grammar_exports.update1, grammar_exports.load, grammar_exports.clear, grammar_exports.drop, grammar_exports.create, grammar_exports.copy, grammar_exports.move, grammar_exports.add, grammar_exports.insertData, grammar_exports.deleteData, grammar_exports.deleteWhere, grammar_exports.modify, grammar_exports.graphRef, grammar_exports.graphRefAll, grammar_exports.quads, grammar_exports.quadsNotTriples).addRule(grammar_exports.aggregate).addMany(grammar_exports.datasetClauseStar, grammar_exports.usingClauseStar).addMany(grammar_exports.argList, grammar_exports.expression, grammar_exports.iriOrFunction).addMany(grammar_exports.prologue, grammar_exports.prefixDecl, grammar_exports.baseDecl, grammar_exports.varOrTerm, grammar_exports.var_, grammar_exports.graphTerm).addMany(grammar_exports.rdfLiteral, grammar_exports.iri, grammar_exports.iriFull, grammar_exports.prefixedName, grammar_exports.blankNode).addRule(grammar_exports.pathGenerator).addMany(grammar_exports.solutionModifier, grammar_exports.groupClause, grammar_exports.havingClause, grammar_exports.orderClause, grammar_exports.limitOffsetClauses).addMany(grammar_exports.triplesBlock, grammar_exports.collectionPath, grammar_exports.blankNodePropertyListPath, grammar_exports.triplesNodePath, grammar_exports.graphNodePath).addMany(grammar_exports.whereClause, grammar_exports.generatePattern, grammar_exports.groupGraphPattern, grammar_exports.graphPatternNotTriples, grammar_exports.optionalGraphPattern, grammar_exports.graphGraphPattern, grammar_exports.serviceGraphPattern, grammar_exports.bind, grammar_exports.inlineData, grammar_exports.minusGraphPattern, grammar_exports.groupOrUnionGraphPattern, grammar_exports.filter);
|
|
14749
14754
|
|
|
14750
14755
|
// ../../packages/rules-sparql-1-2/lib/grammar.ts
|
|
14751
14756
|
var grammar_exports2 = {};
|
|
@@ -15451,17 +15456,7 @@ function completeParseContext2(context) {
|
|
|
15451
15456
|
}
|
|
15452
15457
|
|
|
15453
15458
|
// lib/index.ts
|
|
15454
|
-
var
|
|
15455
|
-
name: "queryOrUpdate",
|
|
15456
|
-
gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
|
|
15457
|
-
if (F3.isQuery(ast)) {
|
|
15458
|
-
SUBRULE(grammar_exports.query, ast);
|
|
15459
|
-
} else {
|
|
15460
|
-
SUBRULE(grammar_exports.update, ast);
|
|
15461
|
-
}
|
|
15462
|
-
}
|
|
15463
|
-
};
|
|
15464
|
-
var sparql12GeneratorBuilder = GeneratorBuilder.create(sparql11GeneratorBuilder).widenContext().typePatch().addRule(grammar_exports2.tripleTerm).addRule(grammar_exports2.reifiedTriple).patchRule(grammar_exports2.graphNodePath).addRule(grammar_exports2.annotationBlockPath).addRule(grammar_exports2.annotationPath).addRule(grammar_exports2.versionDecl).patchRule(grammar_exports2.prologue).patchRule(queryOrUpdate3).patchRule(grammar_exports2.generateTriplesBlock).patchRule(grammar_exports2.generateGraphTerm);
|
|
15459
|
+
var sparql12GeneratorBuilder = GeneratorBuilder.create(sparql11GeneratorBuilder).widenContext().typePatch().addRule(grammar_exports2.tripleTerm).addRule(grammar_exports2.reifiedTriple).patchRule(grammar_exports2.graphNodePath).addRule(grammar_exports2.annotationBlockPath).addRule(grammar_exports2.annotationPath).addRule(grammar_exports2.versionDecl).patchRule(grammar_exports2.prologue).patchRule(grammar_exports2.generateTriplesBlock).patchRule(grammar_exports2.generateGraphTerm);
|
|
15465
15460
|
var Generator = class {
|
|
15466
15461
|
generator = sparql12GeneratorBuilder.build();
|
|
15467
15462
|
F = new Factory2();
|
package/lib/index.d.ts
CHANGED
|
@@ -1,103 +1,100 @@
|
|
|
1
1
|
import { GeneratorBuilder } from '@traqula/core';
|
|
2
2
|
import type { Patch } from '@traqula/core';
|
|
3
|
-
import type * as T11 from '@traqula/rules-sparql-1-1';
|
|
4
3
|
import { Factory } from '@traqula/rules-sparql-1-2';
|
|
5
4
|
import type * as T12 from '@traqula/rules-sparql-1-2';
|
|
6
5
|
declare const sparql12GeneratorBuilder: GeneratorBuilder<{
|
|
7
6
|
factory: Factory;
|
|
8
|
-
}, "
|
|
9
|
-
copy: never;
|
|
10
|
-
filter: never;
|
|
11
|
-
path: never;
|
|
7
|
+
}, "query" | "prologue" | "selectQuery" | "constructQuery" | "describeQuery" | "askQuery" | "baseDecl" | "prefixDecl" | "selectClause" | "whereClause" | "solutionModifier" | "expression" | "iriOrFunction" | "rdfLiteral" | "var" | "aggregate" | "iri" | "prefixedName" | "argList" | "groupGraphPattern" | "triplesBlock" | "triplesNodePath" | "blankNode" | "path" | "varOrTerm" | "iriFull" | "graphTerm" | "graphNodePath" | "collectionPath" | "blankNodePropertyListPath" | "graphPatternNotTriples" | "filter" | "bind" | "groupOrUnionGraphPattern" | "optionalGraphPattern" | "minusGraphPattern" | "graphGraphPattern" | "serviceGraphPattern" | "inlineData" | "groupClause" | "havingClause" | "orderClause" | "limitOffsetClauses" | "datasetClauses" | "update" | "load" | "clear" | "drop" | "add" | "move" | "copy" | "create" | "insertData" | "deleteData" | "deleteWhere" | "graphRef" | "graphRefAll" | "quads" | "update1" | "quadsNotTriples" | "modify" | "usingClauses" | "queryOrUpdate" | "reifiedTriple" | "annotationPath" | "annotationBlockPath" | "tripleTerm" | "versionDecl" | "generatePattern", {
|
|
12
8
|
query: never;
|
|
13
|
-
clear: never;
|
|
14
|
-
drop: never;
|
|
15
|
-
quads: never;
|
|
16
|
-
graphRef: never;
|
|
17
|
-
load: never;
|
|
18
|
-
create: never;
|
|
19
|
-
add: never;
|
|
20
|
-
move: never;
|
|
21
|
-
modify: never;
|
|
22
|
-
update: never;
|
|
23
|
-
datasetClauses: never;
|
|
24
|
-
bind: never;
|
|
25
|
-
solutionModifier: never;
|
|
26
|
-
expression: never;
|
|
27
|
-
aggregate: never;
|
|
28
|
-
blankNode: never;
|
|
29
|
-
rdfLiteral: never;
|
|
30
|
-
iri: never;
|
|
31
|
-
iriFull: never;
|
|
32
|
-
prefixedName: never;
|
|
33
9
|
prologue: import("@traqula/core").GeneratorRule<{
|
|
34
10
|
factory: Factory;
|
|
35
11
|
}, "prologue", T12.ContextDefinition[], []>;
|
|
12
|
+
selectQuery: never;
|
|
13
|
+
constructQuery: never;
|
|
14
|
+
describeQuery: never;
|
|
15
|
+
askQuery: never;
|
|
36
16
|
baseDecl: never;
|
|
37
17
|
prefixDecl: never;
|
|
38
|
-
|
|
18
|
+
selectClause: never;
|
|
19
|
+
whereClause: never;
|
|
20
|
+
solutionModifier: never;
|
|
21
|
+
expression: never;
|
|
22
|
+
iriOrFunction: never;
|
|
23
|
+
rdfLiteral: never;
|
|
39
24
|
var: never;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
25
|
+
aggregate: never;
|
|
26
|
+
iri: never;
|
|
27
|
+
prefixedName: never;
|
|
28
|
+
argList: never;
|
|
44
29
|
groupGraphPattern: never;
|
|
45
30
|
triplesBlock: import("@traqula/core").GeneratorRule<{
|
|
46
31
|
factory: Factory;
|
|
47
32
|
}, "triplesBlock", T12.PatternBgp, []>;
|
|
48
33
|
triplesNodePath: never;
|
|
34
|
+
blankNode: never;
|
|
35
|
+
path: never;
|
|
36
|
+
varOrTerm: never;
|
|
37
|
+
iriFull: never;
|
|
38
|
+
graphTerm: import("@traqula/core").GeneratorRule<{
|
|
39
|
+
factory: Factory;
|
|
40
|
+
}, "graphTerm", T12.GraphTerm, []>;
|
|
49
41
|
graphNodePath: import("@traqula/core").GeneratorRule<{
|
|
50
42
|
factory: Factory;
|
|
51
43
|
}, "graphNodePath", T12.GraphNode, []>;
|
|
52
44
|
collectionPath: never;
|
|
53
45
|
blankNodePropertyListPath: never;
|
|
54
|
-
whereClause: never;
|
|
55
|
-
generatePattern: never;
|
|
56
46
|
graphPatternNotTriples: never;
|
|
47
|
+
filter: never;
|
|
48
|
+
bind: never;
|
|
57
49
|
groupOrUnionGraphPattern: never;
|
|
58
50
|
optionalGraphPattern: never;
|
|
59
51
|
minusGraphPattern: never;
|
|
60
52
|
graphGraphPattern: never;
|
|
61
53
|
serviceGraphPattern: never;
|
|
62
54
|
inlineData: never;
|
|
63
|
-
argList: never;
|
|
64
|
-
iriOrFunction: never;
|
|
65
|
-
limitOffsetClauses: never;
|
|
66
55
|
groupClause: never;
|
|
67
56
|
havingClause: never;
|
|
68
57
|
orderClause: never;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
58
|
+
limitOffsetClauses: never;
|
|
59
|
+
datasetClauses: never;
|
|
60
|
+
update: never;
|
|
61
|
+
load: never;
|
|
62
|
+
clear: never;
|
|
63
|
+
drop: never;
|
|
64
|
+
add: never;
|
|
65
|
+
move: never;
|
|
66
|
+
copy: never;
|
|
67
|
+
create: never;
|
|
75
68
|
insertData: never;
|
|
76
69
|
deleteData: never;
|
|
77
70
|
deleteWhere: never;
|
|
71
|
+
graphRef: never;
|
|
78
72
|
graphRefAll: never;
|
|
73
|
+
quads: never;
|
|
74
|
+
update1: never;
|
|
79
75
|
quadsNotTriples: never;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
76
|
+
modify: never;
|
|
77
|
+
usingClauses: never;
|
|
78
|
+
queryOrUpdate: never;
|
|
83
79
|
reifiedTriple: import("@traqula/core").GeneratorRule<{
|
|
84
80
|
factory: Factory;
|
|
85
81
|
}, "reifiedTriple", T12.TripleCollectionReifiedTriple, []>;
|
|
86
|
-
versionDecl: import("@traqula/core").GeneratorRule<{
|
|
87
|
-
factory: Factory;
|
|
88
|
-
}, "versionDecl", T12.ContextDefinitionVersion, []>;
|
|
89
82
|
annotationPath: import("@traqula/core").GeneratorRule<{
|
|
90
83
|
factory: Factory;
|
|
91
84
|
}, "annotationPath", T12.Annotation[], []>;
|
|
92
85
|
annotationBlockPath: import("@traqula/core").GeneratorRule<{
|
|
93
86
|
factory: Factory;
|
|
94
|
-
}, "annotationBlockPath", Patch<
|
|
87
|
+
}, "annotationBlockPath", Patch<import("@traqula/rules-sparql-1-1").TripleCollectionBlankNodeProperties, {
|
|
95
88
|
triples: T12.TripleNesting[];
|
|
96
89
|
identifier: T12.TermBlank | T12.TermVariable | T12.TermIri;
|
|
97
90
|
}>, []>;
|
|
98
91
|
tripleTerm: import("@traqula/core").GeneratorRule<{
|
|
99
92
|
factory: Factory;
|
|
100
93
|
}, "tripleTerm", T12.TermTriple, []>;
|
|
94
|
+
versionDecl: import("@traqula/core").GeneratorRule<{
|
|
95
|
+
factory: Factory;
|
|
96
|
+
}, "versionDecl", T12.ContextDefinitionVersion, []>;
|
|
97
|
+
generatePattern: never;
|
|
101
98
|
}>;
|
|
102
99
|
export type SparqlGenerator = ReturnType<typeof sparql12GeneratorBuilder.build>;
|
|
103
100
|
export declare class Generator {
|
package/lib/index.js
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
import { GeneratorBuilder } from '@traqula/core';
|
|
2
2
|
import { sparql11GeneratorBuilder } from '@traqula/generator-sparql-1-1';
|
|
3
|
-
import { gram as g11, } from '@traqula/rules-sparql-1-1';
|
|
4
3
|
import { completeParseContext, Factory, gram as g12 } from '@traqula/rules-sparql-1-2';
|
|
5
|
-
const queryOrUpdate = {
|
|
6
|
-
name: 'queryOrUpdate',
|
|
7
|
-
gImpl: ({ SUBRULE }) => (ast, { factory: F }) => {
|
|
8
|
-
if (F.isQuery(ast)) {
|
|
9
|
-
SUBRULE(g11.query, ast);
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
SUBRULE(g11.update, ast);
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
4
|
const sparql12GeneratorBuilder = GeneratorBuilder.create(sparql11GeneratorBuilder)
|
|
17
5
|
.widenContext()
|
|
18
6
|
.typePatch()
|
|
@@ -23,7 +11,6 @@ const sparql12GeneratorBuilder = GeneratorBuilder.create(sparql11GeneratorBuilde
|
|
|
23
11
|
.addRule(g12.annotationPath)
|
|
24
12
|
.addRule(g12.versionDecl)
|
|
25
13
|
.patchRule(g12.prologue)
|
|
26
|
-
.patchRule(queryOrUpdate)
|
|
27
14
|
.patchRule(g12.generateTriplesBlock)
|
|
28
15
|
.patchRule(g12.generateGraphTerm);
|
|
29
16
|
export class Generator {
|
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;
|
|
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;AAIzE,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,IAAI,IAAI,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAGvF,MAAM,wBAAwB,GAC5B,gBAAgB,CAAC,MAAM,CAAC,wBAAwB,CAAC;KAC9C,YAAY,EAAwB;KACpC,SAAS,EA6EN;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,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 {\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 sparql12GeneratorBuilder =\n GeneratorBuilder.create(sparql11GeneratorBuilder)\n .widenContext<{ factory: Factory }>()\n .typePatch<{\n [g11.queryOrUpdate.name]: [T12.SparqlQuery];\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(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.9",
|
|
5
5
|
"description": "SPARQL 1.2 generator",
|
|
6
6
|
"lsd:module": true,
|
|
7
7
|
"license": "MIT",
|
|
@@ -41,15 +41,14 @@
|
|
|
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.9",
|
|
45
|
+
"@traqula/generator-sparql-1-1": "^0.0.9",
|
|
46
|
+
"@traqula/rules-sparql-1-1": "^0.0.9",
|
|
47
|
+
"@traqula/rules-sparql-1-2": "^0.0.9"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@traqula/parser-sparql-1-2": "^0.0.
|
|
51
|
-
"@traqula/
|
|
52
|
-
"@traqula/test-utils": "^0.0.7"
|
|
50
|
+
"@traqula/parser-sparql-1-2": "^0.0.9",
|
|
51
|
+
"@traqula/test-utils": "^0.0.9"
|
|
53
52
|
},
|
|
54
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "c13cd255122c688daad98bf313a3397cbffdc45d"
|
|
55
54
|
}
|