@blackcatinformatics/purrdf 0.1.3 → 0.1.5
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 +95 -0
- package/package.json +6 -1
- package/pkg/purrdf_wasm_bg.wasm +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SPDX-FileCopyrightText: 2026 Blackcat Informatics® Inc. <paudley@blackcatinformatics.ca>
|
|
3
|
+
SPDX-License-Identifier: MIT OR Apache-2.0
|
|
4
|
+
-->
|
|
5
|
+
|
|
6
|
+
# @blackcatinformatics/purrdf
|
|
7
|
+
|
|
8
|
+
**PurRDF** — an in-memory RDF 1.2 engine for JavaScript, compiled to
|
|
9
|
+
WebAssembly from the [purrdf](https://github.com/Blackcat-Informatics/purrdf)
|
|
10
|
+
Rust workspace, with an idiomatic [RDF/JS](https://rdf.js.org/)
|
|
11
|
+
(`DataFactory` / `DatasetCore` / `Stream`) API.
|
|
12
|
+
|
|
13
|
+
It is the same engine, byte-for-byte behavior, that ships as the `purrdf`
|
|
14
|
+
Rust crates, the `purrdf` PyPI package, and `libpurrdf` — PurRDF's rule is
|
|
15
|
+
**one engine, one behavior, every language**.
|
|
16
|
+
|
|
17
|
+
## Why this instead of an incumbent RDF/JS library?
|
|
18
|
+
|
|
19
|
+
No incumbent RDF/JS library carries the RDF 1.2 features:
|
|
20
|
+
|
|
21
|
+
- **Quoted-triple terms** (RDF-star / RDF 1.2 triple terms), usable in the
|
|
22
|
+
object position;
|
|
23
|
+
- **Base-direction literals** (`rdf:dirLangString`) — language *plus*
|
|
24
|
+
`ltr`/`rtl` direction;
|
|
25
|
+
- Byte-deterministic serializers backed by W3C conformance corpora
|
|
26
|
+
(SPARQL 1.1, RDFC-1.0 canonicalization fixtures) in the parent workspace.
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
npm install @blackcatinformatics/purrdf
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Runs in Node ≥ 18 and modern browsers (ESM, `web`-target wasm-bindgen).
|
|
35
|
+
|
|
36
|
+
## Quickstart
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
import { ready, DataFactory, Dataset } from "@blackcatinformatics/purrdf";
|
|
40
|
+
|
|
41
|
+
await ready(); // one-time async wasm instantiation
|
|
42
|
+
|
|
43
|
+
const f = new DataFactory();
|
|
44
|
+
|
|
45
|
+
// A quoted triple, usable as a subject/object (RDF-star / RDF 1.2).
|
|
46
|
+
const quoted = f.quotedTriple(
|
|
47
|
+
f.namedNode("https://ex/alice"),
|
|
48
|
+
f.namedNode("https://ex/knows"),
|
|
49
|
+
f.namedNode("https://ex/bob"),
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
// A base-direction literal (rdf:dirLangString).
|
|
53
|
+
const rtl = f.directionalLiteral("مرحبا", "ar", "rtl");
|
|
54
|
+
|
|
55
|
+
const ds = new Dataset();
|
|
56
|
+
ds.add(f.quad(f.namedNode("https://ex/s"), f.namedNode("https://ex/says"), rtl));
|
|
57
|
+
ds.add(f.quad(f.namedNode("https://ex/stmt"), f.namedNode("https://ex/asserts"), quoted));
|
|
58
|
+
|
|
59
|
+
// Quoted triples + directions survive a round-trip through N-Quads.
|
|
60
|
+
const nq = ds.serialize("nquads");
|
|
61
|
+
const reparsed = Dataset.parse(nq, "nquads");
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## API surface
|
|
65
|
+
|
|
66
|
+
- `ready(bytesOrUrl?)` — one-time async wasm instantiation.
|
|
67
|
+
- `DataFactory` — `namedNode`, `blankNode`, `literal`, `typedLiteral`,
|
|
68
|
+
`directionalLiteral`, `variable`, `defaultGraph`, `quad`, `quotedTriple`,
|
|
69
|
+
`fromTerm`, `fromQuad`.
|
|
70
|
+
- `Dataset` — `Dataset.parse(input, format, base?)`, `serialize(format)`,
|
|
71
|
+
`add` / `delete` / `has` / `match` / `quads` / `size`, iteration.
|
|
72
|
+
Formats: `turtle`, `ntriples`, `nquads`, `trig`, `rdfxml`.
|
|
73
|
+
- `Sink`, `datasetToStream`, `streamToDataset` — the async RDF/JS
|
|
74
|
+
Stream/Sink primitives over the synchronous engine surface.
|
|
75
|
+
- SPARQL evaluation over the in-memory dataset (no server required).
|
|
76
|
+
|
|
77
|
+
Full typings ship in `index.d.ts`.
|
|
78
|
+
|
|
79
|
+
## Scope
|
|
80
|
+
|
|
81
|
+
In-memory only, by design: no persistent store and no network I/O inside the
|
|
82
|
+
wasm module. For the container transport (GTS), SHACL validation, SPARQL
|
|
83
|
+
result serializers, and the rest of the toolkit, see the
|
|
84
|
+
[main repository](https://github.com/Blackcat-Informatics/purrdf).
|
|
85
|
+
|
|
86
|
+
## Supply chain
|
|
87
|
+
|
|
88
|
+
Published from GitHub Actions via npm trusted publishing with sigstore
|
|
89
|
+
provenance, a GitHub build-provenance attestation, and an SPDX SBOM per
|
|
90
|
+
release.
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
[MIT OR Apache-2.0](https://github.com/Blackcat-Informatics/purrdf/blob/main/LICENSING.md),
|
|
95
|
+
© 2026 Blackcat Informatics® Inc.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blackcatinformatics/purrdf",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
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",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"files": [
|
|
31
|
+
"README.md",
|
|
31
32
|
"index.mjs",
|
|
32
33
|
"index.d.ts",
|
|
33
34
|
"pkg/purrdf_wasm.js",
|
|
@@ -40,5 +41,9 @@
|
|
|
40
41
|
},
|
|
41
42
|
"engines": {
|
|
42
43
|
"node": ">=18"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/Blackcat-Informatics/purrdf/tree/main/crates/rdf-wasm",
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/Blackcat-Informatics/purrdf/issues"
|
|
43
48
|
}
|
|
44
49
|
}
|
package/pkg/purrdf_wasm_bg.wasm
CHANGED
|
Binary file
|