rete-graph 0.1.0
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 +79 -0
- package/dist/index.js +1436 -0
- package/dist/rete-graph.js +1492 -0
- package/dist/rete-graph.min.js +22 -0
- package/dist/rete_wasm_bg.wasm +0 -0
- package/index.d.ts +65 -0
- package/package.json +33 -0
|
Binary file
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Type declarations for rete-graph — query .rete graph files with SPARQL.
|
|
2
|
+
|
|
3
|
+
export type TermKind = "iri" | "literal" | "bnode" | "triple";
|
|
4
|
+
|
|
5
|
+
export class Term {
|
|
6
|
+
kind: TermKind;
|
|
7
|
+
value: string;
|
|
8
|
+
datatype: string | null;
|
|
9
|
+
lang: string | null;
|
|
10
|
+
constructor(kind: TermKind, value: string, datatype?: string | null, lang?: string | null);
|
|
11
|
+
/** Parse an N-Triples-style term token as emitted by the engine. */
|
|
12
|
+
static parse(token: string): Term;
|
|
13
|
+
/** number/boolean/BigInt for common XSD datatypes, else the string value. */
|
|
14
|
+
toJS(): string | number | boolean | bigint;
|
|
15
|
+
/** The term back in N-Triples surface form. */
|
|
16
|
+
readonly n3: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type Row = Record<string, Term>;
|
|
20
|
+
export type Triple = [Term, Term, Term];
|
|
21
|
+
|
|
22
|
+
export interface QueryOptions {
|
|
23
|
+
/** OWL 2 QL entailment by query rewriting. */
|
|
24
|
+
reason?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export class Graph {
|
|
28
|
+
readonly source: string;
|
|
29
|
+
/** SELECT → Row[]; ASK → boolean; CONSTRUCT/DESCRIBE → Triple[]. */
|
|
30
|
+
query(query: string, opts?: QueryOptions): Row[] | boolean | Triple[];
|
|
31
|
+
/** The engine's raw JSON result envelope. */
|
|
32
|
+
queryRaw(query: string, opts?: QueryOptions): unknown;
|
|
33
|
+
prefixSearch(prefix: string, limit?: number): { label: string; subject: string }[];
|
|
34
|
+
textSearch(
|
|
35
|
+
words: string | string[],
|
|
36
|
+
opts?: { contains?: string | null; limit?: number },
|
|
37
|
+
): string[];
|
|
38
|
+
schema(): {
|
|
39
|
+
classes: [iri: string, count: number][];
|
|
40
|
+
relations: [s: string, p: string, o: string, count: number][];
|
|
41
|
+
};
|
|
42
|
+
info(): { quads: number; terms: number; pyramidLevels: number; namedGraphs: number };
|
|
43
|
+
readonly quads: number;
|
|
44
|
+
graphNames(): string[];
|
|
45
|
+
/** Remote graphs only: cumulative fetch counters; null for bytes graphs. */
|
|
46
|
+
stats(): { fileLength: number; bytes: number; requests: number } | null;
|
|
47
|
+
/** Remote graphs only: blake3-16 hex content hash; null for bytes graphs. */
|
|
48
|
+
contentHash(): string | null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Open a `.rete` graph: bytes, or an http(s) URL read lazily over HTTP Range.
|
|
53
|
+
* Remote opens use synchronous XHR: Node and browser web workers only
|
|
54
|
+
* (browser main threads forbid sync binary XHR — open bytes there).
|
|
55
|
+
*/
|
|
56
|
+
export function open(
|
|
57
|
+
source: Uint8Array | ArrayBuffer | string,
|
|
58
|
+
opts?: { headers?: Record<string, string> },
|
|
59
|
+
): Promise<Graph>;
|
|
60
|
+
|
|
61
|
+
/** Build a complete `.rete` file image from RDF text ("nt", "nq", "ttl"). */
|
|
62
|
+
export function build(text: string, format?: "nt" | "nq" | "ttl"): Promise<Uint8Array>;
|
|
63
|
+
|
|
64
|
+
/** Initialize the wasm engine explicitly (open()/build() do it lazily). */
|
|
65
|
+
export function init(source?: BufferSource | WebAssembly.Module | URL | string | null): Promise<void>;
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rete-graph",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Query local and remote .rete graph files with SPARQL — WebAssembly client for browsers and Node.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/caviri/rete.git",
|
|
9
|
+
"directory": "clients/js"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://caviri.github.io/rete/javascript.html",
|
|
12
|
+
"keywords": ["rdf", "sparql", "graph", "database", "wasm", "linked-data", "range-requests"],
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"types": "./index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./index.d.ts",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./bundle": "./dist/rete-graph.js",
|
|
22
|
+
"./bundle.min": "./dist/rete-graph.min.js"
|
|
23
|
+
},
|
|
24
|
+
"files": ["dist/", "index.d.ts", "README.md"],
|
|
25
|
+
"engines": { "node": ">=18" },
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "node build.mjs",
|
|
28
|
+
"test": "npm run build && node --test --test-timeout=60000 ./test/*.test.mjs"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"esbuild": "^0.25.0"
|
|
32
|
+
}
|
|
33
|
+
}
|