Skip to main content

Crate sqlite_graph

Crate sqlite_graph 

Source
Expand description

§sqlite-graph

An embeddable graph database built entirely on SQLite.

  • Recursive CTE traversal — multi-hop graph walks in a single SQL statement
  • Bi-temporal edges — facts have valid time (real-world) and recorded time (system)
  • FTS5 full-text search — across episodes, entities, and edges
  • Hybrid search — FTS5 + vector cosine similarity fused with Reciprocal Rank Fusion
  • Entity deduplication — Jaro-Winkler fuzzy matching with alias resolution
  • Single file — no Docker, no JVM, no network hop

§Quick start

use sqlite_graph::{Graph, Episode, Entity, Edge};

let graph = Graph::in_memory().unwrap();

// Add an episode (an event, decision, or message)
let ep = Episode::builder("Team decided to use Postgres for billing")
    .source("standup")
    .build();
graph.add_episode(ep).unwrap();

// Add entities and edges manually
let pg = Entity::new("PostgreSQL", "technology");
let billing = Entity::new("Billing Service", "component");
graph.add_entity(pg.clone()).unwrap();
graph.add_entity(billing.clone()).unwrap();

let edge = Edge::new(&pg.id, &billing.id, "used_by");
graph.add_edge(edge).unwrap();

// Traverse the graph
let (entities, edges) = graph.traverse(&pg.id, 2).unwrap();
assert_eq!(entities.len(), 2);

Structs§

Edge
An edge is a relationship between two entities. Edges are bi-temporal: valid_from/valid_until (real-world) + recorded_at (system).
Entity
An entity is a node in the graph — people, components, decisions, etc.
EntityContext
Context around an entity — its immediate neighbors and edges.
Episode
An episode is the fundamental unit of information. It represents “something happened” — a decision, conversation, event.
EpisodeBuilder
Builder for constructing episodes with a fluent API.
EpisodeResult
Result from adding an episode to the graph.
FusedEpisodeResult
Per-episode result from fused (RRF) search.
Graph
An embeddable graph database built on SQLite.
GraphStats
Graph-wide statistics.

Enums§

Error

Type Aliases§

Result