arrow_graph_core/lib.rs
1//! arrow-graph-core — Arrow-native graph store.
2//!
3//! A foundation crate providing:
4//! - Arrow schemas for triples, embeddings, and metadata
5//! - Configurable namespace partitioning (string-based partition keys)
6//! - Optional layer column for sub-partitioning
7//! - Zero-copy CRUD operations on Arrow RecordBatches
8//! - Causal chain traversal (breadth-first provenance tracking)
9//!
10//! # Quick Start
11//!
12//! ```rust
13//! use arrow_graph_core::store::{ArrowGraphStore, Triple, QuerySpec};
14//!
15//! // Create a store with your own namespace partitions
16//! let mut store = ArrowGraphStore::new(&["world", "code", "self"]);
17//!
18//! let triple = Triple {
19//! subject: "Alice".to_string(),
20//! predicate: "knows".to_string(),
21//! object: "Bob".to_string(),
22//! graph: None,
23//! confidence: Some(0.9),
24//! source_document: None,
25//! source_chunk_id: None,
26//! extracted_by: Some("agent-1".to_string()),
27//! caused_by: None,
28//! derived_from: None,
29//! consolidated_at: None,
30//! };
31//!
32//! let id = store.add_triple(&triple, "world", Some(1)).unwrap();
33//! assert_eq!(store.len(), 1);
34//!
35//! let results = store.query(&QuerySpec {
36//! subject: Some("Alice".to_string()),
37//! ..Default::default()
38//! }).unwrap();
39//! assert_eq!(results.iter().map(|b| b.num_rows()).sum::<usize>(), 1);
40//! ```
41//!
42//! # Three API Levels
43//!
44//! | Level | Type | Use Case |
45//! |-------|------|----------|
46//! | Raw | [`ArrowGraphStore`] | Full control over namespaces and layers |
47//! | Simple | [`SimpleTripleStore`](triple_store::SimpleTripleStore) | Default namespace, simplified API |
48//! | KG | [`KgStore`](kg_store::KgStore) | Prefix management, keyword search, gap tracking |
49//!
50//! Use the [factory](graph_factory) module to create stores by configuration.
51
52pub mod graph_factory;
53pub mod kg_store;
54pub mod schema;
55pub mod store;
56pub mod triple_store;
57
58pub use graph_factory::{
59 CreatedStore, GraphBackend, GraphStoreConfig, available_backends, create_default_store,
60 create_graph_store,
61};
62pub use schema::chunk_col;
63pub use schema::col;
64pub use schema::{
65 CHUNKS_SCHEMA_VERSION, TRIPLES_SCHEMA_VERSION, chunks_schema, embeddings_schema_with_dim,
66 normalize_to_current,
67};
68pub use store::{ArrowGraphStore, CausalNode, QuerySpec, StoreError, Triple};