sqlite_graph/lib.rs
1//! # sqlite-graph
2//!
3//! An embeddable graph database built entirely on SQLite.
4//!
5//! - **Recursive CTE traversal** — multi-hop graph walks in a single SQL statement
6//! - **Bi-temporal edges** — facts have valid time (real-world) and recorded time (system)
7//! - **FTS5 full-text search** — across episodes, entities, and edges
8//! - **Hybrid search** — FTS5 + vector cosine similarity fused with Reciprocal Rank Fusion
9//! - **Entity deduplication** — Jaro-Winkler fuzzy matching with alias resolution
10//! - **Single file** — no Docker, no JVM, no network hop
11//!
12//! ## Quick start
13//!
14//! ```rust
15//! use sqlite_graph::{Graph, Episode, Entity, Edge};
16//!
17//! let graph = Graph::in_memory().unwrap();
18//!
19//! // Add an episode (an event, decision, or message)
20//! let ep = Episode::builder("Team decided to use Postgres for billing")
21//! .source("standup")
22//! .build();
23//! graph.add_episode(ep).unwrap();
24//!
25//! // Add entities and edges manually
26//! let pg = Entity::new("PostgreSQL", "technology");
27//! let billing = Entity::new("Billing Service", "component");
28//! graph.add_entity(pg.clone()).unwrap();
29//! graph.add_entity(billing.clone()).unwrap();
30//!
31//! let edge = Edge::new(&pg.id, &billing.id, "used_by");
32//! graph.add_edge(edge).unwrap();
33//!
34//! // Traverse the graph
35//! let (entities, edges) = graph.traverse(&pg.id, 2).unwrap();
36//! assert_eq!(entities.len(), 2);
37//! ```
38
39mod error;
40mod graph;
41mod storage;
42mod types;
43
44pub use error::{Error, Result};
45pub use graph::Graph;
46pub use types::*;