@cooljapan/oxirs 0.2.4 → 0.3.1

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/oxirs_wasm.d.ts CHANGED
@@ -31,6 +31,19 @@ export class OxiRSStore {
31
31
  * Delete a single triple, returning true if it was found
32
32
  */
33
33
  delete(subject: string, predicate: string, object: string): boolean;
34
+ /**
35
+ * Apply RDFS forward-chaining entailment rules and materialise inferred triples.
36
+ *
37
+ * Returns a JS object `{ added: number }` describing how many new triples
38
+ * were derived. Calling this multiple times is idempotent — subsequent
39
+ * calls return 0 once the fixed-point has been reached.
40
+ *
41
+ * Rules implemented: rdfs:subClassOf transitivity (rdfs11), rdf:type
42
+ * propagation via rdfs:subClassOf (rdfs9), rdfs:subPropertyOf transitivity
43
+ * (rdfs5), rdfs:subPropertyOf usage propagation (rdfs7), rdfs:domain
44
+ * subject-typing (rdfs2), rdfs:range object-typing (rdfs3).
45
+ */
46
+ inferRdfs(): any;
34
47
  /**
35
48
  * Insert a single triple
36
49
  */
package/oxirs_wasm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /* @ts-self-types="./oxirs_wasm.d.ts" */
2
-
3
2
  import * as wasm from "./oxirs_wasm_bg.wasm";
4
3
  import { __wbg_set_wasm } from "./oxirs_wasm_bg.js";
4
+
5
5
  __wbg_set_wasm(wasm);
6
6
  wasm.__wbindgen_start();
7
7
  export {
package/oxirs_wasm_bg.js CHANGED
@@ -111,6 +111,34 @@ export class OxiRSStore {
111
111
  const ret = wasm.oxirsstore_delete(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
112
112
  return ret !== 0;
113
113
  }
114
+ /**
115
+ * Apply RDFS forward-chaining entailment rules and materialise inferred triples.
116
+ *
117
+ * Returns a JS object `{ added: number }` describing how many new triples
118
+ * were derived. Calling this multiple times is idempotent — subsequent
119
+ * calls return 0 once the fixed-point has been reached.
120
+ *
121
+ * Rules implemented: rdfs:subClassOf transitivity (rdfs11), rdf:type
122
+ * propagation via rdfs:subClassOf (rdfs9), rdfs:subPropertyOf transitivity
123
+ * (rdfs5), rdfs:subPropertyOf usage propagation (rdfs7), rdfs:domain
124
+ * subject-typing (rdfs2), rdfs:range object-typing (rdfs3).
125
+ * @returns {any}
126
+ */
127
+ inferRdfs() {
128
+ try {
129
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
130
+ wasm.oxirsstore_inferRdfs(retptr, this.__wbg_ptr);
131
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
132
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
133
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
134
+ if (r2) {
135
+ throw takeObject(r1);
136
+ }
137
+ return takeObject(r0);
138
+ } finally {
139
+ wasm.__wbindgen_add_to_stack_pointer(16);
140
+ }
141
+ }
114
142
  /**
115
143
  * Insert a single triple
116
144
  * @param {string} subject
@@ -177,7 +205,7 @@ export class OxiRSStore {
177
205
  */
178
206
  constructor() {
179
207
  const ret = wasm.oxirsstore_new();
180
- this.__wbg_ptr = ret >>> 0;
208
+ this.__wbg_ptr = ret;
181
209
  OxiRSStoreFinalization.register(this, this.__wbg_ptr, this);
182
210
  return this;
183
211
  }
@@ -350,7 +378,6 @@ if (Symbol.dispose) QueryResult.prototype[Symbol.dispose] = QueryResult.prototyp
350
378
  */
351
379
  export class Triple {
352
380
  static __wrap(ptr) {
353
- ptr = ptr >>> 0;
354
381
  const obj = Object.create(Triple.prototype);
355
382
  obj.__wbg_ptr = ptr;
356
383
  TripleFinalization.register(obj, obj.__wbg_ptr, obj);
@@ -379,7 +406,7 @@ export class Triple {
379
406
  const ptr2 = passStringToWasm0(object, wasm.__wbindgen_export3, wasm.__wbindgen_export4);
380
407
  const len2 = WASM_VECTOR_LEN;
381
408
  const ret = wasm.triple_new(ptr0, len0, ptr1, len1, ptr2, len2);
382
- this.__wbg_ptr = ret >>> 0;
409
+ this.__wbg_ptr = ret;
383
410
  TripleFinalization.register(this, this.__wbg_ptr, this);
384
411
  return this;
385
412
  }
@@ -477,7 +504,7 @@ export function version() {
477
504
  wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
478
505
  }
479
506
  }
480
- export function __wbg___wbindgen_throw_5549492daedad139(arg0, arg1) {
507
+ export function __wbg___wbindgen_throw_1506f2235d1bdba0(arg0, arg1) {
481
508
  throw new Error(getStringFromWasm0(arg0, arg1));
482
509
  }
483
510
  export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
@@ -491,26 +518,26 @@ export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
491
518
  wasm.__wbindgen_export(deferred0_0, deferred0_1, 1);
492
519
  }
493
520
  }
494
- export function __wbg_log_6a75b71d6316e935(arg0) {
521
+ export function __wbg_log_cf2e968649f3384e(arg0) {
495
522
  console.log(getObject(arg0));
496
523
  }
497
524
  export function __wbg_new_227d7c05414eb861() {
498
525
  const ret = new Error();
499
526
  return addHeapObject(ret);
500
527
  }
501
- export function __wbg_new_4370be21fa2b2f80() {
502
- const ret = new Array();
528
+ export function __wbg_new_ce1ab61c1c2b300d() {
529
+ const ret = new Object();
503
530
  return addHeapObject(ret);
504
531
  }
505
- export function __wbg_new_48e1d86cfd30c8e7() {
506
- const ret = new Object();
532
+ export function __wbg_new_d90091b82fdf5b91() {
533
+ const ret = new Array();
507
534
  return addHeapObject(ret);
508
535
  }
509
- export function __wbg_push_d0006a37f9fcda6d(arg0, arg1) {
536
+ export function __wbg_push_a6822215aa43e71c(arg0, arg1) {
510
537
  const ret = getObject(arg0).push(getObject(arg1));
511
538
  return ret;
512
539
  }
513
- export function __wbg_set_991082a7a49971cf() { return handleError(function (arg0, arg1, arg2) {
540
+ export function __wbg_set_6e30c9374c26414c() { return handleError(function (arg0, arg1, arg2) {
514
541
  const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
515
542
  return ret;
516
543
  }, arguments); }
@@ -525,7 +552,12 @@ export function __wbg_triple_new(arg0) {
525
552
  const ret = Triple.__wrap(arg0);
526
553
  return addHeapObject(ret);
527
554
  }
528
- export function __wbindgen_cast_0000000000000001(arg0, arg1) {
555
+ export function __wbindgen_cast_0000000000000001(arg0) {
556
+ // Cast intrinsic for `F64 -> Externref`.
557
+ const ret = arg0;
558
+ return addHeapObject(ret);
559
+ }
560
+ export function __wbindgen_cast_0000000000000002(arg0, arg1) {
529
561
  // Cast intrinsic for `Ref(String) -> Externref`.
530
562
  const ret = getStringFromWasm0(arg0, arg1);
531
563
  return addHeapObject(ret);
@@ -539,13 +571,13 @@ export function __wbindgen_object_drop_ref(arg0) {
539
571
  }
540
572
  const OxiRSStoreFinalization = (typeof FinalizationRegistry === 'undefined')
541
573
  ? { register: () => {}, unregister: () => {} }
542
- : new FinalizationRegistry(ptr => wasm.__wbg_oxirsstore_free(ptr >>> 0, 1));
574
+ : new FinalizationRegistry(ptr => wasm.__wbg_oxirsstore_free(ptr, 1));
543
575
  const QueryResultFinalization = (typeof FinalizationRegistry === 'undefined')
544
576
  ? { register: () => {}, unregister: () => {} }
545
- : new FinalizationRegistry(ptr => wasm.__wbg_queryresult_free(ptr >>> 0, 1));
577
+ : new FinalizationRegistry(ptr => wasm.__wbg_queryresult_free(ptr, 1));
546
578
  const TripleFinalization = (typeof FinalizationRegistry === 'undefined')
547
579
  ? { register: () => {}, unregister: () => {} }
548
- : new FinalizationRegistry(ptr => wasm.__wbg_triple_free(ptr >>> 0, 1));
580
+ : new FinalizationRegistry(ptr => wasm.__wbg_triple_free(ptr, 1));
549
581
 
550
582
  function addHeapObject(obj) {
551
583
  if (heap_next === heap.length) heap.push(heap.length + 1);
@@ -581,8 +613,7 @@ function getDataViewMemory0() {
581
613
  }
582
614
 
583
615
  function getStringFromWasm0(ptr, len) {
584
- ptr = ptr >>> 0;
585
- return decodeText(ptr, len);
616
+ return decodeText(ptr >>> 0, len);
586
617
  }
587
618
 
588
619
  let cachedUint8ArrayMemory0 = null;
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "KitaSan <info@kitasan.io>"
6
6
  ],
7
7
  "description": "WebAssembly bindings for OxiRS - Run RDF/SPARQL in the browser",
8
- "version": "0.2.4",
8
+ "version": "0.3.1",
9
9
  "license": "Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",