[][src]Module sophia::graph::inmem

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 flavours (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::graph::inmem::*;

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

Modules

small

Flavours of Graph implementations with a smaller memory-footprint.

sync

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

Structs

HashGraph

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

OpsWrapper

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

SpoWrapper

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

TermIndexMapU

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

Traits

GraphWrapper

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

IndexedGraphWrapper

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

Unsigned

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

Type Definitions

FastGraph

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

GenericGraph

A generic in-memory graph.

LightGraph

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