Skip to main content

Crate aingle_graph

Crate aingle_graph 

Source
Expand description

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()?;

§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"

Re-exports§

pub use error::Error;
pub use error::Result;
pub use index::IndexType;
pub use index::TripleIndex;
pub use node::NodeId;
pub use predicate::Predicate;
pub use query::QueryBuilder;
pub use query::QueryResult;
pub use query::TriplePattern;
pub use store::GraphStore;
pub use triple::Triple;
pub use triple::TripleBuilder;
pub use triple::TripleId;
pub use triple::TripleMeta;
pub use value::Value;
pub use backends::sled::SledBackend;
pub use backends::memory::MemoryBackend;

Modules§

backends
Storage backends for the graph database
error
Error types for AIngle Graph.
index
Triple indexes for efficient querying
node
Node identifiers for graph subjects and objects.
predicate
Predicates for semantic relationships.
query
Query engine for the graph database.
store
The core graph storage engine.
triple
Semantic triples, the core data structure of the graph.
value
Defines the Value type for the object of a semantic triple.

Structs§

GraphDB
The main entry point for interacting with a semantic graph database.
GraphStats
Provides statistics about the contents and size of the graph.

Constants§

VERSION
Version information