rete-graph 0.1.0 → 0.3.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 +21 -1
- package/dist/index.js +1283 -23
- package/dist/rete-graph.js +1284 -24
- package/dist/rete-graph.min.js +61 -10
- package/dist/rete_wasm_bg.wasm +0 -0
- package/index.d.ts +34 -3
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rete-graph v0.
|
|
1
|
+
/*! rete-graph v0.3.0 | Apache-2.0 | https://github.com/caviri/rete */
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __esm = (fn, res) => function __init() {
|
|
@@ -41,13 +41,64 @@ var init_node_sync_xhr = __esm({
|
|
|
41
41
|
"src/node-sync-xhr.js"() {
|
|
42
42
|
WORKER_SRC = `
|
|
43
43
|
const { parentPort } = require("node:worker_threads");
|
|
44
|
+
const fs = require("node:fs");
|
|
45
|
+
const { fileURLToPath } = require("node:url");
|
|
46
|
+
|
|
47
|
+
// One open descriptor per file, reused across the many small range reads a
|
|
48
|
+
// query makes (reopening per read would dominate the cost).
|
|
49
|
+
const fds = new Map();
|
|
50
|
+
const fdFor = (path) => {
|
|
51
|
+
let fd = fds.get(path);
|
|
52
|
+
if (fd === undefined) {
|
|
53
|
+
fd = fs.openSync(path, "r");
|
|
54
|
+
fds.set(path, fd);
|
|
55
|
+
}
|
|
56
|
+
return fd;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
function readFile(method, url, headers, result) {
|
|
60
|
+
const path = fileURLToPath(url);
|
|
61
|
+
const size = fs.fstatSync(fdFor(path)).size;
|
|
62
|
+
if (method === "HEAD") {
|
|
63
|
+
result.status = 200;
|
|
64
|
+
result.headers["content-length"] = String(size);
|
|
65
|
+
result.body = new ArrayBuffer(0);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const range = /bytes=(\\d+)-(\\d*)/.exec(headers.Range || headers.range || "");
|
|
69
|
+
const start = range ? Number(range[1]) : 0;
|
|
70
|
+
const end = range && range[2] ? Math.min(Number(range[2]), size - 1) : size - 1;
|
|
71
|
+
if (start >= size) {
|
|
72
|
+
result.status = 416;
|
|
73
|
+
result.headers["content-range"] = "bytes */" + size;
|
|
74
|
+
result.body = new ArrayBuffer(0);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const len = Math.max(0, end - start + 1);
|
|
78
|
+
const buf = Buffer.allocUnsafe(len);
|
|
79
|
+
let got = 0;
|
|
80
|
+
while (got < len) {
|
|
81
|
+
const n = fs.readSync(fdFor(path), buf, got, len - got, start + got);
|
|
82
|
+
if (n <= 0) break;
|
|
83
|
+
got += n;
|
|
84
|
+
}
|
|
85
|
+
result.status = range ? 206 : 200;
|
|
86
|
+
result.headers["content-length"] = String(got);
|
|
87
|
+
if (range) result.headers["content-range"] = "bytes " + start + "-" + (start + got - 1) + "/" + size;
|
|
88
|
+
result.body = buf.buffer.slice(buf.byteOffset, buf.byteOffset + got);
|
|
89
|
+
}
|
|
90
|
+
|
|
44
91
|
parentPort.on("message", async ({ port, signal, method, url, headers, body }) => {
|
|
45
92
|
const result = { status: 0, headers: {}, body: null, error: null };
|
|
46
93
|
try {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
94
|
+
if (url.startsWith("file:")) {
|
|
95
|
+
readFile(method, url, headers, result);
|
|
96
|
+
} else {
|
|
97
|
+
const resp = await fetch(url, { method, headers, body: body ?? undefined });
|
|
98
|
+
result.status = resp.status;
|
|
99
|
+
for (const [k, v] of resp.headers) result.headers[k.toLowerCase()] = v;
|
|
100
|
+
result.body = await resp.arrayBuffer();
|
|
101
|
+
}
|
|
51
102
|
} catch (e) {
|
|
52
103
|
result.error = String(e);
|
|
53
104
|
}
|
|
@@ -95,6 +146,47 @@ parentPort.on("message", async ({ port, signal, method, url, headers, body }) =>
|
|
|
95
146
|
});
|
|
96
147
|
|
|
97
148
|
// vendor/pkg/rete_wasm.js
|
|
149
|
+
var rete_wasm_exports = {};
|
|
150
|
+
__export(rete_wasm_exports, {
|
|
151
|
+
Graph: () => Graph,
|
|
152
|
+
RemoteGraph: () => RemoteGraph,
|
|
153
|
+
__start: () => __start,
|
|
154
|
+
build: () => build,
|
|
155
|
+
card: () => card,
|
|
156
|
+
card_url: () => card_url,
|
|
157
|
+
check_schema: () => check_schema,
|
|
158
|
+
check_schema_url: () => check_schema_url,
|
|
159
|
+
communities: () => communities,
|
|
160
|
+
default: () => __wbg_init,
|
|
161
|
+
file_layout: () => file_layout,
|
|
162
|
+
graph_names: () => graph_names,
|
|
163
|
+
header_ranges: () => header_ranges,
|
|
164
|
+
info: () => info,
|
|
165
|
+
initSync: () => initSync,
|
|
166
|
+
prefix_search: () => prefix_search,
|
|
167
|
+
progressive_query: () => progressive_query,
|
|
168
|
+
pyramid_tree: () => pyramid_tree,
|
|
169
|
+
query: () => query,
|
|
170
|
+
query_communities: () => query_communities,
|
|
171
|
+
query_sparql: () => query_sparql,
|
|
172
|
+
query_triples: () => query_triples,
|
|
173
|
+
reach: () => reach,
|
|
174
|
+
reach_url: () => reach_url,
|
|
175
|
+
reason: () => reason,
|
|
176
|
+
reason_construct_url: () => reason_construct_url,
|
|
177
|
+
reason_url: () => reason_url,
|
|
178
|
+
schema: () => schema,
|
|
179
|
+
schema_packed: () => schema_packed,
|
|
180
|
+
schema_url: () => schema_url,
|
|
181
|
+
shacl: () => shacl,
|
|
182
|
+
shacl_construct_url: () => shacl_construct_url,
|
|
183
|
+
shacl_url: () => shacl_url,
|
|
184
|
+
sparql_url: () => sparql_url,
|
|
185
|
+
summary_overview: () => summary_overview,
|
|
186
|
+
text_search: () => text_search,
|
|
187
|
+
why_triples: () => why_triples,
|
|
188
|
+
why_url: () => why_url
|
|
189
|
+
});
|
|
98
190
|
var Graph = class {
|
|
99
191
|
__destroy_into_raw() {
|
|
100
192
|
const ptr = this.__wbg_ptr;
|
|
@@ -106,6 +198,19 @@ var Graph = class {
|
|
|
106
198
|
const ptr = this.__destroy_into_raw();
|
|
107
199
|
wasm.__wbg_graph_free(ptr, 0);
|
|
108
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* See [`card`] — the Dataset Card of the resident file.
|
|
203
|
+
* @returns {string | undefined}
|
|
204
|
+
*/
|
|
205
|
+
card() {
|
|
206
|
+
const ret = wasm.graph_card(this.__wbg_ptr);
|
|
207
|
+
let v1;
|
|
208
|
+
if (ret[0] !== 0) {
|
|
209
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
210
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
211
|
+
}
|
|
212
|
+
return v1;
|
|
213
|
+
}
|
|
109
214
|
/**
|
|
110
215
|
* See [`file_layout`].
|
|
111
216
|
* @returns {string}
|
|
@@ -239,11 +344,11 @@ var Graph = class {
|
|
|
239
344
|
* @param {string} format
|
|
240
345
|
* @returns {string}
|
|
241
346
|
*/
|
|
242
|
-
query(
|
|
347
|
+
query(query2, format) {
|
|
243
348
|
let deferred4_0;
|
|
244
349
|
let deferred4_1;
|
|
245
350
|
try {
|
|
246
|
-
const ptr0 = passStringToWasm0(
|
|
351
|
+
const ptr0 = passStringToWasm0(query2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
247
352
|
const len0 = WASM_VECTOR_LEN;
|
|
248
353
|
const ptr1 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
249
354
|
const len1 = WASM_VECTOR_LEN;
|
|
@@ -268,11 +373,11 @@ var Graph = class {
|
|
|
268
373
|
* @param {number | null} [round]
|
|
269
374
|
* @returns {string}
|
|
270
375
|
*/
|
|
271
|
-
query_communities(
|
|
376
|
+
query_communities(query2, round) {
|
|
272
377
|
let deferred3_0;
|
|
273
378
|
let deferred3_1;
|
|
274
379
|
try {
|
|
275
|
-
const ptr0 = passStringToWasm0(
|
|
380
|
+
const ptr0 = passStringToWasm0(query2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
276
381
|
const len0 = WASM_VECTOR_LEN;
|
|
277
382
|
const ret = wasm.graph_query_communities(this.__wbg_ptr, ptr0, len0, isLikeNone(round) ? Number.MAX_SAFE_INTEGER : round >>> 0);
|
|
278
383
|
var ptr2 = ret[0];
|
|
@@ -296,11 +401,11 @@ var Graph = class {
|
|
|
296
401
|
* @param {string} format
|
|
297
402
|
* @returns {string}
|
|
298
403
|
*/
|
|
299
|
-
query_reasoned(
|
|
404
|
+
query_reasoned(query2, format) {
|
|
300
405
|
let deferred4_0;
|
|
301
406
|
let deferred4_1;
|
|
302
407
|
try {
|
|
303
|
-
const ptr0 = passStringToWasm0(
|
|
408
|
+
const ptr0 = passStringToWasm0(query2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
304
409
|
const len0 = WASM_VECTOR_LEN;
|
|
305
410
|
const ptr1 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
306
411
|
const len1 = WASM_VECTOR_LEN;
|
|
@@ -531,6 +636,23 @@ var RemoteGraph = class {
|
|
|
531
636
|
const ptr = this.__destroy_into_raw();
|
|
532
637
|
wasm.__wbg_remotegraph_free(ptr, 0);
|
|
533
638
|
}
|
|
639
|
+
/**
|
|
640
|
+
* See [`card_url`] — the Dataset Card, over the resident handle's reader
|
|
641
|
+
* (so the header range it already fetched is served from the block cache).
|
|
642
|
+
* @returns {string | undefined}
|
|
643
|
+
*/
|
|
644
|
+
card() {
|
|
645
|
+
const ret = wasm.remotegraph_card(this.__wbg_ptr);
|
|
646
|
+
if (ret[3]) {
|
|
647
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
648
|
+
}
|
|
649
|
+
let v1;
|
|
650
|
+
if (ret[0] !== 0) {
|
|
651
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
652
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
653
|
+
}
|
|
654
|
+
return v1;
|
|
655
|
+
}
|
|
534
656
|
/**
|
|
535
657
|
* The file's content hash (blake3-16, hex). The worker keys its session
|
|
536
658
|
* cache by this rather than the URL, so two URLs of the same file share the
|
|
@@ -550,6 +672,45 @@ var RemoteGraph = class {
|
|
|
550
672
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
551
673
|
}
|
|
552
674
|
}
|
|
675
|
+
/**
|
|
676
|
+
* See [`graph_names`].
|
|
677
|
+
* @returns {string}
|
|
678
|
+
*/
|
|
679
|
+
graph_names() {
|
|
680
|
+
let deferred2_0;
|
|
681
|
+
let deferred2_1;
|
|
682
|
+
try {
|
|
683
|
+
const ret = wasm.remotegraph_graph_names(this.__wbg_ptr);
|
|
684
|
+
var ptr1 = ret[0];
|
|
685
|
+
var len1 = ret[1];
|
|
686
|
+
if (ret[3]) {
|
|
687
|
+
ptr1 = 0;
|
|
688
|
+
len1 = 0;
|
|
689
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
690
|
+
}
|
|
691
|
+
deferred2_0 = ptr1;
|
|
692
|
+
deferred2_1 = len1;
|
|
693
|
+
return getStringFromWasm0(ptr1, len1);
|
|
694
|
+
} finally {
|
|
695
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* See [`info`] — read from the resident header, no extra fetch.
|
|
700
|
+
* @returns {string}
|
|
701
|
+
*/
|
|
702
|
+
info() {
|
|
703
|
+
let deferred1_0;
|
|
704
|
+
let deferred1_1;
|
|
705
|
+
try {
|
|
706
|
+
const ret = wasm.remotegraph_info(this.__wbg_ptr);
|
|
707
|
+
deferred1_0 = ret[0];
|
|
708
|
+
deferred1_1 = ret[1];
|
|
709
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
710
|
+
} finally {
|
|
711
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
553
714
|
/**
|
|
554
715
|
* Open a remote `.rete` over HTTP range and keep it resident for repeated
|
|
555
716
|
* querying. The first query faults in the dictionary chunks + index tiles it
|
|
@@ -598,15 +759,19 @@ var RemoteGraph = class {
|
|
|
598
759
|
}
|
|
599
760
|
/**
|
|
600
761
|
* See [`sparql_url`] — same query, but over the resident, cached handle.
|
|
762
|
+
* The incompleteness verdict is PER QUERY: reset the sticky failure flags
|
|
763
|
+
* first, so one transient fetch failure fails only the query it happened
|
|
764
|
+
* in — not every later query on this session (failed tiles/chunks are
|
|
765
|
+
* never cached, so they retry here).
|
|
601
766
|
* @param {string} query
|
|
602
767
|
* @param {string} format
|
|
603
768
|
* @returns {string}
|
|
604
769
|
*/
|
|
605
|
-
query(
|
|
770
|
+
query(query2, format) {
|
|
606
771
|
let deferred4_0;
|
|
607
772
|
let deferred4_1;
|
|
608
773
|
try {
|
|
609
|
-
const ptr0 = passStringToWasm0(
|
|
774
|
+
const ptr0 = passStringToWasm0(query2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
610
775
|
const len0 = WASM_VECTOR_LEN;
|
|
611
776
|
const ptr1 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
612
777
|
const len1 = WASM_VECTOR_LEN;
|
|
@@ -632,11 +797,11 @@ var RemoteGraph = class {
|
|
|
632
797
|
* @param {string} format
|
|
633
798
|
* @returns {string}
|
|
634
799
|
*/
|
|
635
|
-
query_reasoned(
|
|
800
|
+
query_reasoned(query2, format) {
|
|
636
801
|
let deferred4_0;
|
|
637
802
|
let deferred4_1;
|
|
638
803
|
try {
|
|
639
|
-
const ptr0 = passStringToWasm0(
|
|
804
|
+
const ptr0 = passStringToWasm0(query2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
640
805
|
const len0 = WASM_VECTOR_LEN;
|
|
641
806
|
const ptr1 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
642
807
|
const len1 = WASM_VECTOR_LEN;
|
|
@@ -655,6 +820,65 @@ var RemoteGraph = class {
|
|
|
655
820
|
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
656
821
|
}
|
|
657
822
|
}
|
|
823
|
+
/**
|
|
824
|
+
* See [`schema_url`] — the **baked** schema pyramid over the resident
|
|
825
|
+
* handle. Deliberately never falls back to the scanning [`schema`]: that
|
|
826
|
+
* would drag the whole remote file across the wire.
|
|
827
|
+
* @returns {string}
|
|
828
|
+
*/
|
|
829
|
+
schema() {
|
|
830
|
+
let deferred2_0;
|
|
831
|
+
let deferred2_1;
|
|
832
|
+
try {
|
|
833
|
+
const ret = wasm.remotegraph_schema(this.__wbg_ptr);
|
|
834
|
+
var ptr1 = ret[0];
|
|
835
|
+
var len1 = ret[1];
|
|
836
|
+
if (ret[3]) {
|
|
837
|
+
ptr1 = 0;
|
|
838
|
+
len1 = 0;
|
|
839
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
840
|
+
}
|
|
841
|
+
deferred2_0 = ptr1;
|
|
842
|
+
deferred2_1 = len1;
|
|
843
|
+
return getStringFromWasm0(ptr1, len1);
|
|
844
|
+
} finally {
|
|
845
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* See [`shacl_url`] — validate over the resident handle. The default graph
|
|
850
|
+
* validates lazily against the index (only the shapes' targets are
|
|
851
|
+
* fetched), so a shape over a huge remote file stays cheap.
|
|
852
|
+
* @param {string} shapes_turtle
|
|
853
|
+
* @param {string | null | undefined} graph
|
|
854
|
+
* @param {string} format
|
|
855
|
+
* @returns {string}
|
|
856
|
+
*/
|
|
857
|
+
shacl(shapes_turtle, graph, format) {
|
|
858
|
+
let deferred5_0;
|
|
859
|
+
let deferred5_1;
|
|
860
|
+
try {
|
|
861
|
+
const ptr0 = passStringToWasm0(shapes_turtle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
862
|
+
const len0 = WASM_VECTOR_LEN;
|
|
863
|
+
var ptr1 = isLikeNone(graph) ? 0 : passStringToWasm0(graph, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
864
|
+
var len1 = WASM_VECTOR_LEN;
|
|
865
|
+
const ptr2 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
866
|
+
const len2 = WASM_VECTOR_LEN;
|
|
867
|
+
const ret = wasm.remotegraph_shacl(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
868
|
+
var ptr4 = ret[0];
|
|
869
|
+
var len4 = ret[1];
|
|
870
|
+
if (ret[3]) {
|
|
871
|
+
ptr4 = 0;
|
|
872
|
+
len4 = 0;
|
|
873
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
874
|
+
}
|
|
875
|
+
deferred5_0 = ptr4;
|
|
876
|
+
deferred5_1 = len4;
|
|
877
|
+
return getStringFromWasm0(ptr4, len4);
|
|
878
|
+
} finally {
|
|
879
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
880
|
+
}
|
|
881
|
+
}
|
|
658
882
|
/**
|
|
659
883
|
* `{ fileLength, bytes, requests }` — CUMULATIVE physical fetches since this
|
|
660
884
|
* session opened. The worker diffs successive calls to report a single
|
|
@@ -707,6 +931,9 @@ var RemoteGraph = class {
|
|
|
707
931
|
}
|
|
708
932
|
};
|
|
709
933
|
if (Symbol.dispose) RemoteGraph.prototype[Symbol.dispose] = RemoteGraph.prototype.free;
|
|
934
|
+
function __start() {
|
|
935
|
+
wasm.__start();
|
|
936
|
+
}
|
|
710
937
|
function build(text, format) {
|
|
711
938
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
712
939
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -720,6 +947,734 @@ function build(text, format) {
|
|
|
720
947
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
721
948
|
return v3;
|
|
722
949
|
}
|
|
950
|
+
function card(bytes) {
|
|
951
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
952
|
+
const len0 = WASM_VECTOR_LEN;
|
|
953
|
+
const ret = wasm.card(ptr0, len0);
|
|
954
|
+
if (ret[3]) {
|
|
955
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
956
|
+
}
|
|
957
|
+
let v2;
|
|
958
|
+
if (ret[0] !== 0) {
|
|
959
|
+
v2 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
960
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
961
|
+
}
|
|
962
|
+
return v2;
|
|
963
|
+
}
|
|
964
|
+
function card_url(url) {
|
|
965
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
966
|
+
const len0 = WASM_VECTOR_LEN;
|
|
967
|
+
const ret = wasm.card_url(ptr0, len0);
|
|
968
|
+
if (ret[3]) {
|
|
969
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
970
|
+
}
|
|
971
|
+
let v2;
|
|
972
|
+
if (ret[0] !== 0) {
|
|
973
|
+
v2 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
974
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
975
|
+
}
|
|
976
|
+
return v2;
|
|
977
|
+
}
|
|
978
|
+
function check_schema(bytes) {
|
|
979
|
+
let deferred3_0;
|
|
980
|
+
let deferred3_1;
|
|
981
|
+
try {
|
|
982
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
983
|
+
const len0 = WASM_VECTOR_LEN;
|
|
984
|
+
const ret = wasm.check_schema(ptr0, len0);
|
|
985
|
+
var ptr2 = ret[0];
|
|
986
|
+
var len2 = ret[1];
|
|
987
|
+
if (ret[3]) {
|
|
988
|
+
ptr2 = 0;
|
|
989
|
+
len2 = 0;
|
|
990
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
991
|
+
}
|
|
992
|
+
deferred3_0 = ptr2;
|
|
993
|
+
deferred3_1 = len2;
|
|
994
|
+
return getStringFromWasm0(ptr2, len2);
|
|
995
|
+
} finally {
|
|
996
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
function check_schema_url(url) {
|
|
1000
|
+
let deferred3_0;
|
|
1001
|
+
let deferred3_1;
|
|
1002
|
+
try {
|
|
1003
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1004
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1005
|
+
const ret = wasm.check_schema_url(ptr0, len0);
|
|
1006
|
+
var ptr2 = ret[0];
|
|
1007
|
+
var len2 = ret[1];
|
|
1008
|
+
if (ret[3]) {
|
|
1009
|
+
ptr2 = 0;
|
|
1010
|
+
len2 = 0;
|
|
1011
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1012
|
+
}
|
|
1013
|
+
deferred3_0 = ptr2;
|
|
1014
|
+
deferred3_1 = len2;
|
|
1015
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1016
|
+
} finally {
|
|
1017
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
function communities(bytes, round) {
|
|
1021
|
+
let deferred3_0;
|
|
1022
|
+
let deferred3_1;
|
|
1023
|
+
try {
|
|
1024
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1025
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1026
|
+
const ret = wasm.communities(ptr0, len0, isLikeNone(round) ? Number.MAX_SAFE_INTEGER : round >>> 0);
|
|
1027
|
+
var ptr2 = ret[0];
|
|
1028
|
+
var len2 = ret[1];
|
|
1029
|
+
if (ret[3]) {
|
|
1030
|
+
ptr2 = 0;
|
|
1031
|
+
len2 = 0;
|
|
1032
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1033
|
+
}
|
|
1034
|
+
deferred3_0 = ptr2;
|
|
1035
|
+
deferred3_1 = len2;
|
|
1036
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1037
|
+
} finally {
|
|
1038
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
function file_layout(bytes) {
|
|
1042
|
+
let deferred3_0;
|
|
1043
|
+
let deferred3_1;
|
|
1044
|
+
try {
|
|
1045
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1046
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1047
|
+
const ret = wasm.file_layout(ptr0, len0);
|
|
1048
|
+
var ptr2 = ret[0];
|
|
1049
|
+
var len2 = ret[1];
|
|
1050
|
+
if (ret[3]) {
|
|
1051
|
+
ptr2 = 0;
|
|
1052
|
+
len2 = 0;
|
|
1053
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1054
|
+
}
|
|
1055
|
+
deferred3_0 = ptr2;
|
|
1056
|
+
deferred3_1 = len2;
|
|
1057
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1058
|
+
} finally {
|
|
1059
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
function graph_names(bytes) {
|
|
1063
|
+
let deferred3_0;
|
|
1064
|
+
let deferred3_1;
|
|
1065
|
+
try {
|
|
1066
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1067
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1068
|
+
const ret = wasm.graph_names(ptr0, len0);
|
|
1069
|
+
var ptr2 = ret[0];
|
|
1070
|
+
var len2 = ret[1];
|
|
1071
|
+
if (ret[3]) {
|
|
1072
|
+
ptr2 = 0;
|
|
1073
|
+
len2 = 0;
|
|
1074
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1075
|
+
}
|
|
1076
|
+
deferred3_0 = ptr2;
|
|
1077
|
+
deferred3_1 = len2;
|
|
1078
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1079
|
+
} finally {
|
|
1080
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
function header_ranges(head) {
|
|
1084
|
+
let deferred3_0;
|
|
1085
|
+
let deferred3_1;
|
|
1086
|
+
try {
|
|
1087
|
+
const ptr0 = passArray8ToWasm0(head, wasm.__wbindgen_malloc);
|
|
1088
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1089
|
+
const ret = wasm.header_ranges(ptr0, len0);
|
|
1090
|
+
var ptr2 = ret[0];
|
|
1091
|
+
var len2 = ret[1];
|
|
1092
|
+
if (ret[3]) {
|
|
1093
|
+
ptr2 = 0;
|
|
1094
|
+
len2 = 0;
|
|
1095
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1096
|
+
}
|
|
1097
|
+
deferred3_0 = ptr2;
|
|
1098
|
+
deferred3_1 = len2;
|
|
1099
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1100
|
+
} finally {
|
|
1101
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
function info(bytes) {
|
|
1105
|
+
let deferred3_0;
|
|
1106
|
+
let deferred3_1;
|
|
1107
|
+
try {
|
|
1108
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1109
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1110
|
+
const ret = wasm.info(ptr0, len0);
|
|
1111
|
+
var ptr2 = ret[0];
|
|
1112
|
+
var len2 = ret[1];
|
|
1113
|
+
if (ret[3]) {
|
|
1114
|
+
ptr2 = 0;
|
|
1115
|
+
len2 = 0;
|
|
1116
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1117
|
+
}
|
|
1118
|
+
deferred3_0 = ptr2;
|
|
1119
|
+
deferred3_1 = len2;
|
|
1120
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1121
|
+
} finally {
|
|
1122
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
function prefix_search(bytes, prefix, limit) {
|
|
1126
|
+
let deferred4_0;
|
|
1127
|
+
let deferred4_1;
|
|
1128
|
+
try {
|
|
1129
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1130
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1131
|
+
const ptr1 = passStringToWasm0(prefix, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1132
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1133
|
+
const ret = wasm.prefix_search(ptr0, len0, ptr1, len1, limit);
|
|
1134
|
+
var ptr3 = ret[0];
|
|
1135
|
+
var len3 = ret[1];
|
|
1136
|
+
if (ret[3]) {
|
|
1137
|
+
ptr3 = 0;
|
|
1138
|
+
len3 = 0;
|
|
1139
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1140
|
+
}
|
|
1141
|
+
deferred4_0 = ptr3;
|
|
1142
|
+
deferred4_1 = len3;
|
|
1143
|
+
return getStringFromWasm0(ptr3, len3);
|
|
1144
|
+
} finally {
|
|
1145
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
function progressive_query(bytes, query2) {
|
|
1149
|
+
let deferred4_0;
|
|
1150
|
+
let deferred4_1;
|
|
1151
|
+
try {
|
|
1152
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1153
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1154
|
+
const ptr1 = passStringToWasm0(query2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1155
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1156
|
+
const ret = wasm.progressive_query(ptr0, len0, ptr1, len1);
|
|
1157
|
+
var ptr3 = ret[0];
|
|
1158
|
+
var len3 = ret[1];
|
|
1159
|
+
if (ret[3]) {
|
|
1160
|
+
ptr3 = 0;
|
|
1161
|
+
len3 = 0;
|
|
1162
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1163
|
+
}
|
|
1164
|
+
deferred4_0 = ptr3;
|
|
1165
|
+
deferred4_1 = len3;
|
|
1166
|
+
return getStringFromWasm0(ptr3, len3);
|
|
1167
|
+
} finally {
|
|
1168
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
function pyramid_tree(bytes) {
|
|
1172
|
+
let deferred3_0;
|
|
1173
|
+
let deferred3_1;
|
|
1174
|
+
try {
|
|
1175
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1176
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1177
|
+
const ret = wasm.pyramid_tree(ptr0, len0);
|
|
1178
|
+
var ptr2 = ret[0];
|
|
1179
|
+
var len2 = ret[1];
|
|
1180
|
+
if (ret[3]) {
|
|
1181
|
+
ptr2 = 0;
|
|
1182
|
+
len2 = 0;
|
|
1183
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1184
|
+
}
|
|
1185
|
+
deferred3_0 = ptr2;
|
|
1186
|
+
deferred3_1 = len2;
|
|
1187
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1188
|
+
} finally {
|
|
1189
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
function query(bytes, query2, format) {
|
|
1193
|
+
let deferred5_0;
|
|
1194
|
+
let deferred5_1;
|
|
1195
|
+
try {
|
|
1196
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1197
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1198
|
+
const ptr1 = passStringToWasm0(query2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1199
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1200
|
+
const ptr2 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1201
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1202
|
+
const ret = wasm.query(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1203
|
+
var ptr4 = ret[0];
|
|
1204
|
+
var len4 = ret[1];
|
|
1205
|
+
if (ret[3]) {
|
|
1206
|
+
ptr4 = 0;
|
|
1207
|
+
len4 = 0;
|
|
1208
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1209
|
+
}
|
|
1210
|
+
deferred5_0 = ptr4;
|
|
1211
|
+
deferred5_1 = len4;
|
|
1212
|
+
return getStringFromWasm0(ptr4, len4);
|
|
1213
|
+
} finally {
|
|
1214
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
function query_communities(bytes, query2, round) {
|
|
1218
|
+
let deferred4_0;
|
|
1219
|
+
let deferred4_1;
|
|
1220
|
+
try {
|
|
1221
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1222
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1223
|
+
const ptr1 = passStringToWasm0(query2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1224
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1225
|
+
const ret = wasm.query_communities(ptr0, len0, ptr1, len1, isLikeNone(round) ? Number.MAX_SAFE_INTEGER : round >>> 0);
|
|
1226
|
+
var ptr3 = ret[0];
|
|
1227
|
+
var len3 = ret[1];
|
|
1228
|
+
if (ret[3]) {
|
|
1229
|
+
ptr3 = 0;
|
|
1230
|
+
len3 = 0;
|
|
1231
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1232
|
+
}
|
|
1233
|
+
deferred4_0 = ptr3;
|
|
1234
|
+
deferred4_1 = len3;
|
|
1235
|
+
return getStringFromWasm0(ptr3, len3);
|
|
1236
|
+
} finally {
|
|
1237
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
function query_sparql(bytes, query2) {
|
|
1241
|
+
let deferred4_0;
|
|
1242
|
+
let deferred4_1;
|
|
1243
|
+
try {
|
|
1244
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1245
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1246
|
+
const ptr1 = passStringToWasm0(query2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1247
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1248
|
+
const ret = wasm.query_sparql(ptr0, len0, ptr1, len1);
|
|
1249
|
+
var ptr3 = ret[0];
|
|
1250
|
+
var len3 = ret[1];
|
|
1251
|
+
if (ret[3]) {
|
|
1252
|
+
ptr3 = 0;
|
|
1253
|
+
len3 = 0;
|
|
1254
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1255
|
+
}
|
|
1256
|
+
deferred4_0 = ptr3;
|
|
1257
|
+
deferred4_1 = len3;
|
|
1258
|
+
return getStringFromWasm0(ptr3, len3);
|
|
1259
|
+
} finally {
|
|
1260
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
function query_triples(bytes, subject, predicate, object) {
|
|
1264
|
+
let deferred6_0;
|
|
1265
|
+
let deferred6_1;
|
|
1266
|
+
try {
|
|
1267
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1268
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1269
|
+
var ptr1 = isLikeNone(subject) ? 0 : passStringToWasm0(subject, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1270
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1271
|
+
var ptr2 = isLikeNone(predicate) ? 0 : passStringToWasm0(predicate, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1272
|
+
var len2 = WASM_VECTOR_LEN;
|
|
1273
|
+
var ptr3 = isLikeNone(object) ? 0 : passStringToWasm0(object, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1274
|
+
var len3 = WASM_VECTOR_LEN;
|
|
1275
|
+
const ret = wasm.query_triples(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
1276
|
+
var ptr5 = ret[0];
|
|
1277
|
+
var len5 = ret[1];
|
|
1278
|
+
if (ret[3]) {
|
|
1279
|
+
ptr5 = 0;
|
|
1280
|
+
len5 = 0;
|
|
1281
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1282
|
+
}
|
|
1283
|
+
deferred6_0 = ptr5;
|
|
1284
|
+
deferred6_1 = len5;
|
|
1285
|
+
return getStringFromWasm0(ptr5, len5);
|
|
1286
|
+
} finally {
|
|
1287
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
function reach(bytes, predicate, seeds, reverse) {
|
|
1291
|
+
let deferred5_0;
|
|
1292
|
+
let deferred5_1;
|
|
1293
|
+
try {
|
|
1294
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1295
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1296
|
+
const ptr1 = passStringToWasm0(predicate, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1297
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1298
|
+
const ptr2 = passStringToWasm0(seeds, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1299
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1300
|
+
const ret = wasm.reach(ptr0, len0, ptr1, len1, ptr2, len2, reverse);
|
|
1301
|
+
var ptr4 = ret[0];
|
|
1302
|
+
var len4 = ret[1];
|
|
1303
|
+
if (ret[3]) {
|
|
1304
|
+
ptr4 = 0;
|
|
1305
|
+
len4 = 0;
|
|
1306
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1307
|
+
}
|
|
1308
|
+
deferred5_0 = ptr4;
|
|
1309
|
+
deferred5_1 = len4;
|
|
1310
|
+
return getStringFromWasm0(ptr4, len4);
|
|
1311
|
+
} finally {
|
|
1312
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
function reach_url(url, predicate, seeds, reverse) {
|
|
1316
|
+
let deferred5_0;
|
|
1317
|
+
let deferred5_1;
|
|
1318
|
+
try {
|
|
1319
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1320
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1321
|
+
const ptr1 = passStringToWasm0(predicate, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1322
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1323
|
+
const ptr2 = passStringToWasm0(seeds, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1324
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1325
|
+
const ret = wasm.reach_url(ptr0, len0, ptr1, len1, ptr2, len2, reverse);
|
|
1326
|
+
var ptr4 = ret[0];
|
|
1327
|
+
var len4 = ret[1];
|
|
1328
|
+
if (ret[3]) {
|
|
1329
|
+
ptr4 = 0;
|
|
1330
|
+
len4 = 0;
|
|
1331
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1332
|
+
}
|
|
1333
|
+
deferred5_0 = ptr4;
|
|
1334
|
+
deferred5_1 = len4;
|
|
1335
|
+
return getStringFromWasm0(ptr4, len4);
|
|
1336
|
+
} finally {
|
|
1337
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
function reason(bytes, graph) {
|
|
1341
|
+
let deferred4_0;
|
|
1342
|
+
let deferred4_1;
|
|
1343
|
+
try {
|
|
1344
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1345
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1346
|
+
var ptr1 = isLikeNone(graph) ? 0 : passStringToWasm0(graph, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1347
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1348
|
+
const ret = wasm.reason(ptr0, len0, ptr1, len1);
|
|
1349
|
+
var ptr3 = ret[0];
|
|
1350
|
+
var len3 = ret[1];
|
|
1351
|
+
if (ret[3]) {
|
|
1352
|
+
ptr3 = 0;
|
|
1353
|
+
len3 = 0;
|
|
1354
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1355
|
+
}
|
|
1356
|
+
deferred4_0 = ptr3;
|
|
1357
|
+
deferred4_1 = len3;
|
|
1358
|
+
return getStringFromWasm0(ptr3, len3);
|
|
1359
|
+
} finally {
|
|
1360
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
function reason_construct_url(url, construct) {
|
|
1364
|
+
let deferred4_0;
|
|
1365
|
+
let deferred4_1;
|
|
1366
|
+
try {
|
|
1367
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1368
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1369
|
+
const ptr1 = passStringToWasm0(construct, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1370
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1371
|
+
const ret = wasm.reason_construct_url(ptr0, len0, ptr1, len1);
|
|
1372
|
+
var ptr3 = ret[0];
|
|
1373
|
+
var len3 = ret[1];
|
|
1374
|
+
if (ret[3]) {
|
|
1375
|
+
ptr3 = 0;
|
|
1376
|
+
len3 = 0;
|
|
1377
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1378
|
+
}
|
|
1379
|
+
deferred4_0 = ptr3;
|
|
1380
|
+
deferred4_1 = len3;
|
|
1381
|
+
return getStringFromWasm0(ptr3, len3);
|
|
1382
|
+
} finally {
|
|
1383
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
function reason_url(url, graph) {
|
|
1387
|
+
let deferred4_0;
|
|
1388
|
+
let deferred4_1;
|
|
1389
|
+
try {
|
|
1390
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1391
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1392
|
+
var ptr1 = isLikeNone(graph) ? 0 : passStringToWasm0(graph, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1393
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1394
|
+
const ret = wasm.reason_url(ptr0, len0, ptr1, len1);
|
|
1395
|
+
var ptr3 = ret[0];
|
|
1396
|
+
var len3 = ret[1];
|
|
1397
|
+
if (ret[3]) {
|
|
1398
|
+
ptr3 = 0;
|
|
1399
|
+
len3 = 0;
|
|
1400
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1401
|
+
}
|
|
1402
|
+
deferred4_0 = ptr3;
|
|
1403
|
+
deferred4_1 = len3;
|
|
1404
|
+
return getStringFromWasm0(ptr3, len3);
|
|
1405
|
+
} finally {
|
|
1406
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
function schema(bytes) {
|
|
1410
|
+
let deferred3_0;
|
|
1411
|
+
let deferred3_1;
|
|
1412
|
+
try {
|
|
1413
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1414
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1415
|
+
const ret = wasm.schema(ptr0, len0);
|
|
1416
|
+
var ptr2 = ret[0];
|
|
1417
|
+
var len2 = ret[1];
|
|
1418
|
+
if (ret[3]) {
|
|
1419
|
+
ptr2 = 0;
|
|
1420
|
+
len2 = 0;
|
|
1421
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1422
|
+
}
|
|
1423
|
+
deferred3_0 = ptr2;
|
|
1424
|
+
deferred3_1 = len2;
|
|
1425
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1426
|
+
} finally {
|
|
1427
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
function schema_packed(bytes) {
|
|
1431
|
+
let deferred3_0;
|
|
1432
|
+
let deferred3_1;
|
|
1433
|
+
try {
|
|
1434
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1435
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1436
|
+
const ret = wasm.schema_packed(ptr0, len0);
|
|
1437
|
+
var ptr2 = ret[0];
|
|
1438
|
+
var len2 = ret[1];
|
|
1439
|
+
if (ret[3]) {
|
|
1440
|
+
ptr2 = 0;
|
|
1441
|
+
len2 = 0;
|
|
1442
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1443
|
+
}
|
|
1444
|
+
deferred3_0 = ptr2;
|
|
1445
|
+
deferred3_1 = len2;
|
|
1446
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1447
|
+
} finally {
|
|
1448
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
function schema_url(url) {
|
|
1452
|
+
let deferred3_0;
|
|
1453
|
+
let deferred3_1;
|
|
1454
|
+
try {
|
|
1455
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1456
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1457
|
+
const ret = wasm.schema_url(ptr0, len0);
|
|
1458
|
+
var ptr2 = ret[0];
|
|
1459
|
+
var len2 = ret[1];
|
|
1460
|
+
if (ret[3]) {
|
|
1461
|
+
ptr2 = 0;
|
|
1462
|
+
len2 = 0;
|
|
1463
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1464
|
+
}
|
|
1465
|
+
deferred3_0 = ptr2;
|
|
1466
|
+
deferred3_1 = len2;
|
|
1467
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1468
|
+
} finally {
|
|
1469
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
function shacl(bytes, shapes_turtle, graph, format) {
|
|
1473
|
+
let deferred6_0;
|
|
1474
|
+
let deferred6_1;
|
|
1475
|
+
try {
|
|
1476
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1477
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1478
|
+
const ptr1 = passStringToWasm0(shapes_turtle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1479
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1480
|
+
var ptr2 = isLikeNone(graph) ? 0 : passStringToWasm0(graph, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1481
|
+
var len2 = WASM_VECTOR_LEN;
|
|
1482
|
+
const ptr3 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1483
|
+
const len3 = WASM_VECTOR_LEN;
|
|
1484
|
+
const ret = wasm.shacl(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
1485
|
+
var ptr5 = ret[0];
|
|
1486
|
+
var len5 = ret[1];
|
|
1487
|
+
if (ret[3]) {
|
|
1488
|
+
ptr5 = 0;
|
|
1489
|
+
len5 = 0;
|
|
1490
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1491
|
+
}
|
|
1492
|
+
deferred6_0 = ptr5;
|
|
1493
|
+
deferred6_1 = len5;
|
|
1494
|
+
return getStringFromWasm0(ptr5, len5);
|
|
1495
|
+
} finally {
|
|
1496
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
function shacl_construct_url(url, construct, shapes_turtle, format) {
|
|
1500
|
+
let deferred6_0;
|
|
1501
|
+
let deferred6_1;
|
|
1502
|
+
try {
|
|
1503
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1504
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1505
|
+
const ptr1 = passStringToWasm0(construct, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1506
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1507
|
+
const ptr2 = passStringToWasm0(shapes_turtle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1508
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1509
|
+
const ptr3 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1510
|
+
const len3 = WASM_VECTOR_LEN;
|
|
1511
|
+
const ret = wasm.shacl_construct_url(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
1512
|
+
var ptr5 = ret[0];
|
|
1513
|
+
var len5 = ret[1];
|
|
1514
|
+
if (ret[3]) {
|
|
1515
|
+
ptr5 = 0;
|
|
1516
|
+
len5 = 0;
|
|
1517
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1518
|
+
}
|
|
1519
|
+
deferred6_0 = ptr5;
|
|
1520
|
+
deferred6_1 = len5;
|
|
1521
|
+
return getStringFromWasm0(ptr5, len5);
|
|
1522
|
+
} finally {
|
|
1523
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
function shacl_url(url, shapes_turtle, graph, format) {
|
|
1527
|
+
let deferred6_0;
|
|
1528
|
+
let deferred6_1;
|
|
1529
|
+
try {
|
|
1530
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1531
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1532
|
+
const ptr1 = passStringToWasm0(shapes_turtle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1533
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1534
|
+
var ptr2 = isLikeNone(graph) ? 0 : passStringToWasm0(graph, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1535
|
+
var len2 = WASM_VECTOR_LEN;
|
|
1536
|
+
const ptr3 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1537
|
+
const len3 = WASM_VECTOR_LEN;
|
|
1538
|
+
const ret = wasm.shacl_url(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
1539
|
+
var ptr5 = ret[0];
|
|
1540
|
+
var len5 = ret[1];
|
|
1541
|
+
if (ret[3]) {
|
|
1542
|
+
ptr5 = 0;
|
|
1543
|
+
len5 = 0;
|
|
1544
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1545
|
+
}
|
|
1546
|
+
deferred6_0 = ptr5;
|
|
1547
|
+
deferred6_1 = len5;
|
|
1548
|
+
return getStringFromWasm0(ptr5, len5);
|
|
1549
|
+
} finally {
|
|
1550
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
function sparql_url(url, query2, format) {
|
|
1554
|
+
let deferred5_0;
|
|
1555
|
+
let deferred5_1;
|
|
1556
|
+
try {
|
|
1557
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1558
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1559
|
+
const ptr1 = passStringToWasm0(query2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1560
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1561
|
+
const ptr2 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1562
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1563
|
+
const ret = wasm.sparql_url(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1564
|
+
var ptr4 = ret[0];
|
|
1565
|
+
var len4 = ret[1];
|
|
1566
|
+
if (ret[3]) {
|
|
1567
|
+
ptr4 = 0;
|
|
1568
|
+
len4 = 0;
|
|
1569
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1570
|
+
}
|
|
1571
|
+
deferred5_0 = ptr4;
|
|
1572
|
+
deferred5_1 = len4;
|
|
1573
|
+
return getStringFromWasm0(ptr4, len4);
|
|
1574
|
+
} finally {
|
|
1575
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
function summary_overview(bytes) {
|
|
1579
|
+
let deferred3_0;
|
|
1580
|
+
let deferred3_1;
|
|
1581
|
+
try {
|
|
1582
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1583
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1584
|
+
const ret = wasm.summary_overview(ptr0, len0);
|
|
1585
|
+
var ptr2 = ret[0];
|
|
1586
|
+
var len2 = ret[1];
|
|
1587
|
+
if (ret[3]) {
|
|
1588
|
+
ptr2 = 0;
|
|
1589
|
+
len2 = 0;
|
|
1590
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1591
|
+
}
|
|
1592
|
+
deferred3_0 = ptr2;
|
|
1593
|
+
deferred3_1 = len2;
|
|
1594
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1595
|
+
} finally {
|
|
1596
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
function text_search(bytes, words, contains_prefix, limit) {
|
|
1600
|
+
let deferred5_0;
|
|
1601
|
+
let deferred5_1;
|
|
1602
|
+
try {
|
|
1603
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1604
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1605
|
+
const ptr1 = passArrayJsValueToWasm0(words, wasm.__wbindgen_malloc);
|
|
1606
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1607
|
+
var ptr2 = isLikeNone(contains_prefix) ? 0 : passStringToWasm0(contains_prefix, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1608
|
+
var len2 = WASM_VECTOR_LEN;
|
|
1609
|
+
const ret = wasm.text_search(ptr0, len0, ptr1, len1, ptr2, len2, limit);
|
|
1610
|
+
var ptr4 = ret[0];
|
|
1611
|
+
var len4 = ret[1];
|
|
1612
|
+
if (ret[3]) {
|
|
1613
|
+
ptr4 = 0;
|
|
1614
|
+
len4 = 0;
|
|
1615
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1616
|
+
}
|
|
1617
|
+
deferred5_0 = ptr4;
|
|
1618
|
+
deferred5_1 = len4;
|
|
1619
|
+
return getStringFromWasm0(ptr4, len4);
|
|
1620
|
+
} finally {
|
|
1621
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
function why_triples(bytes, subject, predicate, object) {
|
|
1625
|
+
let deferred6_0;
|
|
1626
|
+
let deferred6_1;
|
|
1627
|
+
try {
|
|
1628
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1629
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1630
|
+
var ptr1 = isLikeNone(subject) ? 0 : passStringToWasm0(subject, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1631
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1632
|
+
var ptr2 = isLikeNone(predicate) ? 0 : passStringToWasm0(predicate, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1633
|
+
var len2 = WASM_VECTOR_LEN;
|
|
1634
|
+
var ptr3 = isLikeNone(object) ? 0 : passStringToWasm0(object, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1635
|
+
var len3 = WASM_VECTOR_LEN;
|
|
1636
|
+
const ret = wasm.why_triples(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
1637
|
+
var ptr5 = ret[0];
|
|
1638
|
+
var len5 = ret[1];
|
|
1639
|
+
if (ret[3]) {
|
|
1640
|
+
ptr5 = 0;
|
|
1641
|
+
len5 = 0;
|
|
1642
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1643
|
+
}
|
|
1644
|
+
deferred6_0 = ptr5;
|
|
1645
|
+
deferred6_1 = len5;
|
|
1646
|
+
return getStringFromWasm0(ptr5, len5);
|
|
1647
|
+
} finally {
|
|
1648
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
function why_url(url, subject, predicate, object) {
|
|
1652
|
+
let deferred6_0;
|
|
1653
|
+
let deferred6_1;
|
|
1654
|
+
try {
|
|
1655
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1656
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1657
|
+
var ptr1 = isLikeNone(subject) ? 0 : passStringToWasm0(subject, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1658
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1659
|
+
var ptr2 = isLikeNone(predicate) ? 0 : passStringToWasm0(predicate, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1660
|
+
var len2 = WASM_VECTOR_LEN;
|
|
1661
|
+
var ptr3 = isLikeNone(object) ? 0 : passStringToWasm0(object, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1662
|
+
var len3 = WASM_VECTOR_LEN;
|
|
1663
|
+
const ret = wasm.why_url(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
1664
|
+
var ptr5 = ret[0];
|
|
1665
|
+
var len5 = ret[1];
|
|
1666
|
+
if (ret[3]) {
|
|
1667
|
+
ptr5 = 0;
|
|
1668
|
+
len5 = 0;
|
|
1669
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1670
|
+
}
|
|
1671
|
+
deferred6_0 = ptr5;
|
|
1672
|
+
deferred6_1 = len5;
|
|
1673
|
+
return getStringFromWasm0(ptr5, len5);
|
|
1674
|
+
} finally {
|
|
1675
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
723
1678
|
function __wbg_get_imports() {
|
|
724
1679
|
const import0 = {
|
|
725
1680
|
__proto__: null,
|
|
@@ -1176,6 +2131,22 @@ async function __wbg_load(module2, imports) {
|
|
|
1176
2131
|
return false;
|
|
1177
2132
|
}
|
|
1178
2133
|
}
|
|
2134
|
+
function initSync(module2) {
|
|
2135
|
+
if (wasm !== void 0) return wasm;
|
|
2136
|
+
if (module2 !== void 0) {
|
|
2137
|
+
if (Object.getPrototypeOf(module2) === Object.prototype) {
|
|
2138
|
+
({ module: module2 } = module2);
|
|
2139
|
+
} else {
|
|
2140
|
+
console.warn("using deprecated parameters for `initSync()`; pass a single object instead");
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
const imports = __wbg_get_imports();
|
|
2144
|
+
if (!(module2 instanceof WebAssembly.Module)) {
|
|
2145
|
+
module2 = new WebAssembly.Module(module2);
|
|
2146
|
+
}
|
|
2147
|
+
const instance = new WebAssembly.Instance(module2, imports);
|
|
2148
|
+
return __wbg_finalize_init(instance, module2);
|
|
2149
|
+
}
|
|
1179
2150
|
async function __wbg_init(module_or_path) {
|
|
1180
2151
|
if (wasm !== void 0) return wasm;
|
|
1181
2152
|
if (module_or_path !== void 0) {
|
|
@@ -1196,6 +2167,257 @@ async function __wbg_init(module_or_path) {
|
|
|
1196
2167
|
return __wbg_finalize_init(instance, module2);
|
|
1197
2168
|
}
|
|
1198
2169
|
|
|
2170
|
+
// src/comunica.js
|
|
2171
|
+
var BaseTerm = class {
|
|
2172
|
+
equals(other) {
|
|
2173
|
+
return !!other && other.termType === this.termType && other.value === this.value && (this.termType !== "Literal" || other.language === this.language && other.datatype.value === this.datatype.value);
|
|
2174
|
+
}
|
|
2175
|
+
};
|
|
2176
|
+
var NamedNode = class extends BaseTerm {
|
|
2177
|
+
constructor(value) {
|
|
2178
|
+
super();
|
|
2179
|
+
this.termType = "NamedNode";
|
|
2180
|
+
this.value = value;
|
|
2181
|
+
}
|
|
2182
|
+
};
|
|
2183
|
+
var BlankNode = class extends BaseTerm {
|
|
2184
|
+
constructor(label) {
|
|
2185
|
+
super();
|
|
2186
|
+
this.termType = "BlankNode";
|
|
2187
|
+
this.value = label;
|
|
2188
|
+
}
|
|
2189
|
+
};
|
|
2190
|
+
var Literal = class extends BaseTerm {
|
|
2191
|
+
constructor(value, languageOrDatatype) {
|
|
2192
|
+
super();
|
|
2193
|
+
this.termType = "Literal";
|
|
2194
|
+
this.value = value;
|
|
2195
|
+
if (typeof languageOrDatatype === "string") {
|
|
2196
|
+
this.language = languageOrDatatype;
|
|
2197
|
+
this.datatype = new NamedNode(
|
|
2198
|
+
"http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"
|
|
2199
|
+
);
|
|
2200
|
+
} else {
|
|
2201
|
+
this.language = "";
|
|
2202
|
+
this.datatype = languageOrDatatype ?? new NamedNode("http://www.w3.org/2001/XMLSchema#string");
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
};
|
|
2206
|
+
var DefaultGraph = class extends BaseTerm {
|
|
2207
|
+
constructor() {
|
|
2208
|
+
super();
|
|
2209
|
+
this.termType = "DefaultGraph";
|
|
2210
|
+
this.value = "";
|
|
2211
|
+
}
|
|
2212
|
+
};
|
|
2213
|
+
var Quad = class {
|
|
2214
|
+
constructor(subject, predicate, object, graph) {
|
|
2215
|
+
this.termType = "Quad";
|
|
2216
|
+
this.value = "";
|
|
2217
|
+
this.subject = subject;
|
|
2218
|
+
this.predicate = predicate;
|
|
2219
|
+
this.object = object;
|
|
2220
|
+
this.graph = graph ?? new DefaultGraph();
|
|
2221
|
+
}
|
|
2222
|
+
equals(other) {
|
|
2223
|
+
return !!other && other.termType === "Quad" && this.subject.equals(other.subject) && this.predicate.equals(other.predicate) && this.object.equals(other.object) && this.graph.equals(other.graph);
|
|
2224
|
+
}
|
|
2225
|
+
};
|
|
2226
|
+
function toRdfjs(t) {
|
|
2227
|
+
const term = t instanceof Term ? t : Term.parse(t);
|
|
2228
|
+
switch (term.kind) {
|
|
2229
|
+
case "iri":
|
|
2230
|
+
return new NamedNode(term.value);
|
|
2231
|
+
case "bnode":
|
|
2232
|
+
return new BlankNode(term.value.replace(/^_:/, ""));
|
|
2233
|
+
case "triple": {
|
|
2234
|
+
const [s, p, o] = splitQuoted(term.value);
|
|
2235
|
+
return new Quad(toRdfjs(s), toRdfjs(p), toRdfjs(o));
|
|
2236
|
+
}
|
|
2237
|
+
default:
|
|
2238
|
+
if (term.lang) return new Literal(term.value, term.lang);
|
|
2239
|
+
if (term.datatype) return new Literal(term.value, new NamedNode(term.datatype));
|
|
2240
|
+
return new Literal(term.value);
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2243
|
+
function splitQuoted(token) {
|
|
2244
|
+
const inner = token.slice(2, -2).trim();
|
|
2245
|
+
const parts = [];
|
|
2246
|
+
let depth = 0, inString = false, start = 0;
|
|
2247
|
+
for (let i = 0; i < inner.length; i += 1) {
|
|
2248
|
+
const c = inner[i];
|
|
2249
|
+
if (inString) {
|
|
2250
|
+
if (c === "\\") i += 1;
|
|
2251
|
+
else if (c === '"') inString = false;
|
|
2252
|
+
continue;
|
|
2253
|
+
}
|
|
2254
|
+
if (c === '"') inString = true;
|
|
2255
|
+
else if (inner.startsWith("<<", i)) {
|
|
2256
|
+
depth += 1;
|
|
2257
|
+
i += 1;
|
|
2258
|
+
} else if (inner.startsWith(">>", i)) {
|
|
2259
|
+
depth -= 1;
|
|
2260
|
+
i += 1;
|
|
2261
|
+
} else if (c === " " && depth === 0) {
|
|
2262
|
+
if (i > start) parts.push(inner.slice(start, i));
|
|
2263
|
+
start = i + 1;
|
|
2264
|
+
if (parts.length === 2) {
|
|
2265
|
+
parts.push(inner.slice(start));
|
|
2266
|
+
break;
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
if (parts.length < 3) parts.push(inner.slice(start));
|
|
2271
|
+
return parts.map((p) => p.trim()).filter(Boolean);
|
|
2272
|
+
}
|
|
2273
|
+
var XSD_STRING = "http://www.w3.org/2001/XMLSchema#string";
|
|
2274
|
+
function toN3(term) {
|
|
2275
|
+
switch (term.termType) {
|
|
2276
|
+
case "NamedNode":
|
|
2277
|
+
return `<${term.value}>`;
|
|
2278
|
+
case "Literal": {
|
|
2279
|
+
const dt = term.language || !term.datatype || term.datatype.value === XSD_STRING ? null : term.datatype.value;
|
|
2280
|
+
return new Term("literal", term.value, dt, term.language || null).n3;
|
|
2281
|
+
}
|
|
2282
|
+
case "Quad":
|
|
2283
|
+
return `<< ${toN3(term.subject)} ${toN3(term.predicate)} ${toN3(term.object)} >>`;
|
|
2284
|
+
default:
|
|
2285
|
+
throw new TypeError(`cannot serialize ${term.termType} into a pattern`);
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
var isVarish = (t) => t == null || t.termType === "Variable";
|
|
2289
|
+
var QuadStream = class {
|
|
2290
|
+
#quads;
|
|
2291
|
+
#i = 0;
|
|
2292
|
+
#handlers = { readable: [], end: [], error: [], data: [] };
|
|
2293
|
+
#error;
|
|
2294
|
+
constructor(quads, error = null) {
|
|
2295
|
+
this.#quads = quads;
|
|
2296
|
+
this.#error = error;
|
|
2297
|
+
queueMicrotask(() => {
|
|
2298
|
+
if (this.#error) return this.#emit("error", this.#error);
|
|
2299
|
+
this.#emit("readable");
|
|
2300
|
+
if (this.#i >= this.#quads.length) this.#emit("end");
|
|
2301
|
+
});
|
|
2302
|
+
}
|
|
2303
|
+
read() {
|
|
2304
|
+
if (this.#i < this.#quads.length) {
|
|
2305
|
+
const q = this.#quads[this.#i];
|
|
2306
|
+
this.#i += 1;
|
|
2307
|
+
if (this.#i >= this.#quads.length) queueMicrotask(() => this.#emit("end"));
|
|
2308
|
+
return q;
|
|
2309
|
+
}
|
|
2310
|
+
return null;
|
|
2311
|
+
}
|
|
2312
|
+
on(event, handler) {
|
|
2313
|
+
(this.#handlers[event] ??= []).push(handler);
|
|
2314
|
+
return this;
|
|
2315
|
+
}
|
|
2316
|
+
once(event, handler) {
|
|
2317
|
+
const stream = this;
|
|
2318
|
+
const wrap = function(...a) {
|
|
2319
|
+
stream.removeListener(event, wrap);
|
|
2320
|
+
handler.call(this, ...a);
|
|
2321
|
+
};
|
|
2322
|
+
return this.on(event, wrap);
|
|
2323
|
+
}
|
|
2324
|
+
addListener(event, handler) {
|
|
2325
|
+
return this.on(event, handler);
|
|
2326
|
+
}
|
|
2327
|
+
removeListener(event, handler) {
|
|
2328
|
+
const list = this.#handlers[event] ?? [];
|
|
2329
|
+
const at = list.indexOf(handler);
|
|
2330
|
+
if (at >= 0) list.splice(at, 1);
|
|
2331
|
+
return this;
|
|
2332
|
+
}
|
|
2333
|
+
emit() {
|
|
2334
|
+
return false;
|
|
2335
|
+
}
|
|
2336
|
+
// external emits are ignored
|
|
2337
|
+
destroy() {
|
|
2338
|
+
this.#i = this.#quads.length;
|
|
2339
|
+
return this;
|
|
2340
|
+
}
|
|
2341
|
+
#emit(event, ...args) {
|
|
2342
|
+
for (const h of [...this.#handlers[event] ?? []]) h.call(this, ...args);
|
|
2343
|
+
}
|
|
2344
|
+
};
|
|
2345
|
+
var ReteSource = class {
|
|
2346
|
+
/** @param {import("./index.js").Graph} graph */
|
|
2347
|
+
constructor(graph) {
|
|
2348
|
+
this.graph = graph;
|
|
2349
|
+
}
|
|
2350
|
+
/** All quads matching the pattern, as an RDF/JS quad stream. */
|
|
2351
|
+
match(subject, predicate, object, graph) {
|
|
2352
|
+
try {
|
|
2353
|
+
return new QuadStream(this.#matchArray(subject, predicate, object, graph));
|
|
2354
|
+
} catch (error) {
|
|
2355
|
+
return new QuadStream([], error);
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
/** Number of matching quads (used by query planners for join ordering). */
|
|
2359
|
+
countQuads(subject, predicate, object, graph) {
|
|
2360
|
+
return this.#matchArray(subject, predicate, object, graph).length;
|
|
2361
|
+
}
|
|
2362
|
+
#matchArray(subject, predicate, object, graph) {
|
|
2363
|
+
const wantBnode = (term) => term != null && term.termType === "BlankNode" ? `_:${term.value}` : null;
|
|
2364
|
+
const wantS = wantBnode(subject), wantO = wantBnode(object);
|
|
2365
|
+
const free = {
|
|
2366
|
+
s: isVarish(subject) || subject.termType === "BlankNode",
|
|
2367
|
+
p: isVarish(predicate),
|
|
2368
|
+
o: isVarish(object) || object.termType === "BlankNode"
|
|
2369
|
+
};
|
|
2370
|
+
const pattern = [
|
|
2371
|
+
free.s ? "?s" : toN3(subject),
|
|
2372
|
+
free.p ? "?p" : toN3(predicate),
|
|
2373
|
+
free.o ? "?o" : toN3(object)
|
|
2374
|
+
].join(" ");
|
|
2375
|
+
const fullyBound = !free.s && !free.p && !free.o;
|
|
2376
|
+
const rows = [];
|
|
2377
|
+
const defaultGraph = new DefaultGraph();
|
|
2378
|
+
const runDefault = () => {
|
|
2379
|
+
if (fullyBound) {
|
|
2380
|
+
if (this.graph.query(`ASK { ${pattern} }`)) rows.push({ row: {}, graphTerm: defaultGraph });
|
|
2381
|
+
return;
|
|
2382
|
+
}
|
|
2383
|
+
for (const row of this.graph.query(`SELECT * WHERE { ${pattern} }`)) {
|
|
2384
|
+
rows.push({ row, graphTerm: defaultGraph });
|
|
2385
|
+
}
|
|
2386
|
+
};
|
|
2387
|
+
const runNamed = (g) => {
|
|
2388
|
+
if (g && fullyBound) {
|
|
2389
|
+
if (this.graph.query(`ASK { GRAPH <${g.value}> { ${pattern} } }`))
|
|
2390
|
+
rows.push({ row: {}, graphTerm: g });
|
|
2391
|
+
return;
|
|
2392
|
+
}
|
|
2393
|
+
const clause = g ? `GRAPH <${g.value}>` : "GRAPH ?g";
|
|
2394
|
+
for (const row of this.graph.query(`SELECT * WHERE { ${clause} { ${pattern} } }`)) {
|
|
2395
|
+
rows.push({ row, graphTerm: g ?? toRdfjs(row.g) });
|
|
2396
|
+
}
|
|
2397
|
+
};
|
|
2398
|
+
if (graph == null || graph.termType === "Variable") {
|
|
2399
|
+
runDefault();
|
|
2400
|
+
runNamed(null);
|
|
2401
|
+
} else if (graph.termType === "DefaultGraph") {
|
|
2402
|
+
runDefault();
|
|
2403
|
+
} else if (graph.termType === "NamedNode") {
|
|
2404
|
+
runNamed(graph);
|
|
2405
|
+
} else {
|
|
2406
|
+
throw new TypeError(`cannot match graph term ${graph.termType}`);
|
|
2407
|
+
}
|
|
2408
|
+
const out = [];
|
|
2409
|
+
for (const { row, graphTerm } of rows) {
|
|
2410
|
+
const s = row.s ? toRdfjs(row.s) : subject;
|
|
2411
|
+
const p = row.p ? toRdfjs(row.p) : predicate;
|
|
2412
|
+
const o = row.o ? toRdfjs(row.o) : object;
|
|
2413
|
+
if (wantS && (s.termType !== "BlankNode" || `_:${s.value}` !== wantS)) continue;
|
|
2414
|
+
if (wantO && (o.termType !== "BlankNode" || `_:${o.value}` !== wantO)) continue;
|
|
2415
|
+
out.push(new Quad(s, p, o, graphTerm));
|
|
2416
|
+
}
|
|
2417
|
+
return out;
|
|
2418
|
+
}
|
|
2419
|
+
};
|
|
2420
|
+
|
|
1199
2421
|
// src/index.js
|
|
1200
2422
|
var XSD = "http://www.w3.org/2001/XMLSchema#";
|
|
1201
2423
|
var INT_TYPES = new Set(
|
|
@@ -1333,8 +2555,8 @@ var Graph2 = class {
|
|
|
1333
2555
|
this.#remote = remote;
|
|
1334
2556
|
}
|
|
1335
2557
|
/** The engine's raw JSON result envelope. */
|
|
1336
|
-
queryRaw(
|
|
1337
|
-
const s =
|
|
2558
|
+
queryRaw(query2, { reason: reason2 = false } = {}) {
|
|
2559
|
+
const s = reason2 ? this.#g.query_reasoned(query2, "json") : this.#g.query(query2, "json");
|
|
1338
2560
|
return JSON.parse(s);
|
|
1339
2561
|
}
|
|
1340
2562
|
/**
|
|
@@ -1342,8 +2564,8 @@ var Graph2 = class {
|
|
|
1342
2564
|
* CONSTRUCT/DESCRIBE → array of `[s, p, o]` Term triples.
|
|
1343
2565
|
* `reason: true` turns on OWL 2 QL entailment by query rewriting.
|
|
1344
2566
|
*/
|
|
1345
|
-
query(
|
|
1346
|
-
const env = this.queryRaw(
|
|
2567
|
+
query(query2, opts = {}) {
|
|
2568
|
+
const env = this.queryRaw(query2, opts);
|
|
1347
2569
|
switch (env.kind) {
|
|
1348
2570
|
case "select":
|
|
1349
2571
|
return env.rows.map(
|
|
@@ -1382,6 +2604,37 @@ var Graph2 = class {
|
|
|
1382
2604
|
info() {
|
|
1383
2605
|
return JSON.parse(this.#g.info?.() ?? "{}");
|
|
1384
2606
|
}
|
|
2607
|
+
/**
|
|
2608
|
+
* The embedded Dataset Card — the file's own self-description (title,
|
|
2609
|
+
* description, license, provenance, counts, example queries) — or `null`
|
|
2610
|
+
* when the file carries none. On a remote graph this is the index-free CARD
|
|
2611
|
+
* tier: the metadata section's byte range, nothing else.
|
|
2612
|
+
*/
|
|
2613
|
+
card() {
|
|
2614
|
+
const s = this.#g.card();
|
|
2615
|
+
return s ? JSON.parse(s) : null;
|
|
2616
|
+
}
|
|
2617
|
+
/**
|
|
2618
|
+
* The example SPARQL queries the file ships with. Rich entries carry
|
|
2619
|
+
* `title`/`question`/`dimension`/`tier` alongside `sparql`; run one with
|
|
2620
|
+
* `g.query(g.examples()[0].sparql)`. Empty when the file has no card.
|
|
2621
|
+
*/
|
|
2622
|
+
examples() {
|
|
2623
|
+
const card2 = this.card() ?? {};
|
|
2624
|
+
return [
|
|
2625
|
+
...(card2.queries ?? []).map((q) => ({ ...q })),
|
|
2626
|
+
...(card2.example_queries ?? []).map((sparql) => ({ sparql }))
|
|
2627
|
+
];
|
|
2628
|
+
}
|
|
2629
|
+
/**
|
|
2630
|
+
* Validate SHACL Core shapes (Turtle) against the graph. Returns the
|
|
2631
|
+
* report as `"json"` (default) or `"text"`. Over a remote graph the default
|
|
2632
|
+
* graph validates lazily — only the shapes' target nodes are fetched.
|
|
2633
|
+
*/
|
|
2634
|
+
shacl(shapesTurtle, { graph = null, format = "json" } = {}) {
|
|
2635
|
+
const out = this.#g.shacl(shapesTurtle, graph ?? void 0, format);
|
|
2636
|
+
return format === "json" ? JSON.parse(out) : out;
|
|
2637
|
+
}
|
|
1385
2638
|
get quads() {
|
|
1386
2639
|
return this.info().quads;
|
|
1387
2640
|
}
|
|
@@ -1403,9 +2656,14 @@ async function open(source, { headers } = {}) {
|
|
|
1403
2656
|
if (headers) {
|
|
1404
2657
|
throw new Error("custom headers are not supported by the JS client yet");
|
|
1405
2658
|
}
|
|
1406
|
-
if (typeof source === "string" && /^https
|
|
1407
|
-
|
|
1408
|
-
|
|
2659
|
+
if (typeof source === "string" && /^(https?|file):\/\//.test(source)) {
|
|
2660
|
+
const isFile = source.startsWith("file:");
|
|
2661
|
+
const node = typeof process !== "undefined" && !!process.versions?.node;
|
|
2662
|
+
if (isFile && !node) {
|
|
2663
|
+
throw new Error("file:// .rete opens are Node-only; pass bytes in the browser");
|
|
2664
|
+
}
|
|
2665
|
+
if (typeof XMLHttpRequest === "undefined" || isFile) {
|
|
2666
|
+
if (node) {
|
|
1409
2667
|
const { install: install2 } = await Promise.resolve().then(() => (init_node_sync_xhr(), node_sync_xhr_exports));
|
|
1410
2668
|
install2();
|
|
1411
2669
|
} else {
|
|
@@ -1428,9 +2686,11 @@ async function build2(text, format = "nt") {
|
|
|
1428
2686
|
}
|
|
1429
2687
|
export {
|
|
1430
2688
|
Graph2 as Graph,
|
|
2689
|
+
ReteSource,
|
|
1431
2690
|
Term,
|
|
1432
2691
|
__setWasmSource,
|
|
1433
2692
|
build2 as build,
|
|
1434
2693
|
init,
|
|
1435
|
-
open
|
|
2694
|
+
open,
|
|
2695
|
+
rete_wasm_exports as wasm
|
|
1436
2696
|
};
|