holos-wasm 0.18.0 → 0.19.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 +19 -1
- package/holos_wasm.d.ts +17 -0
- package/holos_wasm_bg.js +41 -0
- package/holos_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,10 +46,28 @@ store.dump('nquads'); // everything the store holds
|
|
|
46
46
|
| What you get back | From |
|
|
47
47
|
|---|---|
|
|
48
48
|
| `true` / `false` | ASK |
|
|
49
|
-
| terms in rdf-js shape — `{termType, value}`, plus `language` and `datatype` on a literal | SELECT |
|
|
49
|
+
| terms in rdf-js shape — `{termType, value}`, plus `language`, `direction` and `datatype` on a literal; and `.variables` on the array | SELECT |
|
|
50
50
|
| N-Triples strings, one per triple, no trailing separator | CONSTRUCT, DESCRIBE |
|
|
51
51
|
| a document in the format you asked for | `queryRdf` |
|
|
52
52
|
| `{inserted, deleted, graphsCreated, graphsDropped}` | `update` |
|
|
53
|
+
| `{pending, result}`, the host fetching what is pending | `queryFederated` |
|
|
54
|
+
| the plan as JSON, with statistics from the run | `explain` |
|
|
55
|
+
|
|
56
|
+
A SELECT result carries **`.variables`**, the projected variables in order, as a property on the
|
|
57
|
+
array — so `result.length` and `for (const row of result)` keep working. The rows cannot carry
|
|
58
|
+
this: an unbound variable is absent from a row, so one unbound in *every* row is invisible, and
|
|
59
|
+
a result with no rows has no columns at all — while `head.vars` in the SPARQL results JSON
|
|
60
|
+
format must list every projected variable regardless. Without it a caller has to parse the
|
|
61
|
+
projection out of the query text.
|
|
62
|
+
|
|
63
|
+
A literal's **`direction`** is its RDF 1.2 base direction, `"ltr"`, `"rtl"` or `""` — the same
|
|
64
|
+
"always present, empty when absent" convention as `language`, because a field that is sometimes
|
|
65
|
+
missing makes every reader check before it can compare.
|
|
66
|
+
|
|
67
|
+
**`explain` evaluates.** The results are drained and discarded before the plan is written,
|
|
68
|
+
because the statistics are gathered as rows flow through the operators — a plan serialised
|
|
69
|
+
before that reports zeroes everywhere. So it costs a full run and tells you what the run did,
|
|
70
|
+
not what the planner intended.
|
|
53
71
|
|
|
54
72
|
**SELECT returns terms, not strings, since 0.17.0.** They used to be N-Triples strings,
|
|
55
73
|
which made every consumer parse term syntax to reach a value, and no RDF library in JS
|
package/holos_wasm.d.ts
CHANGED
|
@@ -30,6 +30,23 @@ export class Store {
|
|
|
30
30
|
* and every JS RDF library can parse what comes back.
|
|
31
31
|
*/
|
|
32
32
|
dump(format: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* The query plan, as JSON, with the statistics from actually running it.
|
|
35
|
+
*
|
|
36
|
+
* HOLOS has had this since the CLI's `--explain`; it was simply not reachable from here,
|
|
37
|
+
* so a browser could run a query far faster than a server and still not say how.
|
|
38
|
+
*
|
|
39
|
+
* **It evaluates.** The results are drained and discarded, because an explanation
|
|
40
|
+
* serialised before the results are consumed reports zeroes for every operator — the
|
|
41
|
+
* statistics are gathered as rows flow through it. So this costs a full run and answers
|
|
42
|
+
* what that run did, rather than what the planner intended.
|
|
43
|
+
*
|
|
44
|
+
* # Errors
|
|
45
|
+
*
|
|
46
|
+
* As `query`, plus the case where the engine returns no explanation at all, which would
|
|
47
|
+
* mean the request for one was dropped on the way through.
|
|
48
|
+
*/
|
|
49
|
+
explain(query: string, base?: string | null): string;
|
|
33
50
|
/**
|
|
34
51
|
* Load Turtle, which is the common case.
|
|
35
52
|
*/
|
package/holos_wasm_bg.js
CHANGED
|
@@ -78,6 +78,47 @@ export class Store {
|
|
|
78
78
|
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* The query plan, as JSON, with the statistics from actually running it.
|
|
83
|
+
*
|
|
84
|
+
* HOLOS has had this since the CLI's `--explain`; it was simply not reachable from here,
|
|
85
|
+
* so a browser could run a query far faster than a server and still not say how.
|
|
86
|
+
*
|
|
87
|
+
* **It evaluates.** The results are drained and discarded, because an explanation
|
|
88
|
+
* serialised before the results are consumed reports zeroes for every operator — the
|
|
89
|
+
* statistics are gathered as rows flow through it. So this costs a full run and answers
|
|
90
|
+
* what that run did, rather than what the planner intended.
|
|
91
|
+
*
|
|
92
|
+
* # Errors
|
|
93
|
+
*
|
|
94
|
+
* As `query`, plus the case where the engine returns no explanation at all, which would
|
|
95
|
+
* mean the request for one was dropped on the way through.
|
|
96
|
+
* @param {string} query
|
|
97
|
+
* @param {string | null} [base]
|
|
98
|
+
* @returns {string}
|
|
99
|
+
*/
|
|
100
|
+
explain(query, base) {
|
|
101
|
+
let deferred4_0;
|
|
102
|
+
let deferred4_1;
|
|
103
|
+
try {
|
|
104
|
+
const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
105
|
+
const len0 = WASM_VECTOR_LEN;
|
|
106
|
+
var ptr1 = isLikeNone(base) ? 0 : passStringToWasm0(base, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
107
|
+
var len1 = WASM_VECTOR_LEN;
|
|
108
|
+
const ret = wasm.store_explain(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
109
|
+
var ptr3 = ret[0];
|
|
110
|
+
var len3 = ret[1];
|
|
111
|
+
if (ret[3]) {
|
|
112
|
+
ptr3 = 0; len3 = 0;
|
|
113
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
114
|
+
}
|
|
115
|
+
deferred4_0 = ptr3;
|
|
116
|
+
deferred4_1 = len3;
|
|
117
|
+
return getStringFromWasm0(ptr3, len3);
|
|
118
|
+
} finally {
|
|
119
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
81
122
|
/**
|
|
82
123
|
* Load Turtle, which is the common case.
|
|
83
124
|
* @param {string} text
|
package/holos_wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "holos-wasm",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "WebAssembly bindings for the HOLOS RDF 1.2 store and SPARQL 1.2 engine (ESM, for bundlers)",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.19.0",
|
|
6
6
|
"license": "MIT OR Apache-2.0",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|