Skip to main content

Crate sqlite_knowledge_graph

Crate sqlite_knowledge_graph 

Source
Expand description

SQLite-based Knowledge Graph Library

This library provides a knowledge graph implementation built on SQLite with support for:

  • Entities with typed properties
  • Relations between entities with weights
  • Vector embeddings for semantic search
  • Custom SQLite functions for direct SQL operations
  • RAG (Retrieval-Augmented Generation) query functions
  • Graph algorithms (PageRank, Louvain, Connected Components)

§SQLite Extension

This crate can be compiled as a SQLite loadable extension:

cargo build --release
sqlite3 db.db ".load ./target/release/libsqlite_knowledge_graph.dylib"
sqlite3 db.db "SELECT kg_version();"

Re-exports§

pub use algorithms::analyze_graph;
pub use algorithms::connected_components;
pub use algorithms::louvain_communities;
pub use algorithms::pagerank;
pub use algorithms::CommunityResult;
pub use algorithms::PageRankConfig;
pub use embed::check_dependencies;
pub use embed::get_entities_needing_embedding;
pub use embed::EmbeddingConfig;
pub use embed::EmbeddingGenerator;
pub use embed::EmbeddingStats;
pub use error::Error;
pub use error::Result;
pub use export::D3ExportGraph;
pub use export::D3ExportMetadata;
pub use export::D3Node;
pub use export::DotConfig;
pub use extension::sqlite3_sqlite_knowledge_graph_init;
pub use functions::register_functions;
pub use graph::Direction;
pub use graph::GraphStats;
pub use graph::PathStep;
pub use graph::TraversalNode;
pub use graph::TraversalPath;
pub use graph::TraversalQuery;
pub use graph::Entity;
pub use graph::Neighbor;
pub use graph::Relation;
pub use graph::HigherOrderNeighbor;
pub use graph::HigherOrderPath;
pub use graph::HigherOrderPathStep;
pub use graph::Hyperedge;
pub use migrate::build_relationships;
pub use migrate::migrate_all;
pub use migrate::migrate_papers;
pub use migrate::migrate_skills;
pub use migrate::MigrationStats;
pub use rag::embedder::Embedder;
pub use rag::embedder::FixedEmbedder;
pub use rag::RagConfig;
pub use rag::RagEngine;
pub use rag::RagResult;
pub use schema::create_schema;
pub use schema::schema_exists;
pub use vector::cosine_similarity;
pub use vector::SearchResult;
pub use vector::VectorStore;
pub use vector::TurboQuantConfig;
pub use vector::TurboQuantIndex;
pub use vector::TurboQuantStats;

Modules§

algorithms
embed
Vector embedding generation module for semantic search.
error
Error types for sqlite-knowledge-graph.
export
Graph visualization export module.
extension
SQLite extension entry point using sqlite-loadable
functions
SQLite custom functions for knowledge graph operations.
graph
Graph module for entity and relation storage.
migrate
Data migration module for importing external knowledge sources.
rag
Paper-driven two-stage RAG engine.
schema
Database schema creation and management.
vector
Vector module for semantic search with cosine similarity and TurboQuant indexing.

Structs§

GraphContext
Graph context for an entity (root + neighbors).
HybridSearchResult
Hybrid search result combining semantic similarity and graph context.
KnowledgeGraph
Knowledge Graph Manager - main entry point for the library.
SearchResultWithEntity
Semantic search result with entity information.