8000 Sync documentation and fixes after Phase 3 merge by adityamukho · Pull Request #6 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
15b03ec
Pivot documentation from GQL to Datalog
adityamukho Jan 13, 2026
2d26304
Removed mention of GQL (no more relevant).
adityamukho Jan 13, 2026
90521a6
Removed mention of GQL (no more relevant).
adityamukho Jan 13, 2026
4736656
Implement EAV data model for Datalog (Phase 3.1)
adityamukho Jan 13, 2026
f550dbd
Use timestamp-based transaction IDs (millisecond precision)
adityamukho Jan 13, 2026
37bee28
Merge main into devel (Phase 3: Datalog Core)
adityamukho Jan 13, 2026
ad96e7d
Update demo commands to showcase Datalog syntax (Phase 3)
adityamukho Jan 13, 2026
065fc18
Remove GQL backward compatibility from REPL
adityamukho Jan 13, 2026
a98805f
Complete removal of GQL implementation in favor of Datalog
adityamukho Jan 13, 2026
c916bd5
Fix keyword entity matching in Datalog queries
adityamukho Jan 13, 2026
b3a1c22
Add CLI argument for file-based persistent storage
adityamukho Jan 13, 2026
7029700
Replace bincode with postcard for serialization
adityamukho Jan 13, 2026
6e0840c
Removed PI-like constants to keep linter from whining.
adityamukho Jan 13, 2026
174c39b
Ignore comments, accept multi-line inputs.
adityamukho Jan 13, 2026
34deda4
Update demo commands to showcase Datalog syntax (Phase 3)
adityamukho Jan 13, 2026
ccb2d87
Remove GQL backward compatibility from REPL
adityamukho Jan 13, 2026
a702185
Complete removal of GQL implementation in favor of Datalog
adityamukho Jan 13, 2026
0574af3
Fix keyword entity matching in Datalog queries
adityamukho Jan 13, 2026
98d7223
Add CLI argument for file-based persistent storage
adityamukho Jan 13, 2026
2a54b83
Replace bincode with postcard for serialization
adityamukho Jan 13, 2026
40ee467
Removed PI-like constants to keep linter from whining.
adityamukho Jan 13, 2026
99ad0c8
Ignore comments, accept multi-line inputs.
adityamukho Jan 13, 2026
bb55e6c
Merge remote-tracking branch 'origin/devel' into devel
adityamukho Jan 13, 2026
83858fd
Update description.
adityamukho Jan 13, 2026
ea7461e
Added comma to punctuate long list.
adityamukho Jan 13, 2026
54a8116
Documented design choice to load DB in-memory even with persistent st…
adityamukho Jan 13, 2026
11257e3
Update to reflect test current coverage status.
adityamukho Jan 13, 2026
623d6f6
Complete Phase 3: Datalog with recursive rules and comprehensive testing
adityamukho Jan 13, 2026
27fe557
Remove scan-pr job from OSV-Scanner workflow
adityamukho Jan 13, 2026
671d7ac
Revert "Remove scan-pr job from OSV-Scanner workflow"
adityamukho Jan 13, 2026
3266370
Update OSV-Scanner action to v2.3.1 to fix deprecated upload-artifact
adityamukho Jan 13, 2026
9f50ebb
Add actions:read permission for OSV-Scanner v2.3.1
adityamukho Jan 13, 2026
4920c82
Merge branch 'main' into devel
adityamukho Jan 13, 2026
9ec2926
Use or_default() instead of or_insert_with(Vec::new)
adityamukho Jan 13, 2026
9af75e0
Sync documentation with Phase 3 completion
adityamukho Jan 13, 2026
cefd9c7
Merge branch 'main' into devel
adityamukho Jan 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions PHILOSOPHY.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,8 @@ The `.graph` file format must be:
- Single-file storage, persistent graph database, embedded API
- GQL-inspired PoC (archived at `archive/gql-phase-2`)

**Phase 3**: 🎯 Datalog Core (NEXT - 3-4 months)
- EAV data model, basic facts and queries, recursive rules
**Phase 3**: ✅ Datalog Core (COMPLETE)
- EAV data model, basic facts and queries, recursive rules, semi-naive evaluation

**Phase 4**: 🎯 Bi-temporal Support (3-4 months)
- Transaction time + valid time, time travel queries, history
Expand Down
65 changes: 38 additions & 27 deletions README.md
7438
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Clippy Status](https://github.com/adityamukho/minigraf/actions/workflows/rust-clippy.yml/badge.svg)](https://github.com/adityamukho/minigraf/actions/workflows/rust-clippy.yml)
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL_2.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)
[![Rust Edition](https://img.shields.io/badge/rust-2024-orange.svg)](https://blog.rust-lang.org/2024/10/17/Rust-1.82.0.html)
[![Phase](https://img.shields.io/badge/phase-2%20complete-blue.svg)](https://github.com/adityamukho/minigraf/blob/main/ROADMAP.md)
[![Phase](https://img.shields.io/badge/phase-3%20complete-blue.svg)](https://github.com/adityamukho/minigraf/blob/main/ROADMAP.md)

> **The SQLite of bi-temporal graph databases** - Emb 10BC8 edded Datalog engine written in Rust

Expand All @@ -18,7 +18,7 @@ Minigraf is a **single-file embedded graph database** that lets you:
- ✅ **Embed anywhere** - Native, WASM, mobile, IoT - one `.graph` file
- ✅ **Zero configuration** - Just `Minigraf::open("data.graph")` and you're done

**Status**: Early development. Phase 2 complete (persistent storage). Now pivoting from GQL to Datalog for better temporal semantics.
**Status**: Early development. Phase 3 complete (Datalog with recursive rules). Now starting Phase 4 (bi-temporal support).

## Why Datalog?

Expand All @@ -30,23 +30,25 @@ Minigraf is a **single-file embedded graph database** that lets you:
4. **Proven at scale** - 40+ years of research, production use (Datomic, XTDB)
5. **Graph-native** - Facts (Entity-Attribute-Value) are literally edges

## Current Status - Phase 2
## Current Status - Phase 3 Complete

Minigraf has **persistent storage foundation** ready for Datalog:
Minigraf has **working Datalog query engine with recursive rules**:

- ✅ **EAV data model** - Entity-Attribute-Value facts with transaction IDs
- ✅ **Datalog queries** - Pattern matching with variable unification
- ✅ **Recursive rules** - Semi-naive evaluation, transitive closure
- ✅ **Single `.graph` file** - Page-based storage (4KB pages)
- ✅ **Embedded database API** - Use like SQLite (`Minigraf::open()`)
- ✅ **Cross-platform** - Works on Linux, macOS, Windows, iOS, Android
- ✅ **Auto-persistence** - Changes auto-save when database is dropped
- ✅ **Storage abstraction** - File, Memory backends (IndexedDB future)
- ✅ **54 tests passing** - Comprehensive test coverage
- 🎯 **Query language** - Transitioning from GQL to Datalog (Phase 3)
- ✅ **123 tests passing** - Comprehensive test coverage
- 🎯 **Next: Bi-temporal support** - Transaction time + valid time (Phase 4)

**GQL Archive**: Previous GQL implementation preserved at `archive/gql-phase-2` branch and `gql-phase-2-complete` tag.

## Quick Start (Future API)
## Quick Start

### Embedded Datalog Database
### Embedded Datalog Database (Working!)

```rust
use minigraf::Minigraf;
Expand Down Expand Up @@ -75,20 +77,23 @@ let past_db = db.as_of(tx_100);
let old_results = past_db.query(...)?;
```

### Interactive Console (Current - In-memory)
### Interactive Console (Datalog REPL)

```bash
# Build and run the REPL (currently supports basic graph operations)
# Build and run the Datalog REPL
cargo run

# Run tests
cargo test

# Try the recursive rules demo
cargo run < demo_recursive.txt

# Run examples
cargo run --example embedded
```

## Datalog Query Language (Planned - Phase 3)
## Datalog Query Language (Phase 3 - Working!)

### Basic Facts

Expand Down Expand Up @@ -210,10 +215,10 @@ The `.graph` file uses a page-based format (like SQLite):

**Phase 1**: ✅ Property graph PoC (Complete)
**Phase 2**: ✅ Persistent storage (Complete)
**Phase 3**: 🎯 Datalog core (3-4 months)
- Basic facts and queries
- Recursive rules
- Pattern matching
**Phase 3**: ✅ Datalog core (Complete)
- ✅ Basic facts and queries
- ✅ Recursive rules
- ✅ Pattern matching

**Phase 4**: 🎯 Bi-temporal support (3-4 months)
- Valid time + transaction time
Expand Down Expand Up @@ -305,17 +310,23 @@ Comprehensive test coverage:
cargo test
```

Current tests (54 total):
- Property graph operations (Phase 1-2 foundation)
- Storage backend operations
- Persistence and recovery
- Concurrency and edge cases

Future tests (Phase 3+):
- Datalog parser
- Recursive rule evaluation
- Bi-temporal queries
- Transaction isolation
Current tests (123 total):
- ✅ **94 unit tests** - Core Datalog, EAV model, parser, matcher, executor
- ✅ **26 integration tests** - Complex queries, recursive rules, concurrency
- ✅ **3 doc tests** - Inline documentation examples

**Phase 3 Coverage** (Complete):
- ✅ Datalog parser (EDN syntax)
- ✅ Recursive rule evaluation (semi-naive)
- ✅ Transitive closure queries
- ✅ Pattern matching and unification
- ✅ Storage backend operations
- ✅ Concurrency and thread safety

**Future tests** (Phase 4+):
- ⏳ Bi-temporal queries (:as-of, :valid-at)
- ⏳ Transaction isolation (ACID)
- ⏳ Crash recovery (WAL)

## Comparison to Similar Projects

Expand Down
130 changes: 72 additions & 58 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,23 @@

---

## Phase 3: Datalog Core 🎯 NEXT
## Phase 3: Datalog Core ✅ COMPLETE

**Goal**: Implement core Datalog query engine

**Status**: 🎯 In Progress (Expected: 3-4 months)
**Status**: ✅ Completed (January 2026)

**Priority**: 🔴 Critical - Foundation for everything else

### 3.1 EAV Data Model
### 3.1 EAV Data Model ✅

**Features**:
- 🎯 Migrate from property graph to Entity-Attribute-Value model
- 🎯 Fact representation: `(Entity, Attribute, Value)`
- 🎯 Entities as UUIDs (keep existing ID system)
- 🎯 Attributes as keywords (`:person/name`, `:friend`)
- 🎯 Values: primitives or entity references
- 🎯 Update storage format to support EAV tuples
- ✅ Migrate from property graph to Entity-Attribute-Value model
- ✅ Fact representation: `(Entity, Attribute, Value)`
- ✅ Entities as UUIDs (keep existing ID system)
- ✅ Attributes as keywords (`:person/name`, `:friend`)
- ✅ Values: primitives or entity references
- ✅ Update storage format to support EAV tuples

**Technical Approach**:
```rust
Expand Down Expand Up @@ -100,14 +100,14 @@ enum Value {
- Gradually migrate tests
- Eventually deprecate property graph types

### 3.2 Datalog Parser
### 3.2 Datalog Parser ✅

**Features**:
- 🎯 Parse basic Datalog queries (EDN syntax)
- 🎯 Query structure: `[:find ?vars :where [clauses]]`
- 🎯 Pattern matching: `[?e :attr ?v]`
- 🎯 Variable binding
- 🎯 Constants and entity references
- ✅ Parse basic Datalog queries (EDN syntax)
- ✅ Query structure: `[:find ?vars :where [clauses]]`
- ✅ Pattern matching: `[?e :attr ?v]`
- ✅ Variable binding
- ✅ Constants and entity references

**Example Queries**:
```datalog
Expand Down Expand Up @@ -135,27 +135,27 @@ enum Value {
- Variable extraction
- Pattern recognition

### 3.3 Query Executor (Basic)
### 3.3 Query Executor (Basic) ✅

**Features**:
- 🎯 Pattern matching against fact database
- 🎯 Variable unification
- 🎯 Join multiple patterns
- 🎯 Return results as tuples
- ✅ Pattern matching against fact database
- ✅ Variable unification
- ✅ Join multiple patterns
- ✅ Return results as tuples

**Implementation**:
- Naive evaluation initially (optimize in Phase 6)
- Iterate through facts, unify variables
- Cartesian product + filter (like nested loops)
- Return binding sets

### 3.4 Recursive Rules
### 3.4 Recursive Rules ✅

**Features**:
- 🎯 Define rules: `[(rule-name ?args) [body]]`
- 🎯 Stratified recursion (safe subset)
- 🎯 Rule evaluation via semi-naive evaluation
- 🎯 Transitive closure queries
- ✅ Define rules: `[(rule-name ?args) [body]]`
- ✅ Stratified recursion (safe subset)
- ✅ Rule evaluation via semi-naive evaluation
- ✅ Transitive closure queries

**Example Rules**:
```datalog
Expand All @@ -179,13 +179,13 @@ enum Value {
- Stop when no new facts produced
- Detect cycles, prevent infinite loops

### 3.5 REPL for Datalog
### 3.5 REPL for Datalog ✅

**Features**:
- 🎯 Interactive Datalog console
- 🎯 Transact facts
- 🎯 Query with Datalog
- 🎯 Pretty-print results
- ✅ Interactive Datalog console
- ✅ Transact facts
- ✅ Query with Datalog
- ✅ Pretty-print results

**Commands**:
```clojure
Expand All @@ -206,20 +206,23 @@ enum Value {
(exit)
```

### 3.6 Tests
### 3.6 Tests ✅

**Test Coverage**:
- EAV data model CRUD
- Datalog parser (all query forms)
- Pattern matching
- Variable unification
- Multi-pattern joins
- Recursive rule evaluation
- Transitive closure queries
- ✅ EAV data model CRUD (8 tests)
- ✅ Datalog parser (all query forms) (15 tests)
- ✅ Pattern matching (6 tests)
- ✅ Variable unification (included in matcher tests)
- ✅ Multi-pattern joins (10 integration tests)
- ✅ Recursive rule evaluation (15 tests)
- ✅ Transitive closure queries (9 integration tests)
- ✅ Concurrency (7 integration tests)

**Deliverable**: Working Datalog query engine with recursion
**Total: 123 tests passing** ✅

**Timeline**: 3-4 months
**Deliverable**: ✅ Working Datalog query engine with recursion (Complete!)

**Timeline**: ✅ Completed in ~3 weeks (January 2026)

---

Expand Down Expand Up @@ -588,11 +591,13 @@ tx.commit()?; // or tx.rollback()?

**GQL Archive**: `archive/gql-phase-2` branch, `gql-phase-2-complete` tag

### v0.3.0 - 🎯 Phase 3 (Datalog Core)
- EAV data model
- Datalog queries
- Recursive rules
- Pattern matching
### v0.3.0 - ✅ Phase 3 Complete (Datalog Core)
- ✅ EAV data model
- ✅ Datalog queries
- ✅ Recursive rules
- ✅ Pattern matching
- ✅ Semi-naive evaluation
- ✅ 123 tests passing

### v0.4.0 - 🎯 Phase 4 (Bi-temporal)
- Transaction time
Expand Down Expand Up @@ -663,13 +668,13 @@ When evaluating features, ask:

- ✅ Phase 1: Complete (December 2025)
- ✅ Phase 2: Complete (January 2026)
- 🎯 Phase 3: 3-4 months (Datalog core)
- 🎯 Phase 4: 3-4 months (Bi-temporal)
- ✅ Phase 3: Complete (January 2026) - Datalog core with recursive rules
- 🎯 Phase 4: 3-4 months (Bi-temporal) - **NEXT**
- 🎯 Phase 5: 2-3 months (ACID + WAL)
- 🎯 Phase 6: 2-3 months (Performance)
- 🎯 Phase 7: 3-4 months (Cross-platform)
- 🎯 Phase 8: Ongoing (Ecosystem)
- 🎯 **v1.0.0: 12-15 months** from now (vs. 24-30 months with GQL)
- 🎯 **v1.0.0: 11-14 months** from now (Phase 3 completed faster than expected!)

**Note**: This is a hobby project. Timeline is flexible but realistic.

Expand All @@ -681,21 +686,30 @@ When evaluating features, ask:

## Current Focus

**Right Now**: Planning Phase 3 - Datalog Core
**Right Now**: ✅ Phase 3 Complete! Planning Phase 4 - Bi-temporal Support

**Phase 3 Achievements**:
1. ✅ Designed and implemented EAV data model
2. ✅ Implemented Datalog parser (EDN syntax)
3. ✅ Built query executor with pattern matching
4. ✅ Added recursive rules with semi-naive evaluation
5. ✅ Updated REPL for Datalog with multi-line support
6. ✅ Comprehensive test coverage (123 tests)

**Immediate Next Steps**:
1. Design EAV data model
2. Implement Datalog parser (EDN syntax)
3. Build basic query executor
4. Add recursive rules
5. Update REPL for Datalog
6. Migrate tests
**Immediate Next Steps (Phase 4)**:
1. Add transaction time tracking (tx_id, tx_time)
2. Implement :as-of queries
3. Add valid time dimensions (valid_from, valid_to)
4. Implement :valid-at queries
5. Support bi-temporal queries
6. Test time travel and history features

**Key Decisions Made**:
- ✅ Pivot to Datalog (simpler, better for temporal)
- ✅ Bi-temporal as first-class feature (not afterthought)
- ✅ Keep single-file philosophy
- ✅ Target 12-15 months to v1.0
- ✅ Recursive rules with semi-naive evaluation
- ✅ Target 11-14 months to v1.0 (ahead of schedule!)

See [GitHub Issues](https://github.com/adityamukho/minigraf/issues) for specific tasks.

Expand Down Expand Up @@ -726,4 +740,4 @@ We're not competing with GraphLite anymore. We're creating a new category.

---

Last Updated: Phase 2 Complete, Datalog Pivot (January 2026)
Last Updated: Phase 3 Complete - Datalog with Recursive Rules (January 2026)
0