@traqula/generator-sparql-1-2 0.0.14 → 0.0.16
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 +702 -564
- package/lib/index.d.ts +10 -31
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/package.json +8 -8
package/lib/index.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { GeneratorBuilder } from '@traqula/core';
|
|
2
2
|
import type { Patch } from '@traqula/core';
|
|
3
|
-
import { Factory } from '@traqula/rules-sparql-1-2';
|
|
4
3
|
import type * as T12 from '@traqula/rules-sparql-1-2';
|
|
5
|
-
declare const sparql12GeneratorBuilder: GeneratorBuilder<{
|
|
6
|
-
factory: Factory;
|
|
7
|
-
}, "filter" | "graphRef" | "load" | "clear" | "drop" | "create" | "add" | "move" | "copy" | "modify" | "update" | "query" | "datasetClauses" | "bind" | "solutionModifier" | "expression" | "aggregate" | "path" | "blankNode" | "selectQuery" | "selectClause" | "constructQuery" | "describeQuery" | "askQuery" | "update1" | "insertData" | "deleteData" | "deleteWhere" | "graphRefAll" | "quads" | "quadsNotTriples" | "usingClauses" | "argList" | "iriOrFunction" | "prologue" | "baseDecl" | "prefixDecl" | "varOrTerm" | "var" | "graphTerm" | "rdfLiteral" | "iri" | "iriFull" | "prefixedName" | "groupClause" | "havingClause" | "orderClause" | "limitOffsetClauses" | "triplesBlock" | "collectionPath" | "triplesNodePath" | "blankNodePropertyListPath" | "graphNodePath" | "whereClause" | "groupGraphPattern" | "generatePattern" | "graphPatternNotTriples" | "optionalGraphPattern" | "graphGraphPattern" | "serviceGraphPattern" | "inlineData" | "minusGraphPattern" | "groupOrUnionGraphPattern" | "queryOrUpdate" | "reifiedTriple" | "versionDecl" | "annotationPath" | "annotationBlockPath" | "tripleTerm", {
|
|
4
|
+
declare const sparql12GeneratorBuilder: GeneratorBuilder<T12.SparqlGeneratorContext, "filter" | "graphRef" | "load" | "clear" | "drop" | "create" | "add" | "move" | "copy" | "modify" | "update" | "query" | "datasetClauses" | "bind" | "solutionModifier" | "expression" | "aggregate" | "path" | "blankNode" | "selectQuery" | "selectClause" | "constructQuery" | "describeQuery" | "askQuery" | "update1" | "insertData" | "deleteData" | "deleteWhere" | "graphRefAll" | "quads" | "quadsNotTriples" | "usingClauses" | "argList" | "iriOrFunction" | "prologue" | "baseDecl" | "prefixDecl" | "varOrTerm" | "var" | "graphTerm" | "rdfLiteral" | "iri" | "iriFull" | "prefixedName" | "groupClause" | "havingClause" | "orderClause" | "limitOffsetClauses" | "triplesBlock" | "collectionPath" | "triplesNodePath" | "blankNodePropertyListPath" | "graphNodePath" | "whereClause" | "groupGraphPattern" | "generatePattern" | "graphPatternNotTriples" | "optionalGraphPattern" | "graphGraphPattern" | "serviceGraphPattern" | "inlineData" | "minusGraphPattern" | "groupOrUnionGraphPattern" | "queryOrUpdate" | "reifiedTriple" | "versionDecl" | "annotationPath" | "annotationBlockPath" | "tripleTerm", {
|
|
8
5
|
filter: never;
|
|
9
6
|
graphRef: never;
|
|
10
7
|
load: never;
|
|
@@ -39,16 +36,12 @@ declare const sparql12GeneratorBuilder: GeneratorBuilder<{
|
|
|
39
36
|
usingClauses: never;
|
|
40
37
|
argList: never;
|
|
41
38
|
iriOrFunction: never;
|
|
42
|
-
prologue: import("@traqula/core").GeneratorRule<
|
|
43
|
-
factory: Factory;
|
|
44
|
-
}, "prologue", T12.ContextDefinition[], []>;
|
|
39
|
+
prologue: import("@traqula/core").GeneratorRule<T12.SparqlGeneratorContext, "prologue", T12.ContextDefinition[], []>;
|
|
45
40
|
baseDecl: never;
|
|
46
41
|
prefixDecl: never;
|
|
47
42
|
varOrTerm: never;
|
|
48
43
|
var: never;
|
|
49
|
-
graphTerm: import("@traqula/core").GeneratorRule<
|
|
50
|
-
factory: Factory;
|
|
51
|
-
}, "graphTerm", T12.GraphTerm, []>;
|
|
44
|
+
graphTerm: import("@traqula/core").GeneratorRule<T12.SparqlGeneratorContext, "graphTerm", T12.GraphTerm, []>;
|
|
52
45
|
rdfLiteral: never;
|
|
53
46
|
iri: never;
|
|
54
47
|
iriFull: never;
|
|
@@ -57,15 +50,11 @@ declare const sparql12GeneratorBuilder: GeneratorBuilder<{
|
|
|
57
50
|
havingClause: never;
|
|
58
51
|
orderClause: never;
|
|
59
52
|
limitOffsetClauses: never;
|
|
60
|
-
triplesBlock: import("@traqula/core").GeneratorRule<
|
|
61
|
-
factory: Factory;
|
|
62
|
-
}, "triplesBlock", T12.PatternBgp, []>;
|
|
53
|
+
triplesBlock: import("@traqula/core").GeneratorRule<T12.SparqlGeneratorContext, "triplesBlock", T12.PatternBgp, []>;
|
|
63
54
|
collectionPath: never;
|
|
64
55
|
triplesNodePath: never;
|
|
65
56
|
blankNodePropertyListPath: never;
|
|
66
|
-
graphNodePath: import("@traqula/core").GeneratorRule<
|
|
67
|
-
factory: Factory;
|
|
68
|
-
}, "graphNodePath", T12.GraphNode, []>;
|
|
57
|
+
graphNodePath: import("@traqula/core").GeneratorRule<T12.SparqlGeneratorContext, "graphNodePath", T12.GraphNode, []>;
|
|
69
58
|
whereClause: never;
|
|
70
59
|
groupGraphPattern: never;
|
|
71
60
|
generatePattern: never;
|
|
@@ -77,24 +66,14 @@ declare const sparql12GeneratorBuilder: GeneratorBuilder<{
|
|
|
77
66
|
minusGraphPattern: never;
|
|
78
67
|
groupOrUnionGraphPattern: never;
|
|
79
68
|
queryOrUpdate: never;
|
|
80
|
-
reifiedTriple: import("@traqula/core").GeneratorRule<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
factory: Factory;
|
|
85
|
-
}, "versionDecl", T12.ContextDefinitionVersion, []>;
|
|
86
|
-
annotationPath: import("@traqula/core").GeneratorRule<{
|
|
87
|
-
factory: Factory;
|
|
88
|
-
}, "annotationPath", T12.Annotation[], []>;
|
|
89
|
-
annotationBlockPath: import("@traqula/core").GeneratorRule<{
|
|
90
|
-
factory: Factory;
|
|
91
|
-
}, "annotationBlockPath", Patch<import("@traqula/rules-sparql-1-1").TripleCollectionBlankNodeProperties, {
|
|
69
|
+
reifiedTriple: import("@traqula/core").GeneratorRule<T12.SparqlGeneratorContext, "reifiedTriple", T12.TripleCollectionReifiedTriple, []>;
|
|
70
|
+
versionDecl: import("@traqula/core").GeneratorRule<T12.SparqlGeneratorContext, "versionDecl", T12.ContextDefinitionVersion, []>;
|
|
71
|
+
annotationPath: import("@traqula/core").GeneratorRule<T12.SparqlGeneratorContext, "annotationPath", T12.Annotation[], []>;
|
|
72
|
+
annotationBlockPath: import("@traqula/core").GeneratorRule<T12.SparqlGeneratorContext, "annotationBlockPath", Patch<import("@traqula/rules-sparql-1-1").TripleCollectionBlankNodeProperties, {
|
|
92
73
|
triples: T12.TripleNesting[];
|
|
93
74
|
identifier: T12.TermBlank | T12.TermVariable | T12.TermIri;
|
|
94
75
|
}>, []>;
|
|
95
|
-
tripleTerm: import("@traqula/core").GeneratorRule<
|
|
96
|
-
factory: Factory;
|
|
97
|
-
}, "tripleTerm", T12.TermTriple, []>;
|
|
76
|
+
tripleTerm: import("@traqula/core").GeneratorRule<T12.SparqlGeneratorContext, "tripleTerm", T12.TermTriple, []>;
|
|
98
77
|
}>;
|
|
99
78
|
export type SparqlGenerator = ReturnType<typeof sparql12GeneratorBuilder.build>;
|
|
100
79
|
export declare class Generator {
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GeneratorBuilder } from '@traqula/core';
|
|
2
2
|
import { sparql11GeneratorBuilder } from '@traqula/generator-sparql-1-1';
|
|
3
|
-
import { completeParseContext,
|
|
3
|
+
import { completeParseContext, AstFactory, gram as g12 } from '@traqula/rules-sparql-1-2';
|
|
4
4
|
const sparql12GeneratorBuilder = GeneratorBuilder.create(sparql11GeneratorBuilder)
|
|
5
5
|
.widenContext()
|
|
6
6
|
.typePatch()
|
|
@@ -15,7 +15,7 @@ const sparql12GeneratorBuilder = GeneratorBuilder.create(sparql11GeneratorBuilde
|
|
|
15
15
|
.patchRule(g12.generateGraphTerm);
|
|
16
16
|
export class Generator {
|
|
17
17
|
generator = sparql12GeneratorBuilder.build();
|
|
18
|
-
F = new
|
|
18
|
+
F = new AstFactory();
|
|
19
19
|
generate(ast, context = {}) {
|
|
20
20
|
return this.generator.queryOrUpdate(ast, completeParseContext(context));
|
|
21
21
|
}
|
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;AAIzE,OAAO,EAAE,oBAAoB,EAAE,
|
|
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,UAAU,EAAE,IAAI,IAAI,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAG1F,MAAM,wBAAwB,GAC5B,gBAAgB,CAAC,MAAM,CAAC,wBAAwB,CAAC;KAC9C,YAAY,EAA8B;KAC1C,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,UAAU,EAAE,CAAC;IAE/B,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, AstFactory, 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<T12.SparqlGeneratorContext>()\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 AstFactory();\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.16",
|
|
5
5
|
"description": "SPARQL 1.2 generator",
|
|
6
6
|
"lsd:module": true,
|
|
7
7
|
"license": "MIT",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"build:transpile": " node \"../../node_modules/esbuild/bin/esbuild\" --format=cjs --bundle --log-level=error --outfile=lib/index.cjs lib/index.ts"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@traqula/core": "^0.0.
|
|
46
|
-
"@traqula/generator-sparql-1-1": "^0.0.
|
|
47
|
-
"@traqula/rules-sparql-1-1": "^0.0.
|
|
48
|
-
"@traqula/rules-sparql-1-2": "^0.0.
|
|
45
|
+
"@traqula/core": "^0.0.16",
|
|
46
|
+
"@traqula/generator-sparql-1-1": "^0.0.16",
|
|
47
|
+
"@traqula/rules-sparql-1-1": "^0.0.16",
|
|
48
|
+
"@traqula/rules-sparql-1-2": "^0.0.16"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@traqula/parser-sparql-1-2": "^0.0.
|
|
52
|
-
"@traqula/test-utils": "^0.0.
|
|
51
|
+
"@traqula/parser-sparql-1-2": "^0.0.16",
|
|
52
|
+
"@traqula/test-utils": "^0.0.16"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "2de4ee608a2337bed63ecc5cf336b1a57c39e45f"
|
|
55
55
|
}
|