wasmer run eddiethedean/ontologos
@ontologos/wasm
WebAssembly bindings for OntoLogos.
Release CI publishes the wasm-pack .wasm to the Wasmer Registry as eddiethedean/ontologos (see wasmer.toml). Browser usage still requires this package’s JS glue.
Build
# Install wasm-pack: https://rustwasm.github.io/wasm-pack/installer/
cd crates/ontologos-wasm
npm install
npm run build
npm test
Browser usage
import init, { OntologyBuilder, Reasoner } from "@ontologos/wasm";
await init({ module_or_path: wasmUrl });
const builder = new OntologyBuilder();
builder.addClass("http://example.org/Pizza");
builder.addClass("http://example.org/Food");
builder.subclassOf("http://example.org/Pizza", "http://example.org/Food");
const ontology = builder.build();
const reasoner = new Reasoner(ontology, "el");
const report = reasoner.classify();
console.log(report);
Load OWL from bytes or text (no filesystem):
const ontology = Ontology.fromBytes(new TextEncoder().encode(owlString));
const reasoner = new Reasoner(ontology, "auto");
Security
fromBytes/fromTextuse strict parse defaults for untrusted uploads.- Use
fromBytesLenient/fromTextLenientonly for trusted corpora. - Use
fromJsonWithLimitsfor user JSON with tightenedmax_json_bytes. - DL reasoning can block the main thread — set
budgetSecsand prefer Web Workers.
Full guide: WebAssembly bindings
API
Mirrors the Python bindings: Ontology, OntologyBuilder, Reasoner with classify(), checkConsistency(), isEntailed(), query(), and incremental axiom edits.