OxiRS Core
Foundational, Rust-native RDF data model and SPARQL engine for the OxiRS semantic web platform
Status: v0.3.2 - Released 2026-07-11
✨ Production Release: Production-ready with API stability guarantees. Semantic versioning enforced.
Overview
oxirs-core provides the foundational data structures and operations for working with RDF data in Rust. It is the base crate of the OxiRS workspace: every other oxirs-* crate (query engines, servers, storage backends, AI tooling) depends on it, while it depends on none of them — no other OxiRS crate sits underneath it. Originally extracted from OxiGraph's RDF implementation, it has since grown a large surface of its own — SPARQL algebra/execution, persistent storage, federation, indexing, and enterprise compliance tooling — while retaining an OxiGraph-compatible core (oxigraph_compat) for easy migration.
Features
Core RDF Data Model
- Named nodes (IRIs):
NamedNode, RFC 3987-oriented IRI validation - Blank nodes:
BlankNode, scoped identifiers - Literals:
Literal, typed/language-tagged strings with XSD datatype support - Variables:
Variable, SPARQL query variables - Triples/Quads:
Triple/Quad, full RDF 1.2 model with named-graph support - RDF-star: quoted triples / statement reification (
rdf-starfeature, on by default)
SPARQL Foundation
- SPARQL 1.1/1.2 query: SELECT, CONSTRUCT, ASK, DESCRIBE (
query,sparqlmodules — parser, cost-based planner, streaming executor) - SPARQL 1.1 update:
INSERT/DELETE DATA,LOAD,CLEAR - Federation:
SERVICE-clause execution against remote SPARQL endpoints (federation) - Built-in functions: string/numeric/date functions including
ENCODE_FOR_URI(), backed by the newencodingmodule (see below)
Storage & Persistence
RdfStore: primary store type — in-memory (RdfStore::new) or disk-backed (RdfStore::open), with automatic N-Quads-based persistence- Multi-index access: indexed pattern matching (
indexing,storage) - Transactions: ACID transaction manager (
transaction::{AcidTransaction, TransactionManager}) - Named graph management: Jena-
Dataset-compatible API (named_graph) - Jena Assembler: load
ja:-vocabulary Turtle configs, Jenafuseki-config.ttl-style (assembler::from_turtle)
Format Support & Serialization
- Parsers and serializers for Turtle, N-Triples, N-Quads, TriG, RDF/XML, and JSON-LD (
parser,serializer,rdfxml,jsonld) - Async, chunked, progress-reporting streaming parsers —
parser::{AsyncStreamingParser, AsyncRdfSink, MemoryAsyncSink, ParseProgress}andio::async_streaming(behind theasyncfeature)
Performance & Concurrency
- Lock-free structures: epoch-based concurrent graph access (
concurrent) - Arena allocation & zero-copy references:
optimization::RdfArena,TermRef/TripleRef - SIMD-accelerated triple matching: behind the
simdfeature (simd_triple_matching) - SciRS2 integration:
scirs2-coreprovides memory management and parallel iteration (used in place of rawndarray/directrayoncalls) - Benchmark & SLA harness: a Criterion suite under
benches/plusperf_sla::{SloTarget, BenchmarkResult, assert_meets_slo}for regression-gated performance targets, checked against a committedperf_baseline.json
Enterprise & Compliance
- Audit trail: SOC2/GDPR-oriented structured event logging —
audit::{AuditEvent, InMemoryAuditLogger, JsonLineAuditLogger, AuditFilter, GdprService} - W3C RDF Dataset Canonicalization (URDNA2015): deterministic blank-node naming for signing and Verifiable Credentials workflows —
canon::{canonicalize, Canonicalizer}(re-exported at the crate root) - PROV-O provenance tracking:
provenancemodule covering the core W3C PROV-O entities, activities, and agents - API stability tracking: a programmatic public-API surface snapshot (
api_baseline.json), diffed against the live source bytests/api_stability.rsso unintentional breaking changes fail the test suite - Production hardening:
production::{HealthCheck, CircuitBreaker, PerformanceMonitor, ResourceQuota}
New in 0.3.2: the encoding module
A pure-std, in-house RFC 3986 percent-encoding implementation — percent_encode, percent_encode_strict, percent_decode — that replaces the external urlencoding crate workspace-wide. It now backs SPARQL's ENCODE_FOR_URI() function and federated-query URL construction (federation::client).
use ;
let encoded = percent_encode;
assert_eq!;
assert_eq!;
Installation
Add to your Cargo.toml:
[]
= "0.3.2"
# Optional: enable async streaming support
= { = "0.3.2", = ["async"] }
Feature Flags
| Feature | Default | Description |
|---|---|---|
serde |
✅ | Serialization support for core types |
parallel |
✅ | Multi-threaded processing via rayon |
rdf-12 |
✅ | RDF 1.2 data model features |
rdf-star |
✅ | RDF-star (quoted triples) support |
sparql-12 |
✅ | SPARQL 1.2 query features |
async |
– | Async I/O and streaming parsers |
async-tokio |
– | Tokio-backed async streaming (implies async) |
simd |
– | SIMD-accelerated string/term operations (wide) |
cuda / opencl |
– | GPU backend selectors consumed by platform; live GPU telemetry itself lives in the separate oxirs-gpu-monitor adapter crate (ai::gpu_monitor::GpuMonitor here is a Pure-Rust "no GPU" stub with a matching API) |
metal / blas |
– | Reserved for future backend crates; not yet wired to any code path in this crate |
Quick Start
Creating a Store and Adding Data
use RdfStore;
use ;
#
Querying with Pattern Matching
use RdfStore;
use ;
#
Executing SPARQL Queries
use RdfStore;
#
Persistent Storage
use RdfStore;
use ;
#
Named Graphs (Quads)
use RdfStore;
use ;
#
Bulk Loading
use RdfStore;
use ;
#
More runnable examples live under examples/, including indexed_graph_demo.rs, concurrent_graph_demo.rs, async_streaming.rs, mmap_store_example.rs, sparql_algebra_demo.rs, query_result_cache_demo.rs, and zero_copy_serialization.rs.
Architecture
Core Type System
Term: unified enum over all RDF termsNamedNode/BlankNode/Literal/Variable: the four term kindsTriple/Quad: subject-predicate-object(-graph) statementsSubject/Predicate/Object: position-typed term enums used in pattern matchingTermRef<'a>/TripleRef<'a>: zero-copy borrowed views (optimizationmodule)
Module Organization
| Module | Purpose |
|---|---|
model |
Core RDF data model types (IRI, literal, blank node, triple, quad) |
rdf_store |
RdfStore and the Store trait — pluggable storage backends |
parser / serializer / rdfxml / jsonld |
RDF parsers and serializers for all supported formats |
query / sparql |
SPARQL algebra, parser, planner, and executor |
storage / indexing |
Storage engine and multi-index structures |
concurrent |
Lock-free, epoch-based concurrent graph access |
optimization |
Arena allocation and zero-copy term references |
federation |
SERVICE-clause distributed query execution |
production |
Health checks, circuit breakers, performance monitoring |
transaction |
ACID transaction manager |
named_graph |
Jena-Dataset-compatible named graph API |
assembler |
Jena Assembler (ja: vocabulary) config loading |
audit |
SOC2/GDPR structured audit trail |
canon |
W3C RDF Dataset Canonicalization (URDNA2015) |
provenance |
W3C PROV-O provenance tracking |
encoding |
RFC 3986 percent-encoding (new in 0.3.2) |
oxigraph_compat |
Drop-in-compatible Store API matching Oxigraph |
A handful of modules (consciousness, molecular, quantum) are experimental research surfaces, present in the crate but explicitly outside the API stability guarantees below.
Error Handling
All fallible operations return oxirs_core::Result<T> (an alias for std::result::Result<T, OxirsError>):
use ;
API Stability
- Stable: core RDF model types (
NamedNode,Literal,Triple,Quad),RdfStoreoperations (insert/query/remove), parser/serializer interfaces - Unstable: advanced query-optimization internals (may change without a major version bump)
- Experimental:
consciousness,molecular, andquantummodules
Ecosystem Integration
OxiGraph Compatibility
oxigraph_compat::Store mirrors oxigraph::Store's API — including its interior-mutability semantics, where mutating methods take &self — so migrating existing OxiGraph code is mostly a matter of changing imports:
// Before (with OxiGraph)
use ;
// After (with oxirs-core)
use ;
use Store;
OxiRS Platform Components
Every other crate in the workspace builds on oxirs-core:
oxirs-arq— SPARQL 1.1/1.2 query engine with cost-based optimizationoxirs-shacl— SHACL shape validationoxirs-fuseki— SPARQL HTTP serveroxirs-gql— GraphQL interfaceoxirs-chat— AI-powered natural-language-to-SPARQLoxirs-embed— knowledge graph embeddingsoxirs-cluster— distributed storage with consensusoxirs-tdb— persistent triple database with ACID transactions
Development
Running Tests
# Current status: 2589 tests passing
Benchmarks
# Criterion suite: indexed_graph, concurrent_graph, parallel_batch, rdf, query_visualization, sla_suite
# SLA regression checks (release-only; compares against perf_baseline.json)
Documentation
Contributing
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass (
cargo nextest run --all-features) with zeroclippywarnings - Submit a pull request
See CONTRIBUTING.md for full guidelines.
License
Licensed under the Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0).
Status
🚀 Production Release (v0.3.2) — 2,589 tests passing, zero clippy warnings, zero rustdoc errors.
Current Highlights
- RDF/SPARQL core: RDF 1.2 data model, SPARQL 1.1/1.2 query and update, federation via
SERVICE - Persistence:
RdfStore::openwith N-Quads-backed durability - Pure-Rust TLS: a
#[ctor::ctor]constructor installs OxiTLS's Pure RustrustlsCryptoProvideras the process default for every binary and test process that links this crate, so noring/aws-lc-sysis required at runtime - Compliance tooling: SOC2/GDPR audit trail (
audit), URDNA2015 canonicalization (canon), PROV-O provenance (provenance) - API stability enforcement:
api_baseline.jsonplustests/api_stability.rsguard the public surface against accidental breaking changes
Part of the OxiRS semantic web platform.