Crate simple_triplestore

Source
Expand description

A triplestore implementation which can be used as a flexible graph database with support for custom node and edge properties.

§Data Model

Each vertex and edge (collectively called nodes) are associated with an id (i.e. u64 or Ulid).

Property data is stored as

  • Id -> NodeProps
  • Id -> EdgeProps.

Graph relationships are stored three times as (Id, Id, Id) -> Id with the following sort orders:

  • Subject, Predicate, Object
  • Predicate, Object, Subject
  • Object, Subject, Predicate

This allows for any graph query to be decomposed into a range query on the lookup with the ideal ordering. For example,

  • query!{ a -b-> ? } becomes a query on the subject-predicate-object table.
  • query!{ ? -a-> b } becomes a query on the position-object-subject table.
  • query!{ a -?-> b } becomes a query on the object-subject-position table.

§Supported Key-Value Backends

Re-exports§

pub use crate::id::ulid::UlidIdGenerator;
pub use crate::mem::MemTripleStore;
pub use crate::traits::ExtendError;
pub use crate::traits::IdGenerator;
pub use crate::traits::MergeError;
pub use crate::traits::Mergeable;
pub use crate::traits::QueryError;
pub use crate::traits::SetOpsError;
pub use crate::triple::PropsTriple;
pub use crate::triple::Triple;
pub use crate::sled::SledTripleStore;
pub use crate::sled::SledTripleStoreError;

Modules§

id
mem
prelude
sled
traits
triple

Macros§

query
Syntactic sugar macro for constructing Query objects which can be used in [crate::TripleStoreQuery::run()].

Enums§

EdgeOrder
The order for edges which should be returned.
Query
Represents a query which can be executed on a [TripleStore][crate::TripleStore].