npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@unrdf/oxigraph

v5.0.1

Published

UNRDF Oxigraph - Graph database benchmarking implementation using Oxigraph SPARQL engine

Readme

@unrdf/oxigraph

Version Production Ready

Oxigraph-backed RDF store implementation for UNRDF. This package provides a benchmarking implementation using the Oxigraph SPARQL engine compiled to WebAssembly for JavaScript.

Features

  • SPARQL 1.1 Query Support: Full SELECT, CONSTRUCT, DESCRIBE, and ASK query support
  • SPARQL 1.1 Update Support: INSERT, DELETE, and other update operations
  • Multiple RDF Formats: Load and dump Turtle, TriG, N-Triples, N-Quads, RDF/XML, JSON-LD
  • High Performance: Rust-based implementation compiled to WASM
  • Compatible API: Drop-in alternative to the current UNRDF engine
  • Comprehensive Benchmarks: Built-in performance benchmarking suite

Installation

pnpm install @unrdf/oxigraph

Usage

Basic Store Operations

import { createStore, dataFactory } from '@unrdf/oxigraph';

// Create a new store
const store = createStore();

// Create RDF terms
const ex = dataFactory.namedNode('http://example.com/');
const name = dataFactory.namedNode('http://schema.org/name');
const value = dataFactory.literal('Example');

// Add a triple
const triple = dataFactory.triple(ex, name, value);
store.add(triple);

// Check if triple exists
console.log(store.has(triple)); // true

// Query the store
const results = store.query('SELECT ?s ?p ?o WHERE { ?s ?p ?o }');
console.log(results);

SPARQL Queries

// SELECT query
const selectResults = store.query(
  'SELECT ?name WHERE { ?s <http://schema.org/name> ?name }'
);

// ASK query
const exists = store.query(
  'ASK { ?s <http://schema.org/name> ?name }'
);

// CONSTRUCT query
const constructed = store.query(
  'CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o FILTER (?p = <http://schema.org/name>) }'
);

Loading RDF Data

const turtle = `
  @prefix ex: <http://example.com/> .
  @prefix schema: <http://schema.org/> .

  ex:person1 schema:name "Person 1" ;
             schema:age 30 .
`;

store.load(turtle, {
  format: 'text/turtle',
  base_iri: 'http://example.com/',
});

Exporting RDF Data

// Export as Turtle
const turtle = store.dump({
  format: 'text/turtle',
});

// Export as N-Quads
const nquads = store.dump({
  format: 'application/n-quads',
});

API Reference

createStore(quads?)

Creates a new Oxigraph store.

Parameters:

  • quads (Array, optional): Initial quads to populate the store

Returns: OxigraphStore instance

OxigraphStore

add(quad)

Adds a quad to the store.

delete(quad)

Removes a quad from the store.

has(quad)

Checks if a quad exists in the store.

match(subject?, predicate?, object?, graph?)

Returns all quads matching the given pattern.

query(sparqlQuery, options?)

Executes a SPARQL query. Returns results based on query type:

  • SELECT: Array of bindings
  • ASK: Boolean
  • CONSTRUCT/DESCRIBE: Array of quads

update(sparqlUpdateQuery, options?)

Executes a SPARQL UPDATE query.

load(data, options)

Loads RDF data into the store.

Options:

  • format (required): RDF format ('text/turtle', 'application/n-quads', etc.)
  • baseIri: Base IRI for relative IRIs
  • toNamedGraph: Graph to load into

dump(options)

Exports store contents in specified format.

Options:

  • format (required): RDF format
  • fromNamedGraph: Graph to export from

size()

Returns the number of quads in the store.

clear()

Removes all quads from the store.

Benchmarking

Run the benchmark suite to compare performance:

pnpm test:bench

The benchmark suite includes:

  • Add Operations: Triple insertion throughput
  • SELECT Queries: Query execution performance
  • ASK Queries: Existence check performance
  • CONSTRUCT Queries: Graph construction performance
  • Pattern Matching: Triple pattern matching throughput
  • Delete Operations: Triple deletion throughput
  • Bulk Load: RDF data loading performance
  • Dump Operations: RDF data export performance

Supported RDF Formats

  • Turtle (text/turtle, ttl)
  • TriG (application/trig, trig)
  • N-Triples (application/n-triples, nt)
  • N-Quads (application/n-quads, nq)
  • JSON-LD (application/ld+json, jsonld)
  • RDF/XML (application/rdf+xml, rdf)

Performance Notes

  • Oxigraph is highly optimized for SPARQL query execution
  • The WASM implementation provides near-native performance
  • Bulk operations benefit from Oxigraph's efficient indexing
  • Memory usage is comparable to native Rust implementation

References

License

MIT