@blackcatinformatics/purrdf 0.5.0 → 0.7.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 +48 -0
- package/index.d.ts +49 -0
- package/index.mjs +6 -0
- package/package.json +2 -1
- package/pkg/purrdf_wasm.d.ts +65 -5
- package/pkg/purrdf_wasm.js +212 -5
- package/pkg/purrdf_wasm_bg.wasm +0 -0
- package/pkg/purrdf_wasm_bg.wasm.d.ts +9 -0
package/README.md
CHANGED
|
@@ -76,6 +76,51 @@ const names = engine.select(
|
|
|
76
76
|
console.log(names.rows.take(0)?.message.value);
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
+
## Graph, tabular, and research-object projection archives
|
|
80
|
+
|
|
81
|
+
Projection and lift run entirely in memory through the native Rust engine. The
|
|
82
|
+
caller supplies strict profile-tagged JSON; PurRDF does not fabricate vocabulary,
|
|
83
|
+
identity, or resource limits.
|
|
84
|
+
|
|
85
|
+
```js
|
|
86
|
+
import { Dataset, liftProjection, ready } from "@blackcatinformatics/purrdf";
|
|
87
|
+
|
|
88
|
+
await ready();
|
|
89
|
+
const config = JSON.stringify({
|
|
90
|
+
profile: "lpg-csv",
|
|
91
|
+
config: {
|
|
92
|
+
rdf_type: "https://example.org/type",
|
|
93
|
+
limits: {
|
|
94
|
+
max_artifacts: 16,
|
|
95
|
+
max_artifact_bytes: 1_000_000,
|
|
96
|
+
max_total_bytes: 4_000_000,
|
|
97
|
+
max_archive_bytes: 5_000_000,
|
|
98
|
+
max_term_depth: 16,
|
|
99
|
+
},
|
|
100
|
+
max_records: 1_000,
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
const dataset = Dataset.parse(
|
|
104
|
+
"@prefix ex: <https://example.org/> . ex:alice ex:knows ex:bob .",
|
|
105
|
+
"turtle",
|
|
106
|
+
);
|
|
107
|
+
const projected = dataset.project("lpg-csv", config);
|
|
108
|
+
const lifted = liftProjection(projected.archive, "lpg-csv", config);
|
|
109
|
+
const roundTrip = lifted.takeDataset();
|
|
110
|
+
console.log(roundTrip?.size, JSON.parse(projected.lossLedgerJson));
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
`lpg-csv`, `neo4j-csv`, `open-cypher`, `graphml`, `csvw-exact`,
|
|
114
|
+
`croissant-1.1`, `ro-crate-1.3`, `datacite-4.6`, `dcat-3`, and
|
|
115
|
+
`frictionless-data-package-1` are bidirectional. `obo-graphs` and `skos` are
|
|
116
|
+
write-only, loss-ledgered views and are excluded from the `LiftProfile`
|
|
117
|
+
TypeScript union. Research-object contexts, vocabularies, identities, and
|
|
118
|
+
profiles are mandatory caller configuration. Archives are canonical
|
|
119
|
+
deterministic USTAR bytes. Package/lift objects own wasm memory; call `free()`
|
|
120
|
+
when finished, and remember that `takeDataset()` transfers its dataset exactly
|
|
121
|
+
once. A runnable Node example is
|
|
122
|
+
[`projection-roundtrip.mjs`](https://github.com/Blackcat-Informatics/purrdf/blob/main/crates/rdf-wasm/js/examples/projection-roundtrip.mjs).
|
|
123
|
+
|
|
79
124
|
## API surface
|
|
80
125
|
|
|
81
126
|
- `ready(bytesOrUrl?)` — one-time async wasm instantiation.
|
|
@@ -87,6 +132,9 @@ console.log(names.rows.take(0)?.message.value);
|
|
|
87
132
|
Formats: `turtle`, `ntriples`, `nquads`, `trig`, `rdfxml` (`serialize` also `jsonld`).
|
|
88
133
|
- `Dataset.canonicalize()` / `Dataset.isomorphic(other)` — RDFC-1.0 canonical N-Quads
|
|
89
134
|
and RDF graph-identity (isomorphism under blank-node relabeling).
|
|
135
|
+
- `Dataset.project(profile, configJson)` / `liftProjection(archive, profile,
|
|
136
|
+
configJson)` — canonical graph/tabular/research-object USTAR carriers with structured,
|
|
137
|
+
always-computed loss-ledger JSON.
|
|
90
138
|
- `Dataset.visualModel(options?)` / `visualExport(options?)` /
|
|
91
139
|
`visualSvg(options?)` — the renderer-neutral RDF 1.2 model, complete semantic
|
|
92
140
|
scene and deterministic geometry, or self-contained SVG paired with that export.
|
package/index.d.ts
CHANGED
|
@@ -378,6 +378,7 @@ export class Dataset implements Iterable<Quad> {
|
|
|
378
378
|
graph?: Term | null,
|
|
379
379
|
): Dataset;
|
|
380
380
|
quads(): Quad[];
|
|
381
|
+
project(profile: ProjectionProfile, configJson: string): ProjectionPackage;
|
|
381
382
|
visualModel(options?: VisualizationOptions | null): VisualModel;
|
|
382
383
|
visualExport(options?: VisualizationOptions | null): VisualExport;
|
|
383
384
|
visualSvg(options?: VisualizationOptions | null): VisualSvgDocument;
|
|
@@ -390,6 +391,49 @@ export class Dataset implements Iterable<Quad> {
|
|
|
390
391
|
free(): void;
|
|
391
392
|
}
|
|
392
393
|
|
|
394
|
+
export type ProjectionProfile =
|
|
395
|
+
| "lpg-csv"
|
|
396
|
+
| "neo4j-csv"
|
|
397
|
+
| "open-cypher"
|
|
398
|
+
| "graphml"
|
|
399
|
+
| "csvw-exact"
|
|
400
|
+
| "obo-graphs"
|
|
401
|
+
| "skos"
|
|
402
|
+
| "croissant-1.1"
|
|
403
|
+
| "ro-crate-1.3"
|
|
404
|
+
| "datacite-4.6"
|
|
405
|
+
| "dcat-3"
|
|
406
|
+
| "frictionless-data-package-1";
|
|
407
|
+
|
|
408
|
+
export type LiftProfile = Exclude<ProjectionProfile, "obo-graphs" | "skos">;
|
|
409
|
+
|
|
410
|
+
export interface ProjectionLossLedger {
|
|
411
|
+
schema_version: 1;
|
|
412
|
+
losses: Array<{
|
|
413
|
+
code: string;
|
|
414
|
+
from: string;
|
|
415
|
+
to: string;
|
|
416
|
+
intentional: boolean;
|
|
417
|
+
note: string;
|
|
418
|
+
location?: string;
|
|
419
|
+
}>;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
export class ProjectionPackage {
|
|
423
|
+
private constructor();
|
|
424
|
+
readonly profile: ProjectionProfile;
|
|
425
|
+
readonly archive: Uint8Array;
|
|
426
|
+
readonly lossLedgerJson: string;
|
|
427
|
+
free(): void;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export class ProjectionLift {
|
|
431
|
+
private constructor();
|
|
432
|
+
readonly lossLedgerJson: string;
|
|
433
|
+
takeDataset(): Dataset | undefined;
|
|
434
|
+
free(): void;
|
|
435
|
+
}
|
|
436
|
+
|
|
393
437
|
export class QueryEngine {
|
|
394
438
|
constructor();
|
|
395
439
|
query(dataset: Dataset, sparql: string, options?: QueryOptions | null): QueryResult;
|
|
@@ -414,6 +458,11 @@ export function datasetToStream(dataset: Dataset): AsyncIterableIterator<Quad>;
|
|
|
414
458
|
export function streamToDataset(
|
|
415
459
|
quadStream: AsyncIterable<Quad> | Iterable<Quad>,
|
|
416
460
|
): Promise<Dataset>;
|
|
461
|
+
export function liftProjection(
|
|
462
|
+
archive: Uint8Array,
|
|
463
|
+
profile: LiftProfile,
|
|
464
|
+
configJson: string,
|
|
465
|
+
): ProjectionLift;
|
|
417
466
|
export function shaclEntail(shapesTtl: string, dataNt: string): string;
|
|
418
467
|
export function shaclValidateToSarif(shapesTtl: string, dataNt: string): string;
|
|
419
468
|
export function version(): string;
|
package/index.mjs
CHANGED
|
@@ -21,6 +21,9 @@
|
|
|
21
21
|
import init, {
|
|
22
22
|
DataFactory,
|
|
23
23
|
Dataset,
|
|
24
|
+
liftProjection,
|
|
25
|
+
ProjectionLift,
|
|
26
|
+
ProjectionPackage,
|
|
24
27
|
Quad,
|
|
25
28
|
QueryEngine,
|
|
26
29
|
shaclEntail,
|
|
@@ -330,6 +333,9 @@ export async function streamToDataset(quadStream) {
|
|
|
330
333
|
export {
|
|
331
334
|
DataFactory,
|
|
332
335
|
Dataset,
|
|
336
|
+
liftProjection,
|
|
337
|
+
ProjectionLift,
|
|
338
|
+
ProjectionPackage,
|
|
333
339
|
Quad,
|
|
334
340
|
QueryEngine,
|
|
335
341
|
shaclEntail,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blackcatinformatics/purrdf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.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",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"typecheck": "tsc -p tsconfig.types.json"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
+
"graphql": "16.14.0",
|
|
46
47
|
"typescript": "7.0.2"
|
|
47
48
|
},
|
|
48
49
|
"engines": {
|
package/pkg/purrdf_wasm.d.ts
CHANGED
|
@@ -123,10 +123,15 @@ export class Dataset {
|
|
|
123
123
|
/**
|
|
124
124
|
* `parse(input, format, base?)` → a dataset of the parsed quads.
|
|
125
125
|
*
|
|
126
|
-
* `format` is a media type or short name
|
|
126
|
+
* `format` is a media type or short name
|
|
127
|
+
* (turtle/ntriples/nquads/trig/rdfxml/jsonld/yamlld).
|
|
127
128
|
* Ill-typed literals are preserved verbatim (RDFLib parity), not rejected.
|
|
128
129
|
*/
|
|
129
130
|
static parse(input: string, format: string, base?: string | null): Dataset;
|
|
131
|
+
/**
|
|
132
|
+
* Project this dataset into a deterministic graph, tabular, or research-object USTAR package.
|
|
133
|
+
*/
|
|
134
|
+
project(profile: string, config_json: string): ProjectionPackage;
|
|
130
135
|
/**
|
|
131
136
|
* `quads()` → every effective quad, as a JS array.
|
|
132
137
|
*/
|
|
@@ -143,10 +148,13 @@ export class Dataset {
|
|
|
143
148
|
/**
|
|
144
149
|
* `serialize(format)` → the dataset rendered in `format` (a UTF-8 string).
|
|
145
150
|
*
|
|
146
|
-
* Formats: `turtle` / `ntriples` / `nquads` / `trig` / `rdfxml`
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
151
|
+
* Formats: `turtle` / `ntriples` / `nquads` / `trig` / `rdfxml` / `jsonld`
|
|
152
|
+
* (JSON-LD-star) / `yamlld` (YAML-LD-star), and their media types — all resolved
|
|
153
|
+
* through the one core registry.
|
|
154
|
+
*
|
|
155
|
+
* Object-position quoted-triple terms (RDF-1.2 triple terms) are preserved
|
|
156
|
+
* through N-Quads, JSON-LD, and YAML-LD; the other text syntaxes (Turtle,
|
|
157
|
+
* N-Triples, TriG, RDF/XML) flatten them.
|
|
150
158
|
*/
|
|
151
159
|
serialize(format: string): string;
|
|
152
160
|
/**
|
|
@@ -167,6 +175,44 @@ export class Dataset {
|
|
|
167
175
|
readonly size: number;
|
|
168
176
|
}
|
|
169
177
|
|
|
178
|
+
/**
|
|
179
|
+
* Result of lifting a strict carrier package into an in-memory RDF dataset.
|
|
180
|
+
*/
|
|
181
|
+
export class ProjectionLift {
|
|
182
|
+
private constructor();
|
|
183
|
+
free(): void;
|
|
184
|
+
[Symbol.dispose](): void;
|
|
185
|
+
/**
|
|
186
|
+
* Move the lifted dataset out of this result. The dataset can be taken once.
|
|
187
|
+
*/
|
|
188
|
+
takeDataset(): Dataset | undefined;
|
|
189
|
+
/**
|
|
190
|
+
* Canonical, versioned runtime loss-ledger JSON.
|
|
191
|
+
*/
|
|
192
|
+
readonly lossLedgerJson: string;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* A deterministic USTAR projection package and its canonical runtime ledger.
|
|
197
|
+
*/
|
|
198
|
+
export class ProjectionPackage {
|
|
199
|
+
private constructor();
|
|
200
|
+
free(): void;
|
|
201
|
+
[Symbol.dispose](): void;
|
|
202
|
+
/**
|
|
203
|
+
* Canonical deterministic USTAR bytes.
|
|
204
|
+
*/
|
|
205
|
+
readonly archive: Uint8Array;
|
|
206
|
+
/**
|
|
207
|
+
* Canonical, versioned runtime loss-ledger JSON.
|
|
208
|
+
*/
|
|
209
|
+
readonly lossLedgerJson: string;
|
|
210
|
+
/**
|
|
211
|
+
* Stable carrier profile name.
|
|
212
|
+
*/
|
|
213
|
+
readonly profile: string;
|
|
214
|
+
}
|
|
215
|
+
|
|
170
216
|
/**
|
|
171
217
|
* An RDF/JS [Quad](https://rdf.js.org/data-model-spec/#quad-interface) — a statement
|
|
172
218
|
* `(subject, predicate, object, graph)` with `termType: "Quad"`.
|
|
@@ -406,6 +452,11 @@ export class Term {
|
|
|
406
452
|
readonly value: string;
|
|
407
453
|
}
|
|
408
454
|
|
|
455
|
+
/**
|
|
456
|
+
* Lift a strict bidirectional USTAR package into an in-memory RDF dataset.
|
|
457
|
+
*/
|
|
458
|
+
export function liftProjection(archive: Uint8Array, profile: string, config_json: string): ProjectionLift;
|
|
459
|
+
|
|
409
460
|
/**
|
|
410
461
|
* `shaclEntail(shapesTtl, dataNt)` → the materialized dataset as an N-Triples
|
|
411
462
|
* string (the base graph plus every inferred triple).
|
|
@@ -437,6 +488,8 @@ export interface InitOutput {
|
|
|
437
488
|
readonly memory: WebAssembly.Memory;
|
|
438
489
|
readonly __wbg_datafactory_free: (a: number, b: number) => void;
|
|
439
490
|
readonly __wbg_dataset_free: (a: number, b: number) => void;
|
|
491
|
+
readonly __wbg_projectionlift_free: (a: number, b: number) => void;
|
|
492
|
+
readonly __wbg_projectionpackage_free: (a: number, b: number) => void;
|
|
440
493
|
readonly __wbg_quad_free: (a: number, b: number) => void;
|
|
441
494
|
readonly __wbg_queryengine_free: (a: number, b: number) => void;
|
|
442
495
|
readonly __wbg_queryresult_free: (a: number, b: number) => void;
|
|
@@ -464,6 +517,7 @@ export interface InitOutput {
|
|
|
464
517
|
readonly dataset_match: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
465
518
|
readonly dataset_new: (a: number) => void;
|
|
466
519
|
readonly dataset_parse: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
520
|
+
readonly dataset_project: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
467
521
|
readonly dataset_quads: (a: number, b: number) => void;
|
|
468
522
|
readonly dataset_query: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
469
523
|
readonly dataset_serialize: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -471,6 +525,12 @@ export interface InitOutput {
|
|
|
471
525
|
readonly dataset_visualExportJson: (a: number, b: number, c: number, d: number) => void;
|
|
472
526
|
readonly dataset_visualModelJson: (a: number, b: number, c: number, d: number) => void;
|
|
473
527
|
readonly dataset_visualSvgJson: (a: number, b: number, c: number, d: number) => void;
|
|
528
|
+
readonly liftProjection: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
529
|
+
readonly projectionlift_lossLedgerJson: (a: number, b: number) => void;
|
|
530
|
+
readonly projectionlift_takeDataset: (a: number) => number;
|
|
531
|
+
readonly projectionpackage_archive: (a: number, b: number) => void;
|
|
532
|
+
readonly projectionpackage_lossLedgerJson: (a: number, b: number) => void;
|
|
533
|
+
readonly projectionpackage_profile: (a: number, b: number) => void;
|
|
474
534
|
readonly quad_asTerm: (a: number, b: number) => void;
|
|
475
535
|
readonly quad_equals: (a: number, b: number) => number;
|
|
476
536
|
readonly quad_graph: (a: number) => number;
|
package/pkg/purrdf_wasm.js
CHANGED
|
@@ -425,7 +425,8 @@ export class Dataset {
|
|
|
425
425
|
/**
|
|
426
426
|
* `parse(input, format, base?)` → a dataset of the parsed quads.
|
|
427
427
|
*
|
|
428
|
-
* `format` is a media type or short name
|
|
428
|
+
* `format` is a media type or short name
|
|
429
|
+
* (turtle/ntriples/nquads/trig/rdfxml/jsonld/yamlld).
|
|
429
430
|
* Ill-typed literals are preserved verbatim (RDFLib parity), not rejected.
|
|
430
431
|
* @param {string} input
|
|
431
432
|
* @param {string} format
|
|
@@ -453,6 +454,31 @@ export class Dataset {
|
|
|
453
454
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
454
455
|
}
|
|
455
456
|
}
|
|
457
|
+
/**
|
|
458
|
+
* Project this dataset into a deterministic graph, tabular, or research-object USTAR package.
|
|
459
|
+
* @param {string} profile
|
|
460
|
+
* @param {string} config_json
|
|
461
|
+
* @returns {ProjectionPackage}
|
|
462
|
+
*/
|
|
463
|
+
project(profile, config_json) {
|
|
464
|
+
try {
|
|
465
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
466
|
+
const ptr0 = passStringToWasm0(profile, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
467
|
+
const len0 = WASM_VECTOR_LEN;
|
|
468
|
+
const ptr1 = passStringToWasm0(config_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
469
|
+
const len1 = WASM_VECTOR_LEN;
|
|
470
|
+
wasm.dataset_project(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
471
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
472
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
473
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
474
|
+
if (r2) {
|
|
475
|
+
throw takeObject(r1);
|
|
476
|
+
}
|
|
477
|
+
return ProjectionPackage.__wrap(r0);
|
|
478
|
+
} finally {
|
|
479
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
456
482
|
/**
|
|
457
483
|
* `quads()` → every effective quad, as a JS array.
|
|
458
484
|
* @returns {Quad[]}
|
|
@@ -517,10 +543,13 @@ export class Dataset {
|
|
|
517
543
|
/**
|
|
518
544
|
* `serialize(format)` → the dataset rendered in `format` (a UTF-8 string).
|
|
519
545
|
*
|
|
520
|
-
* Formats: `turtle` / `ntriples` / `nquads` / `trig` / `rdfxml`
|
|
521
|
-
*
|
|
522
|
-
*
|
|
523
|
-
*
|
|
546
|
+
* Formats: `turtle` / `ntriples` / `nquads` / `trig` / `rdfxml` / `jsonld`
|
|
547
|
+
* (JSON-LD-star) / `yamlld` (YAML-LD-star), and their media types — all resolved
|
|
548
|
+
* through the one core registry.
|
|
549
|
+
*
|
|
550
|
+
* Object-position quoted-triple terms (RDF-1.2 triple terms) are preserved
|
|
551
|
+
* through N-Quads, JSON-LD, and YAML-LD; the other text syntaxes (Turtle,
|
|
552
|
+
* N-Triples, TriG, RDF/XML) flatten them.
|
|
524
553
|
* @param {string} format
|
|
525
554
|
* @returns {string}
|
|
526
555
|
*/
|
|
@@ -654,6 +683,137 @@ export class Dataset {
|
|
|
654
683
|
}
|
|
655
684
|
if (Symbol.dispose) Dataset.prototype[Symbol.dispose] = Dataset.prototype.free;
|
|
656
685
|
|
|
686
|
+
/**
|
|
687
|
+
* Result of lifting a strict carrier package into an in-memory RDF dataset.
|
|
688
|
+
*/
|
|
689
|
+
export class ProjectionLift {
|
|
690
|
+
static __wrap(ptr) {
|
|
691
|
+
const obj = Object.create(ProjectionLift.prototype);
|
|
692
|
+
obj.__wbg_ptr = ptr;
|
|
693
|
+
ProjectionLiftFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
694
|
+
return obj;
|
|
695
|
+
}
|
|
696
|
+
__destroy_into_raw() {
|
|
697
|
+
const ptr = this.__wbg_ptr;
|
|
698
|
+
this.__wbg_ptr = 0;
|
|
699
|
+
ProjectionLiftFinalization.unregister(this);
|
|
700
|
+
return ptr;
|
|
701
|
+
}
|
|
702
|
+
free() {
|
|
703
|
+
const ptr = this.__destroy_into_raw();
|
|
704
|
+
wasm.__wbg_projectionlift_free(ptr, 0);
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Canonical, versioned runtime loss-ledger JSON.
|
|
708
|
+
* @returns {string}
|
|
709
|
+
*/
|
|
710
|
+
get lossLedgerJson() {
|
|
711
|
+
let deferred1_0;
|
|
712
|
+
let deferred1_1;
|
|
713
|
+
try {
|
|
714
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
715
|
+
wasm.projectionlift_lossLedgerJson(retptr, this.__wbg_ptr);
|
|
716
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
717
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
718
|
+
deferred1_0 = r0;
|
|
719
|
+
deferred1_1 = r1;
|
|
720
|
+
return getStringFromWasm0(r0, r1);
|
|
721
|
+
} finally {
|
|
722
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
723
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* Move the lifted dataset out of this result. The dataset can be taken once.
|
|
728
|
+
* @returns {Dataset | undefined}
|
|
729
|
+
*/
|
|
730
|
+
takeDataset() {
|
|
731
|
+
const ret = wasm.projectionlift_takeDataset(this.__wbg_ptr);
|
|
732
|
+
return ret === 0 ? undefined : Dataset.__wrap(ret);
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
if (Symbol.dispose) ProjectionLift.prototype[Symbol.dispose] = ProjectionLift.prototype.free;
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* A deterministic USTAR projection package and its canonical runtime ledger.
|
|
739
|
+
*/
|
|
740
|
+
export class ProjectionPackage {
|
|
741
|
+
static __wrap(ptr) {
|
|
742
|
+
const obj = Object.create(ProjectionPackage.prototype);
|
|
743
|
+
obj.__wbg_ptr = ptr;
|
|
744
|
+
ProjectionPackageFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
745
|
+
return obj;
|
|
746
|
+
}
|
|
747
|
+
__destroy_into_raw() {
|
|
748
|
+
const ptr = this.__wbg_ptr;
|
|
749
|
+
this.__wbg_ptr = 0;
|
|
750
|
+
ProjectionPackageFinalization.unregister(this);
|
|
751
|
+
return ptr;
|
|
752
|
+
}
|
|
753
|
+
free() {
|
|
754
|
+
const ptr = this.__destroy_into_raw();
|
|
755
|
+
wasm.__wbg_projectionpackage_free(ptr, 0);
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* Canonical deterministic USTAR bytes.
|
|
759
|
+
* @returns {Uint8Array}
|
|
760
|
+
*/
|
|
761
|
+
get archive() {
|
|
762
|
+
try {
|
|
763
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
764
|
+
wasm.projectionpackage_archive(retptr, this.__wbg_ptr);
|
|
765
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
766
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
767
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
768
|
+
wasm.__wbindgen_export3(r0, r1 * 1, 1);
|
|
769
|
+
return v1;
|
|
770
|
+
} finally {
|
|
771
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* Canonical, versioned runtime loss-ledger JSON.
|
|
776
|
+
* @returns {string}
|
|
777
|
+
*/
|
|
778
|
+
get lossLedgerJson() {
|
|
779
|
+
let deferred1_0;
|
|
780
|
+
let deferred1_1;
|
|
781
|
+
try {
|
|
782
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
783
|
+
wasm.projectionpackage_lossLedgerJson(retptr, this.__wbg_ptr);
|
|
784
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
785
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
786
|
+
deferred1_0 = r0;
|
|
787
|
+
deferred1_1 = r1;
|
|
788
|
+
return getStringFromWasm0(r0, r1);
|
|
789
|
+
} finally {
|
|
790
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
791
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Stable carrier profile name.
|
|
796
|
+
* @returns {string}
|
|
797
|
+
*/
|
|
798
|
+
get profile() {
|
|
799
|
+
let deferred1_0;
|
|
800
|
+
let deferred1_1;
|
|
801
|
+
try {
|
|
802
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
803
|
+
wasm.projectionpackage_profile(retptr, this.__wbg_ptr);
|
|
804
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
805
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
806
|
+
deferred1_0 = r0;
|
|
807
|
+
deferred1_1 = r1;
|
|
808
|
+
return getStringFromWasm0(r0, r1);
|
|
809
|
+
} finally {
|
|
810
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
811
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
if (Symbol.dispose) ProjectionPackage.prototype[Symbol.dispose] = ProjectionPackage.prototype.free;
|
|
816
|
+
|
|
657
817
|
/**
|
|
658
818
|
* An RDF/JS [Quad](https://rdf.js.org/data-model-spec/#quad-interface) — a statement
|
|
659
819
|
* `(subject, predicate, object, graph)` with `termType: "Quad"`.
|
|
@@ -1448,6 +1608,35 @@ export class Term {
|
|
|
1448
1608
|
}
|
|
1449
1609
|
if (Symbol.dispose) Term.prototype[Symbol.dispose] = Term.prototype.free;
|
|
1450
1610
|
|
|
1611
|
+
/**
|
|
1612
|
+
* Lift a strict bidirectional USTAR package into an in-memory RDF dataset.
|
|
1613
|
+
* @param {Uint8Array} archive
|
|
1614
|
+
* @param {string} profile
|
|
1615
|
+
* @param {string} config_json
|
|
1616
|
+
* @returns {ProjectionLift}
|
|
1617
|
+
*/
|
|
1618
|
+
export function liftProjection(archive, profile, config_json) {
|
|
1619
|
+
try {
|
|
1620
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1621
|
+
const ptr0 = passArray8ToWasm0(archive, wasm.__wbindgen_export);
|
|
1622
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1623
|
+
const ptr1 = passStringToWasm0(profile, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1624
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1625
|
+
const ptr2 = passStringToWasm0(config_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1626
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1627
|
+
wasm.liftProjection(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1628
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1629
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1630
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1631
|
+
if (r2) {
|
|
1632
|
+
throw takeObject(r1);
|
|
1633
|
+
}
|
|
1634
|
+
return ProjectionLift.__wrap(r0);
|
|
1635
|
+
} finally {
|
|
1636
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1451
1640
|
/**
|
|
1452
1641
|
* `shaclEntail(shapesTtl, dataNt)` → the materialized dataset as an N-Triples
|
|
1453
1642
|
* string (the base graph plus every inferred triple).
|
|
@@ -1591,6 +1780,12 @@ const DataFactoryFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
1591
1780
|
const DatasetFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1592
1781
|
? { register: () => {}, unregister: () => {} }
|
|
1593
1782
|
: new FinalizationRegistry(ptr => wasm.__wbg_dataset_free(ptr, 1));
|
|
1783
|
+
const ProjectionLiftFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1784
|
+
? { register: () => {}, unregister: () => {} }
|
|
1785
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_projectionlift_free(ptr, 1));
|
|
1786
|
+
const ProjectionPackageFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1787
|
+
? { register: () => {}, unregister: () => {} }
|
|
1788
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_projectionpackage_free(ptr, 1));
|
|
1594
1789
|
const QuadFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1595
1790
|
? { register: () => {}, unregister: () => {} }
|
|
1596
1791
|
: new FinalizationRegistry(ptr => wasm.__wbg_quad_free(ptr, 1));
|
|
@@ -1644,6 +1839,11 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
1644
1839
|
return result;
|
|
1645
1840
|
}
|
|
1646
1841
|
|
|
1842
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
1843
|
+
ptr = ptr >>> 0;
|
|
1844
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1647
1847
|
let cachedDataViewMemory0 = null;
|
|
1648
1848
|
function getDataViewMemory0() {
|
|
1649
1849
|
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
@@ -1675,6 +1875,13 @@ function isLikeNone(x) {
|
|
|
1675
1875
|
return x === undefined || x === null;
|
|
1676
1876
|
}
|
|
1677
1877
|
|
|
1878
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
1879
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
1880
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
1881
|
+
WASM_VECTOR_LEN = arg.length;
|
|
1882
|
+
return ptr;
|
|
1883
|
+
}
|
|
1884
|
+
|
|
1678
1885
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
1679
1886
|
if (realloc === undefined) {
|
|
1680
1887
|
const buf = cachedTextEncoder.encode(arg);
|
package/pkg/purrdf_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const __wbg_datafactory_free: (a: number, b: number) => void;
|
|
5
5
|
export const __wbg_dataset_free: (a: number, b: number) => void;
|
|
6
|
+
export const __wbg_projectionlift_free: (a: number, b: number) => void;
|
|
7
|
+
export const __wbg_projectionpackage_free: (a: number, b: number) => void;
|
|
6
8
|
export const __wbg_quad_free: (a: number, b: number) => void;
|
|
7
9
|
export const __wbg_queryengine_free: (a: number, b: number) => void;
|
|
8
10
|
export const __wbg_queryresult_free: (a: number, b: number) => void;
|
|
@@ -30,6 +32,7 @@ export const dataset_isomorphic: (a: number, b: number, c: number) => void;
|
|
|
30
32
|
export const dataset_match: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
31
33
|
export const dataset_new: (a: number) => void;
|
|
32
34
|
export const dataset_parse: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
35
|
+
export const dataset_project: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
33
36
|
export const dataset_quads: (a: number, b: number) => void;
|
|
34
37
|
export const dataset_query: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
35
38
|
export const dataset_serialize: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -37,6 +40,12 @@ export const dataset_size: (a: number) => number;
|
|
|
37
40
|
export const dataset_visualExportJson: (a: number, b: number, c: number, d: number) => void;
|
|
38
41
|
export const dataset_visualModelJson: (a: number, b: number, c: number, d: number) => void;
|
|
39
42
|
export const dataset_visualSvgJson: (a: number, b: number, c: number, d: number) => void;
|
|
43
|
+
export const liftProjection: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
44
|
+
export const projectionlift_lossLedgerJson: (a: number, b: number) => void;
|
|
45
|
+
export const projectionlift_takeDataset: (a: number) => number;
|
|
46
|
+
export const projectionpackage_archive: (a: number, b: number) => void;
|
|
47
|
+
export const projectionpackage_lossLedgerJson: (a: number, b: number) => void;
|
|
48
|
+
export const projectionpackage_profile: (a: number, b: number) => void;
|
|
40
49
|
export const quad_asTerm: (a: number, b: number) => void;
|
|
41
50
|
export const quad_equals: (a: number, b: number) => number;
|
|
42
51
|
export const quad_graph: (a: number) => number;
|