Skip to main content

Crate arrow_graph_core

Crate arrow_graph_core 

Source
Expand description

arrow-graph-core — Arrow-native graph store.

A foundation crate providing:

  • Arrow schemas for triples, embeddings, and metadata
  • Configurable namespace partitioning (string-based partition keys)
  • Optional layer column for sub-partitioning
  • Zero-copy CRUD operations on Arrow RecordBatches
  • Causal chain traversal (breadth-first provenance tracking)

§Quick Start

use arrow_graph_core::store::{ArrowGraphStore, Triple, QuerySpec};

// Create a store with your own namespace partitions
let mut store = ArrowGraphStore::new(&["world", "code", "self"]);

let triple = Triple {
    subject: "Alice".to_string(),
    predicate: "knows".to_string(),
    object: "Bob".to_string(),
    graph: None,
    confidence: Some(0.9),
    source_document: None,
    source_chunk_id: None,
    extracted_by: Some("agent-1".to_string()),
    caused_by: None,
    derived_from: None,
    consolidated_at: None,
};

let id = store.add_triple(&triple, "world", Some(1)).unwrap();
assert_eq!(store.len(), 1);

let results = store.query(&QuerySpec {
    subject: Some("Alice".to_string()),
    ..Default::default()
}).unwrap();
assert_eq!(results.iter().map(|b| b.num_rows()).sum::<usize>(), 1);

§Three API Levels

LevelTypeUse Case
RawArrowGraphStoreFull control over namespaces and layers
SimpleSimpleTripleStoreDefault namespace, simplified API
KGKgStorePrefix management, keyword search, gap tracking

Use the factory module to create stores by configuration.

Re-exports§

pub use graph_factory::CreatedStore;
pub use graph_factory::GraphBackend;
pub use graph_factory::GraphStoreConfig;
pub use graph_factory::available_backends;
pub use graph_factory::create_default_store;
pub use graph_factory::create_graph_store;
pub use schema::chunk_col;
pub use schema::col;
pub use schema::CHUNKS_SCHEMA_VERSION;
pub use schema::TRIPLES_SCHEMA_VERSION;
pub use schema::chunks_schema;
pub use schema::embeddings_schema_with_dim;
pub use schema::normalize_to_current;
pub use store::ArrowGraphStore;
pub use store::CausalNode;
pub use store::QuerySpec;
pub use store::StoreError;
pub use store::Triple;

Modules§

graph_factory
Graph store factory — select and create the right store backend.
kg_store
KgStore — full-featured Arrow-native knowledge graph store.
schema
Arrow schemas for the graph store.
store
ArrowGraphStore — the core partitioned graph store.
triple_store
SimpleTripleStore — lightweight Arrow-native triple store.