Expand description

In-memory implementations of RDF graphs.

This module provides building blocks for defining implementations of Graph and MutableGraph, with fine-tuned trade-offs between memory footprint and performance.

It also provides two pre-defined trade-offs: FastGraph and LightGraph, provided in different flavors (default, small, sync.

Customized trade-off

By combining a given core implementation with various wrappers, you can easily make a Graph type with the exact trade-offs that you need.

For example, if one needs a small graph (less than 2^16 terms), that can be exchanged across threads, and whose arcs will mostly be traversed backward (from object to subject), an appropriate type definition would be:

use sophia_term::factory::ArcTermFactory;
use sophia_inmem::graph::*;

type MyGraph = OpsWrapper<GenericGraph<u16, ArcTermFactory>>;
let g = MyGraph::new();

Modules

Flavors of Graph implementations with a smaller memory-footprint.

Flavors of Graph implementations which are safe to share across threads.

Structs

A generic implementation of Graph and MutableGraph, storing its terms in a TermIndexMap, and its triples in a HashSet.

A GraphWrapper indexing triples by object, then by predicate, then by subject.

A GraphWrapper indexing triples by subject, then by predicate, then by object.

An in-memory implementation of TermIndexMap with unsigned integers as indices.

Traits

A graph wrapper wraps a Graph and overrides some of its methods.

An indexed graph wrapper wraps an IndexedGraph and augments some of its methods, through hooks of the forme before_x and after_x.

This trait is used by TermIndexMapU as an abstraction of all unsigned int types.

Type Definitions

A heavily indexed graph. Fast to query but slow to load, with a relatively high memory footprint.

Type alias for results produced by a graph.

Type alias for the terms returned by a graph.

Type alias for fallible triple iterators produced by a graph.

A generic in-memory graph.

A graph with no triple index. Fast to load but slow to query, with a relatively low memory footprint.