@wazootech/sparql-engine 0.0.0-stage → 0.5.8
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/LICENSE +21 -0
- package/README.md +729 -2
- package/THIRD_PARTY_NOTICES.md +20 -0
- package/dist/ast-CIKmrXH9.d.ts +282 -0
- package/dist/data-factory-76Dxrf0g.js +286 -0
- package/dist/index.d.ts +365 -0
- package/dist/index.js +5023 -0
- package/dist/memory-store-DhAGI-j6.d.ts +102 -0
- package/dist/memory-store-Mq4x2Ya1.js +316 -0
- package/dist/mod-C4GFefO7.d.ts +78 -0
- package/dist/parser-CTZiNJfu.js +69170 -0
- package/dist/parser.d.ts +65 -0
- package/dist/parser.js +1 -0
- package/dist/public-BNHiaGho.d.ts +234 -0
- package/dist/public-D0uwoGhU.js +416 -0
- package/dist/rdf-terms-DGpxNnyn.d.ts +83 -0
- package/dist/serialize-BSkHhuBp.js +335 -0
- package/dist/serialize.d.ts +2 -0
- package/dist/serialize.js +1 -0
- package/dist/sparql-engine-interface-Bies9KjE.d.ts +102 -0
- package/dist/store.d.ts +2 -0
- package/dist/store.js +1 -0
- package/dist/term-s9I2y-ck.js +767 -0
- package/dist/term.d.ts +2 -0
- package/dist/term.js +4 -0
- package/dist/turtle-parser-CzWF7KXf.d.ts +83 -0
- package/package.json +117 -4
package/dist/term.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as canonicalizeRdfTerm, C as XSD_INTEGER, D as numberFromText, E as numberFromNumeric, F as RDF_LANG_STRING, I as sameRdfTerm, L as termKey, M as rdfTermToSparqlValue, N as sparqlTermToRdfTerm, O as numericValue, P as RDF_DIR_LANG_STRING, S as XSD_FLOAT, T as compareNumericValues, _ as XSD_BOOLEAN, a as sha384Hex, b as XSD_DECIMAL, c as sha1Hex, d as parseDateTime, f as timezoneDurationLexical, g as XSD, h as NUMERIC_DATATYPES, i as compareRdfTerms, j as canonicalizeSparqlValue, k as CanonicalTerm, l as md5Hex, m as formatNumber, n as InternalDataFactory, o as sha512Hex, p as canonicalDouble, r as dataFactory, s as sha256Hex, t as DataFactory, u as DateTimeParts, v as XSD_DATETIME, w as XSD_STRING, x as XSD_DOUBLE, y as XSD_DAYTIME_DURATION } from "./public-BNHiaGho.js";
|
|
2
|
+
export { type CanonicalTerm, DataFactory, type DateTimeParts, type InternalDataFactory, NUMERIC_DATATYPES, RDF_DIR_LANG_STRING, RDF_LANG_STRING, XSD, XSD_BOOLEAN, XSD_DATETIME, XSD_DAYTIME_DURATION, XSD_DECIMAL, XSD_DOUBLE, XSD_FLOAT, XSD_INTEGER, XSD_STRING, canonicalDouble, canonicalizeRdfTerm, canonicalizeSparqlValue, compareNumericValues, compareRdfTerms, dataFactory, formatNumber, md5Hex, numberFromNumeric, numberFromText, numericValue, parseDateTime, rdfTermToSparqlValue, sameRdfTerm, sha1Hex, sha256Hex, sha384Hex, sha512Hex, sparqlTermToRdfTerm, termKey, timezoneDurationLexical };
|
package/dist/term.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { d as sameRdfTerm, f as termKey, n as RDF_DIR_LANG_STRING, r as RDF_LANG_STRING } from "./data-factory-76Dxrf0g.js";
|
|
2
|
+
import { C as XSD_INTEGER, D as numberFromNumeric, O as numberFromText, S as XSD_FLOAT, T as compareNumericValues, _ as XSD_BOOLEAN, a as md5Hex, b as XSD_DECIMAL, c as parseDateTime, d as canonicalizeRdfTerm, f as canonicalizeSparqlValue, g as XSD, h as NUMERIC_DATATYPES, k as numericValue, l as timezoneDurationLexical, m as sparqlTermToRdfTerm, p as rdfTermToSparqlValue, t as compareRdfTerms, v as XSD_DATETIME, w as XSD_STRING, x as XSD_DOUBLE, y as XSD_DAYTIME_DURATION } from "./term-s9I2y-ck.js";
|
|
3
|
+
import { a as sha256Hex, c as formatNumber, i as sha512Hex, n as dataFactory, o as sha1Hex, r as sha384Hex, s as canonicalDouble, t as DataFactory } from "./public-D0uwoGhU.js";
|
|
4
|
+
export { DataFactory, NUMERIC_DATATYPES, RDF_DIR_LANG_STRING, RDF_LANG_STRING, XSD, XSD_BOOLEAN, XSD_DATETIME, XSD_DAYTIME_DURATION, XSD_DECIMAL, XSD_DOUBLE, XSD_FLOAT, XSD_INTEGER, XSD_STRING, canonicalDouble, canonicalizeRdfTerm, canonicalizeSparqlValue, compareNumericValues, compareRdfTerms, dataFactory, formatNumber, md5Hex, numberFromNumeric, numberFromText, numericValue, parseDateTime, rdfTermToSparqlValue, sameRdfTerm, sha1Hex, sha256Hex, sha384Hex, sha512Hex, sparqlTermToRdfTerm, termKey, timezoneDurationLexical };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { i as RdfQuad } from "./rdf-terms-DGpxNnyn.js";
|
|
2
|
+
/**
|
|
3
|
+
* SparqlSyntaxError is the typed, position-aware error thrown for SPARQL
|
|
4
|
+
* syntax failures, surfaced through both `Parser.parse` and
|
|
5
|
+
* `WazooSparqlEngine.execute`.
|
|
6
|
+
*
|
|
7
|
+
* The generated LR parser throws `LrParseError`, whose message embeds a caret
|
|
8
|
+
* line and whose typed `hash` carries `{ text, token, line, loc, expected }`.
|
|
9
|
+
* `toSparqlSyntaxError` maps that into this structured error: 1-based line and
|
|
10
|
+
* column, the offending source line, the matched text, the token symbol, the
|
|
11
|
+
* expected-token set, and the raw parser message. Lexer failures
|
|
12
|
+
* ("Unrecognized text") become `kind: "lexical"` errors with no token or
|
|
13
|
+
* expected set.
|
|
14
|
+
*
|
|
15
|
+
* Column precision: the parser's own `loc` fields are unreliable in this
|
|
16
|
+
* generated parser and its caret line truncates past 20 characters, so the
|
|
17
|
+
* column is computed by locating the matched token text on the error line —
|
|
18
|
+
* exact for the common cases (a token that appears once on its line, or the
|
|
19
|
+
* error at end of input), with the last occurrence preferred when a
|
|
20
|
+
* delimiter repeats (e.g. a stray closing brace at the end of a query).
|
|
21
|
+
*/
|
|
22
|
+
/** SparqlSyntaxErrorKind distinguishes lexer from parser failures. */
|
|
23
|
+
type SparqlSyntaxErrorKind = "parse" | "lexical";
|
|
24
|
+
/** SparqlSyntaxErrorDetails is the structured payload of a syntax error. */
|
|
25
|
+
interface SparqlSyntaxErrorDetails {
|
|
26
|
+
kind: SparqlSyntaxErrorKind;
|
|
27
|
+
/** 1-based line of the error. */
|
|
28
|
+
line: number;
|
|
29
|
+
/** 1-based column of the error within its line. */
|
|
30
|
+
column: number;
|
|
31
|
+
/** The offending source line (no trailing newline). */
|
|
32
|
+
excerpt: string;
|
|
33
|
+
/** The text matched at the error ("" for end-of-input / lexical errors). */
|
|
34
|
+
text: string;
|
|
35
|
+
/** The offending token symbol (parse errors); null for lexical errors. */
|
|
36
|
+
token: string | null;
|
|
37
|
+
/** The token set the parser was expecting (parse errors; may be empty). */
|
|
38
|
+
expected: string[];
|
|
39
|
+
/** The generated jison error message. */
|
|
40
|
+
rawMessage: string;
|
|
41
|
+
}
|
|
42
|
+
/** SparqlSyntaxError is a line/column-positioned SPARQL syntax error. */
|
|
43
|
+
declare class SparqlSyntaxError extends Error {
|
|
44
|
+
readonly name = "SparqlSyntaxError";
|
|
45
|
+
/** errorKind tags the error so callers can dispatch without instanceof. */
|
|
46
|
+
readonly errorKind: "sparql-syntax";
|
|
47
|
+
readonly kind: SparqlSyntaxErrorKind;
|
|
48
|
+
readonly line: number;
|
|
49
|
+
readonly column: number;
|
|
50
|
+
readonly excerpt: string;
|
|
51
|
+
readonly text: string;
|
|
52
|
+
readonly token: string | null;
|
|
53
|
+
readonly expected: string[];
|
|
54
|
+
readonly rawMessage: string;
|
|
55
|
+
constructor(details: SparqlSyntaxErrorDetails);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* parseTurtleQuads parses Turtle / TriG / N-Triples / N-Quads documents into
|
|
59
|
+
* RDF/JS quads for SPARQL LOAD operations. It is a thin wrapper over the
|
|
60
|
+
* generated parser (`turtle-generated.ts`, from `turtle.jison`), which mirrors
|
|
61
|
+
* the W3C RDF 1.2 TriG grammar — including triple terms (`<<( s p o )>>`),
|
|
62
|
+
* reifiers (`~ r`), and annotation blocks (`{| p o |}`, which emit
|
|
63
|
+
* `reifier rdf:reifies ...` triples per RDF 1.2) — plus N-Quads-style graph
|
|
64
|
+
* labels on top-level statements.
|
|
65
|
+
*
|
|
66
|
+
* Graph labels are preserved: quads from TriG graph blocks or N-Quads
|
|
67
|
+
* statements carry their named graph; unlabeled triples go to the default
|
|
68
|
+
* graph.
|
|
69
|
+
*
|
|
70
|
+
* Blank nodes are standardized apart per document (a fresh counter per
|
|
71
|
+
* parse), so LOADs of different documents never collide.
|
|
72
|
+
*
|
|
73
|
+
* Parse state lives in the typed `turtleContext` (`turtle-context.ts`), which
|
|
74
|
+
* this function resets before each document; the generated parser reads and
|
|
75
|
+
* writes it through the grammar's semantic actions.
|
|
76
|
+
*
|
|
77
|
+
* @param text the document text
|
|
78
|
+
* @param baseIri base IRI used to resolve relative IRIs (and the IRI reported
|
|
79
|
+
* for LOAD); relative IRI resolution follows RFC 3986 §5
|
|
80
|
+
* @returns the parsed quads, with graph labels preserved
|
|
81
|
+
*/
|
|
82
|
+
declare function parseTurtleQuads(text: string, baseIri?: string): RdfQuad[];
|
|
83
|
+
export { SparqlSyntaxError as n, parseTurtleQuads as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,119 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wazootech/sparql-engine",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.5.8",
|
|
4
|
+
"description": "Run SPARQL 1.1 and 1.2 queries and updates over your RDF data in TypeScript, on Node.js, Bun, Deno and in the browser. No WebAssembly, no framework.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"sparql",
|
|
7
|
+
"rdf",
|
|
8
|
+
"rdfjs",
|
|
9
|
+
"turtle",
|
|
10
|
+
"knowledge-graph",
|
|
11
|
+
"linked-data",
|
|
12
|
+
"query-engine"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/wazootech/sparql-engine#readme",
|
|
15
|
+
"bugs": "https://github.com/wazootech/sparql-engine/issues",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/wazootech/sparql-engine.git"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"type": "module",
|
|
22
|
+
"packageManager": "bun@1.4.5",
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=22"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist/*.js",
|
|
28
|
+
"dist/*.d.ts",
|
|
29
|
+
"THIRD_PARTY_NOTICES.md"
|
|
30
|
+
],
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"default": "./dist/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./term": {
|
|
40
|
+
"types": "./dist/term.d.ts",
|
|
41
|
+
"default": "./dist/term.js"
|
|
42
|
+
},
|
|
43
|
+
"./data-model": {
|
|
44
|
+
"types": "./dist/term.d.ts",
|
|
45
|
+
"default": "./dist/term.js"
|
|
46
|
+
},
|
|
47
|
+
"./store": {
|
|
48
|
+
"types": "./dist/store.d.ts",
|
|
49
|
+
"default": "./dist/store.js"
|
|
50
|
+
},
|
|
51
|
+
"./parser": {
|
|
52
|
+
"types": "./dist/parser.d.ts",
|
|
53
|
+
"default": "./dist/parser.js"
|
|
54
|
+
},
|
|
55
|
+
"./serialize": {
|
|
56
|
+
"types": "./dist/serialize.d.ts",
|
|
57
|
+
"default": "./dist/serialize.js"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"bundle": "bun build --minify playground/bundle-entry.ts --outfile playground/app.js",
|
|
62
|
+
"bench": "bun bench/engine_bench.ts && bun bench/cli-targets-bench.ts",
|
|
63
|
+
"bench:check": "bun bench/budget.ts",
|
|
64
|
+
"bench:size": "bun run build && bun bench/measure-libs.ts > bench/size-data.json && bun bench/treemap.ts",
|
|
65
|
+
"bench:size:closures": "bun bench/measure-closures.ts && bun bench/treemap.ts",
|
|
66
|
+
"bench:memory": "bun bench/collect-memory.ts && bun bench/treemap.ts",
|
|
67
|
+
"bench:latency": "bun bench/engine_bench.ts --json > bench/latency-data.json && bun bench/latency-chart.ts",
|
|
68
|
+
"bench:latency:check": "BENCH_INVENTORY=1 bun bench/engine_bench.ts --json | bun bench/latency-check.ts",
|
|
69
|
+
"bench:profile": "bun bench/parse-profile.ts",
|
|
70
|
+
"bench:cli": "bun bench/cli-bench.ts",
|
|
71
|
+
"bench:cli:targets": "bun bench/cli-targets-bench.ts",
|
|
72
|
+
"build": "tsdown",
|
|
73
|
+
"check": "bun check --no-script",
|
|
74
|
+
"check:package": "bun scripts/check-package.ts",
|
|
75
|
+
"ci": "bun run fmt:check && bun run lint && bun run check && bun run parser:check && bun run test && bun run publish:check && bun run bench:check && bun run test:exists-ref && bun run test:sparql12:gap && bun run test:sparql12 && bun run test:rdf11 && bun run test:rdf12",
|
|
76
|
+
"compile": "bun build --compile --outfile dist/sparql cli/main.ts",
|
|
77
|
+
"docs:link-check": "bun docs/link-check.ts",
|
|
78
|
+
"fmt": "bun fmt --no-script",
|
|
79
|
+
"fmt:check": "bun fmt --no-script --check",
|
|
80
|
+
"lint": "oxlint --deny-warnings",
|
|
81
|
+
"native:coverage": "bun cli/native-coverage.ts",
|
|
82
|
+
"native:build": "bun cli/native-build.ts",
|
|
83
|
+
"mutation": "stryker run",
|
|
84
|
+
"native:gate": "bun cli/native-gate.ts",
|
|
85
|
+
"parser:generate": "bun src/parser/generate-parser.ts",
|
|
86
|
+
"parser:check": "bun src/parser/generate-parser.ts --check",
|
|
87
|
+
"publish:check": "bun test/publish-graph-check.ts",
|
|
88
|
+
"test": "bun test --timeout 120000",
|
|
89
|
+
"test:exists-ref": "bun test/w3c/exists-ref.ts",
|
|
90
|
+
"test:heldout-fuzz": "bun bench/heldout-fuzz.ts",
|
|
91
|
+
"test:rdf11": "bun test/w3c/rdf-differential.ts",
|
|
92
|
+
"test:rdf12": "bun test/w3c/rdf-classify.ts",
|
|
93
|
+
"test:ref": "bun test/w3c/ref-crosscheck.ts",
|
|
94
|
+
"test:sparql12": "bun test/w3c/sparql12-main.ts",
|
|
95
|
+
"test:sparql12:gap": "bun test/w3c/sparql12-gap.ts",
|
|
96
|
+
"test:w3c": "bun test/w3c/w3c-main.ts"
|
|
97
|
+
},
|
|
98
|
+
"dependencies": {
|
|
99
|
+
"@rdfjs/types": "^2.0.1"
|
|
100
|
+
},
|
|
101
|
+
"devDependencies": {
|
|
102
|
+
"@comunica/query-sparql-rdfjs-lite": "^5.1.3",
|
|
103
|
+
"@stryker-mutator/core": "10.1.1",
|
|
104
|
+
"@types/node": "^22.10.0",
|
|
105
|
+
"@wazoo/sparql-engine-published": "npm:@jsr/wazoo__sparql-engine@0.4.1",
|
|
106
|
+
"ebnf-parser": "0.1.10",
|
|
107
|
+
"jison": "0.4.18",
|
|
108
|
+
"mitata": "1.0.34",
|
|
109
|
+
"n3": "2.2.0",
|
|
110
|
+
"n3-rdfstar": "npm:n3@1.26.0",
|
|
111
|
+
"oxigraph": "^0.5.9",
|
|
112
|
+
"oxlint": "1.94.0",
|
|
113
|
+
"tsdown": "0.23.7",
|
|
114
|
+
"typescript": "5.9.3"
|
|
115
|
+
},
|
|
116
|
+
"patchedDependencies": {
|
|
117
|
+
"@comunica/actor-http-fetch@5.5.0": "patches/@comunica%2Factor-http-fetch@5.5.0.patch"
|
|
118
|
+
}
|
|
119
|
+
}
|