aingle_graph 0.1.0

Native GraphDB for AIngle - Semantic triple store with SPO indexes
Documentation

AIngle Graph - Native Semantic GraphDB

A high-performance triple store designed for the AIngle distributed ledger. Unlike traditional key-value stores, AIngle Graph stores semantic triples (Subject-Predicate-Object) with native indexing for efficient queries.

Architecture

┌─────────────────────────────────────────────────────────────┐
│                     AIngle Graph                             │
├─────────────────────────────────────────────────────────────┤
│                                                              │
│  ┌──────────────────────────────────────────────────────┐   │
│  │                   Query Engine                        │   │
│  │  Pattern Matching │ Traversal │ SPARQL-like queries  │   │
│  └──────────────────────────────────────────────────────┘   │
│                           │                                  │
│  ┌──────────────────────────────────────────────────────┐   │
│  │                   Triple Store                        │   │
│  │  ┌─────────┐  ┌─────────┐  ┌─────────┐              │   │
│  │  │   SPO   │  │   POS   │  │   OSP   │  Indexes     │   │
│  │  └─────────┘  └─────────┘  └─────────┘              │   │
│  └──────────────────────────────────────────────────────┘   │
│                           │                                  │
│  ┌──────────────────────────────────────────────────────┐   │
│  │              Storage Backends                         │   │
│  │  Sled (default) │ RocksDB │ SQLite │ Memory          │   │
│  └──────────────────────────────────────────────────────┘   │
│                                                              │
└─────────────────────────────────────────────────────────────┘

Quick Start

use aingle_graph::{GraphDB, Triple, NodeId, Predicate, Value};

// Create a new graph database
let db = GraphDB::memory()?;

// Insert a triple
let triple = Triple::new(
    NodeId::named("user:alice"),
    Predicate::named("has_title"),
    Value::literal("Doctor"),
);
db.insert(triple)?;

// Query the graph
let results = db.query()
    .subject(NodeId::named("user:alice"))
    .execute()?;
# Ok::<(), aingle_graph::Error>(())

Semantic Triples

A triple represents a fact in the form:

[Subject] --[Predicate]--> [Object]

Example:
[user:alice] --[has_title]--> "Doctor"
[user:alice] --[works_at]--> [org:hospital_xyz]
[org:hospital_xyz] --[located_in]--> "Mexico City"