@blackcatinformatics/purrdf 0.2.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 CHANGED
@@ -33,6 +33,10 @@ npm install @blackcatinformatics/purrdf
33
33
 
34
34
  Runs in Node ≥ 18 and modern browsers (ESM, `web`-target wasm-bindgen).
35
35
 
36
+ The wasm artifact is built with WebAssembly SIMD (`+simd128`) for higher parse
37
+ throughput, so it requires a runtime with wasm SIMD support: every major browser
38
+ since ~2021 (Chrome/Edge 91+, Firefox 89+, Safari 16.4+) and Node ≥ 18.
39
+
36
40
  ## Quickstart
37
41
 
38
42
  ```js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blackcatinformatics/purrdf",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "A wasm32, in-memory RDF 1.2 engine with an idiomatic RDF/JS (DataFactory/Dataset/Stream) API. Quoted-triple terms and directional literals included.",
5
5
  "type": "module",
6
6
  "license": "MIT OR Apache-2.0",
@@ -237,6 +237,14 @@ export class Term {
237
237
  readonly value: string;
238
238
  }
239
239
 
240
+ /**
241
+ * `shaclValidateToSarif(shapesTtl, dataNt)` → a SARIF 2.1.0 JSON string.
242
+ *
243
+ * `shapesTtl` is a Turtle shapes graph; `dataNt` is an N-Triples data graph.
244
+ * Throws (rejects) if either graph fails to parse.
245
+ */
246
+ export function shaclValidateToSarif(shapes_ttl: string, data_nt: string): string;
247
+
240
248
  /**
241
249
  * The purrdf engine version (the crate's SemVer), exposed to JS as `version()`.
242
250
  *
@@ -284,6 +292,7 @@ export interface InitOutput {
284
292
  readonly quad_subject: (a: number) => number;
285
293
  readonly quad_term_type: (a: number, b: number) => void;
286
294
  readonly quad_value: (a: number, b: number) => void;
295
+ readonly shaclValidateToSarif: (a: number, b: number, c: number, d: number, e: number) => void;
287
296
  readonly sink_finish: (a: number, b: number) => void;
288
297
  readonly sink_new: () => number;
289
298
  readonly sink_push: (a: number, b: number, c: number) => void;
@@ -840,6 +840,44 @@ export class Term {
840
840
  }
841
841
  if (Symbol.dispose) Term.prototype[Symbol.dispose] = Term.prototype.free;
842
842
 
843
+ /**
844
+ * `shaclValidateToSarif(shapesTtl, dataNt)` → a SARIF 2.1.0 JSON string.
845
+ *
846
+ * `shapesTtl` is a Turtle shapes graph; `dataNt` is an N-Triples data graph.
847
+ * Throws (rejects) if either graph fails to parse.
848
+ * @param {string} shapes_ttl
849
+ * @param {string} data_nt
850
+ * @returns {string}
851
+ */
852
+ export function shaclValidateToSarif(shapes_ttl, data_nt) {
853
+ let deferred4_0;
854
+ let deferred4_1;
855
+ try {
856
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
857
+ const ptr0 = passStringToWasm0(shapes_ttl, wasm.__wbindgen_export, wasm.__wbindgen_export2);
858
+ const len0 = WASM_VECTOR_LEN;
859
+ const ptr1 = passStringToWasm0(data_nt, wasm.__wbindgen_export, wasm.__wbindgen_export2);
860
+ const len1 = WASM_VECTOR_LEN;
861
+ wasm.shaclValidateToSarif(retptr, ptr0, len0, ptr1, len1);
862
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
863
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
864
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
865
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
866
+ var ptr3 = r0;
867
+ var len3 = r1;
868
+ if (r3) {
869
+ ptr3 = 0; len3 = 0;
870
+ throw takeObject(r2);
871
+ }
872
+ deferred4_0 = ptr3;
873
+ deferred4_1 = len3;
874
+ return getStringFromWasm0(ptr3, len3);
875
+ } finally {
876
+ wasm.__wbindgen_add_to_stack_pointer(16);
877
+ wasm.__wbindgen_export3(deferred4_0, deferred4_1, 1);
878
+ }
879
+ }
880
+
843
881
  /**
844
882
  * The purrdf engine version (the crate's SemVer), exposed to JS as `version()`.
845
883
  *
@@ -873,10 +911,18 @@ function __wbg_get_imports() {
873
911
  __wbg___wbindgen_throw_ea4887a5f8f9a9db: function(arg0, arg1) {
874
912
  throw new Error(getStringFromWasm0(arg0, arg1));
875
913
  },
914
+ __wbg_now_d2e0afbad4edbe82: function() {
915
+ const ret = Date.now();
916
+ return ret;
917
+ },
876
918
  __wbg_quad_new: function(arg0) {
877
919
  const ret = Quad.__wrap(arg0);
878
920
  return addHeapObject(ret);
879
921
  },
922
+ __wbg_random_3182549db57fb083: function() {
923
+ const ret = Math.random();
924
+ return ret;
925
+ },
880
926
  __wbindgen_object_drop_ref: function(arg0) {
881
927
  takeObject(arg0);
882
928
  },
Binary file
@@ -36,6 +36,7 @@ export const quad_predicate: (a: number) => number;
36
36
  export const quad_subject: (a: number) => number;
37
37
  export const quad_term_type: (a: number, b: number) => void;
38
38
  export const quad_value: (a: number, b: number) => void;
39
+ export const shaclValidateToSarif: (a: number, b: number, c: number, d: number, e: number) => void;
39
40
  export const sink_finish: (a: number, b: number) => void;
40
41
  export const sink_new: () => number;
41
42
  export const sink_push: (a: number, b: number, c: number) => void;