| Crates.io | oxirs-graphrag |
| lib.rs | oxirs-graphrag |
| version | 0.1.0 |
| created_at | 2025-12-26 15:34:54.105221+00 |
| updated_at | 2026-01-20 22:20:46.64613+00 |
| description | GraphRAG: Hybrid Vector + Graph Retrieval-Augmented Generation for OxiRS |
| homepage | https://github.com/cool-japan/oxirs |
| repository | https://github.com/cool-japan/oxirs |
| max_upload_size | |
| id | 2005869 |
| size | 323,898 |
GraphRAG: Hybrid Vector + Graph Retrieval-Augmented Generation for OxiRS
Microsoft-style GraphRAG implementation combining vector similarity search with knowledge graph topology for enhanced retrieval-augmented generation.
Natural Language Query
↓
Query Embedding (via oxirs-embed)
↓
[Vector KNN Search] + [Keyword BM25 Search]
↓
RRF Fusion → Seed Entities
↓
SPARQL N-hop Expansion → Subgraph (max 500 triples)
↓
Community Detection (Louvain) → Hierarchical Clusters
↓
Context Building → Natural Language + Structured Data
↓
LLM Generation → Answer + Citations
use oxirs_graphrag::{GraphRAGEngine, GraphRAGConfig};
use std::sync::Arc;
let config = GraphRAGConfig {
top_k: 20,
expansion_hops: 2,
enable_communities: true,
..Default::default()
};
let engine = GraphRAGEngine::new(
Arc::new(vec_index),
Arc::new(embedding_model),
Arc::new(sparql_engine),
Arc::new(llm_client),
config,
);
let result = engine.query("What are quantum computing applications?").await?;
println!("Answer: {}", result.generated_text);
pub struct GraphRAGConfig {
pub top_k: usize, // Default: 20
pub expansion_hops: usize, // Default: 2
pub max_subgraph_size: usize, // Default: 500
pub enable_communities: bool, // Default: true
pub vector_weight: f32, // Default: 0.7
pub keyword_weight: f32, // Default: 0.3
}
PREFIX graphrag: <http://oxirs.io/graphrag#>
SELECT ?entity ?similarity WHERE {
?entity graphrag:similarity ("machine learning", 0.8) .
}
SELECT ?related WHERE {
<http://example.org/entity> graphrag:expand(2) ?related .
}
Requires:
oxirs-vec - Vector index (HNSW)oxirs-embed - Embedding models (TransE, GNN, Transformers)oxirs-chat - LLM client integrationoxirs-arq - SPARQL query engineLicensed under either of Apache License, Version 2.0 or MIT license at your option.