1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//! Public API for AletheiaDB.
//!
//! This module contains the primary interfaces for interacting with the database,
//! organizing the "Hero's Journey" for developers building applications.
//!
//! # Overview
//!
//! AletheiaDB's API is designed around three core pillars:
//!
//! 1. **Transactions** ([`transaction`]): All interactions (read or write) happen within
//! ACID-compliant transactions.
//! 2. **Hybrid Querying** ([`crate::query`]): A unified engine for Graph, Vector, and
//! Temporal queries.
//! 3. **Vector Search** ([`crate::db::vector_builder`]): Fluent configuration for embedding-based
//! similarity search.
//!
//! # Quick Start
//!
//! ## 1. Initialize the Database
//!
//! ```rust,no_run
//! use aletheiadb::AletheiaDB;
//!
//! // Create a new database (defaults to in-memory for testing)
//! let db = AletheiaDB::new().expect("Failed to initialize database");
//! ```
//!
//! ## 2. Write Data (ACID Transaction)
//!
//! ```rust,no_run
//! # use aletheiadb::{AletheiaDB, PropertyMapBuilder};
//! # let db = AletheiaDB::new().unwrap();
//! use aletheiadb::api::transaction::WriteOps;
//!
//! // Write transaction (auto-commits on Ok)
//! let alice_id = db.write(|tx| {
//! tx.create_node(
//! "Person",
//! PropertyMapBuilder::new()
//! .insert("name", "Alice")
//! .insert("role", "Engineer")
//! .build()
//! )
//! }).expect("Transaction failed");
//! ```
//!
//! ## 3. Query Data (Hybrid)
//!
//! ```rust,no_run
//! # use aletheiadb::{AletheiaDB, PropertyMapBuilder};
//! # use aletheiadb::api::transaction::WriteOps;
//! # let db = AletheiaDB::new().unwrap();
//! # let alice_id = db.write(|tx| tx.create_node("Person", PropertyMapBuilder::new().build())).unwrap();
//! // Find nodes connected to Alice
//! let results = db.query()
//! .start(alice_id)
//! .traverse("KNOWS")
//! .execute(&db)
//! .expect("Query failed");
//! ```
//!
//! # Key Concepts
//!
//! ## Bi-Temporality
//! Every fact in AletheiaDB tracks two dimensions of time:
//! - **Valid Time**: When the fact was true in the real world.
//! - **Transaction Time**: When the fact was recorded in the database.
//!
//! Use [`QueryBuilder::as_of`](crate::query::QueryBuilder::as_of) to travel through time.
//!
//! ## Vector Search
//! Attach embeddings to any node property and index them for similarity search.
//!
//! ```rust,no_run
//! # use aletheiadb::AletheiaDB;
//! # use aletheiadb::index::vector::{HnswConfig, DistanceMetric};
//! # let db = AletheiaDB::new().unwrap();
//! // Enable vector index on "embedding" property
//! db.vector_index("embedding")
//! .hnsw(HnswConfig::new(384, DistanceMetric::Cosine))
//! .enable()
//! .expect("Failed to enable index");
//! ```
//!
//! # Module Map
//!
//! - **[`transaction`]**: Core ACID transaction types ([`ReadTransaction`], [`WriteTransaction`]).
//! - **[`crate::db::vector_builder`]**: Fluent builder for configuring vector indexes.
//! - **[`crate::db`]**: The main [`AletheiaDB`](crate::AletheiaDB) struct and entry point.
//! - **[`crate::query`]**: The fluent query builder API.
// Re-export commonly used types
pub use ;