Uni¶
The Embedded Multi-Model Graph Database¶
Uni is a high-performance, embedded database that unifies graph, vector, document, and columnar workloads in a single engine. Built in Rust for speed and safety, Uni delivers sub-millisecond graph traversals, semantic vector search, and analytical queries—all without the operational complexity of distributed systems.
Why Uni?¶
Modern applications need more than one data model. Knowledge graphs require relationships. AI features need vector similarity. Analytics demand columnar scans. Traditional approaches force you to glue together multiple databases, managing synchronization, consistency, and operational overhead.
Uni solves this by design:
| Capability | Description |
|---|---|
| Graph Traversals | Navigate billions of edges with O(1) adjacency lookups via CSR-cached topology |
| Vector Search | Sub-2ms approximate nearest neighbor queries powered by Lance's HNSW indexes |
| Document Storage | Store and query nested JSON with path-based indexing |
| Columnar Analytics | DataFusion-powered aggregations with predicate pushdown to storage |
| OpenCypher Queries | Familiar graph query syntax with vectorized execution |
Key Features¶
Embedded & Serverless¶
Uni runs as a library in your process—no separate server, no network hops, no operational burden. Import it as a crate and start querying.
Cloud-Native Storage¶
Persist directly to S3, GCS, or Azure Blob Storage. Local caching ensures fast reads while object stores provide infinite scale.
Vectorized Execution¶
Queries process data in columnar batches using Apache Arrow, achieving 100-500x speedup over row-at-a-time execution.
Single-Writer Simplicity¶
No complex distributed consensus. One writer, multiple readers, snapshot isolation. Perfect for embedded scenarios.
Quick Example¶
use uni::prelude::*;
let db = UniDatabase::open("./my-graph")?;
let results = db.query("
MATCH (user:User)-[:PURCHASED]->(product:Product)
WHERE vector_similarity(user.embedding, $query) > 0.85
RETURN product.name, COUNT(*) as purchases
ORDER BY purchases DESC
LIMIT 10
")?;
Architecture Overview¶
Uni's layered architecture separates concerns for maximum performance and flexibility:
┌─────────────────────────────────────────────────────────────┐
│ Your Application │
├─────────────────────────────────────────────────────────────┤
│ Uni (Embedded Library) │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
│ │ Query Layer │ │ Runtime │ │ Storage Layer │ │
│ │ (Cypher) │→ │ (L0 + CSR) │→ │ (Lance) │ │
│ └─────────────┘ └─────────────┘ └──────────┬──────────┘ │
└─────────────────────────────────────────────────┼────────────┘
│
┌─────────────────────────────┴─────────────────────────────┐
│ Object Store │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ S3 │ │ GCS │ │ Local │ │
│ └──────────┘ └──────────┘ └──────────┘ │
└───────────────────────────────────────────────────────────┘
Learn more about the architecture →
Performance at a Glance¶
| Operation | Latency | Notes |
|---|---|---|
| 1-hop traversal | ~4.7ms | CSR-cached adjacency |
| 3-hop traversal | ~9.0ms | Linear scaling with depth |
| Vector KNN (k=10) | ~1.8ms | Lance HNSW index |
| Point lookup | ~2.9ms | Property by index |
| Batch ingest (1K vertices) | ~550µs | L0 memory buffer |
| Flush to storage | ~6.3ms | L0 → Lance persistence |
Benchmarks on standard cloud VM. See Benchmarks for methodology.
Use Cases¶
Knowledge Graphs & RAG¶
Build retrieval-augmented generation systems with graph-structured knowledge and semantic search.
// Find contextually relevant documents via graph + vector
MATCH (query:Query)-[:SIMILAR_TO]->(doc:Document)
WHERE vector_similarity(query.embedding, doc.embedding) > 0.8
MATCH (doc)-[:REFERENCES]->(source:Source)
RETURN doc.content, source.citation
LIMIT 5
Recommendation Engines¶
Traverse user-item-user paths while filtering by embedding similarity for personalized recommendations.
Fraud Detection¶
Walk transaction graphs to identify suspicious patterns with real-time property filtering.
Scientific Graphs¶
Model citation networks, molecular structures, or biological pathways with vector-enhanced similarity search.
Quick Start¶
Get up and running in under 5 minutes:
# Clone and build
git clone https://github.com/dragonscale/uni.git
cd uni && cargo build --release
# Import sample data
./target/release/uni import semantic-scholar \
--papers demos/demo01/data/papers.jsonl \
--citations demos/demo01/data/citations.jsonl \
--output ./storage
# Run your first query
./target/release/uni query \
"MATCH (p:Paper)-[:CITES]->(cited:Paper)
WHERE p.year > 2020
RETURN cited.title, COUNT(*) as citations
ORDER BY citations DESC
LIMIT 10" \
--path ./storage
Documentation¶
Getting Started¶
- Installation — Build from source, prerequisites, verification
- Quick Start — Your first graph in 5 minutes
- CLI Reference — Complete command documentation
Core Concepts¶
- Architecture — Layered design and component overview
- Data Model — Vertices, edges, properties, and schema
- Identity Model — VID, EID, and UniId explained
- Indexing — Vector, scalar, and full-text indexes
- Concurrency — Single-writer model and snapshots
Developer Guides¶
- Cypher Querying — Complete OpenCypher reference
- Vector Search — Semantic similarity at scale
- Data Ingestion — Bulk import and streaming writes
- Schema Design — Best practices and patterns
- Performance Tuning — Optimization strategies
Use Cases¶
Internals¶
- Vectorized Execution — Batch processing deep dive
- Storage Engine — Lance integration and LSM design
- Query Planning — Planner and optimization
- Benchmarks — Performance metrics and methodology
Reference¶
- Rust API — Programmatic access documentation
- Configuration — All configuration options
- Troubleshooting — Common issues and solutions
- Glossary — Terminology reference
Technology Stack¶
Uni leverages best-in-class Rust ecosystem crates:
| Component | Technology | Purpose |
|---|---|---|
| Storage | Lance | Columnar format with native vector indexes |
| Columnar | Apache Arrow | Zero-copy data representation |
| Analytics | DataFusion | SQL execution and optimization |
| Graph Runtime | gryf | In-memory graph algorithms |
| Object Store | object_store | S3/GCS/Azure abstraction |
| Parsing | sqlparser | SQL/Cypher tokenization |
| Embeddings | FastEmbed | Local embedding models |
Project Status¶
Uni is under active development. Current status:
| Feature | Status |
|---|---|
| Graph storage & traversal | Stable |
| Vector search (HNSW, IVF_PQ) | Stable |
| Graph Algorithms (36 algorithms) | Stable |
| OpenCypher (MATCH, WHERE, RETURN, CREATE) | Stable |
| Aggregations & Window Functions | Stable |
| Scalar Functions (40+ functions) | Stable |
| Predicate pushdown | Stable |
Variable-length paths (*1..3) |
Stable |
| MERGE / SET / DELETE | Stable |
| UNION / UNION ALL | Stable |
| WITH RECURSIVE (CTEs) | Stable |
| EXPLAIN / PROFILE | Stable |
| BACKUP / VACUUM / CHECKPOINT | Stable |
| CRDT properties | Stable |
Session Variables ($session.*) |
Stable |
| Bulk Loading (BulkWriter) | Stable |
| Schema DDL Procedures | Stable |
| Snapshot Readers | Stable |
| Inverted Index (ANY IN) | Stable |
| Temporal Queries (validAt) | Stable |
| Composite Key Constraints | Stable |
| Full-text search | Planned |
| Distributed mode | Future |
See Cypher Querying Guide for detailed feature documentation.
Contributing¶
We welcome contributions! See the Contributing Guide for details.
# Run tests
cargo test
# Run benchmarks
cargo bench
# Check formatting and lints
cargo fmt --check && cargo clippy
License¶
Uni is open source under the Apache 2.0 License.