Crate oxigraph[][src]

Expand description

Oxigraph is a graph database library implementing the SPARQL standard.

Its goal is to provide a compliant, safe and fast graph database. It also provides a set of utility functions for reading, writing, and processing RDF files.

It currently provides three store implementations providing SPARQL capability:

  • MemoryStore: a simple in memory implementation.
  • RocksDbStore: a file system implementation based on the RocksDB key-value store. It requires the "rocksdb" feature to be activated. The clang compiler needs to be installed to compile RocksDB.
  • SledStore: another file system implementation based on the Sled key-value store. It requires the "sled" feature to be activated. Sled is much faster to build than RockDB and does not require a C++ compiler. However, Sled is still in developpment, less tested and data load seems much slower than RocksDB.

Oxigraph is in heavy development and SPARQL query evaluation has not been optimized yet.

The disabled by default "sophia" feature provides sophia_api traits implemention on Oxigraph terms and stores.

Oxigraph also provides a standalone HTTP server based on this library.

Usage example with the MemoryStore:

use oxigraph::MemoryStore;
use oxigraph::model::*;
use oxigraph::sparql::QueryResults;

let store = MemoryStore::new();

// insertion
let ex = NamedNode::new("http://example.com")?;
let quad = Quad::new(ex.clone(), ex.clone(), ex.clone(), None);
store.insert(quad.clone());

// quad filter
let results: Vec<Quad> = store.quads_for_pattern(Some(ex.as_ref().into()), None, None, None).collect();
assert_eq!(vec![quad], results);

// SPARQL query
if let QueryResults::Solutions(mut solutions) =  store.query("SELECT ?s WHERE { ?s ?p ?o }")? {
    assert_eq!(solutions.next().unwrap()?.get("s"), Some(&ex.into()));
}

Re-exports

pub use crate::store::memory::MemoryStore;
pub use crate::store::rocksdb::RocksDbStore;
pub use crate::store::sled::SledStore;

Modules

Utilities to read and write RDF graphs and datasets

Implements data structures for RDF 1.1 Concepts.

SPARQL implementation.

RDF RDF dataset storage implementations.