Skip to main content

Crate nopaldb

Crate nopaldb 

Source
Expand description

NopalDB: an embedded property graph with native embeddings, MVCC transactions and its own query language (NQL).

One process opens a directory and owns it; everything else — nodes, edges, full-text and vector indexes, transactions, the write-ahead log — lives in that directory. There is no server to run.

§Five-minute start

[dependencies]
nopaldb = { version = "0.5", features = ["core"] }
use nopaldb::{Edge, Graph, Node, PropertyValue};

#[tokio::main]
async fn main() -> nopaldb::Result<()> {
    let graph = Graph::open("./data.db").await?;

    let mut tx = graph.begin_transaction().await?;
    let a = tx.add_node(Node::new("Person")
        .with_property("name", PropertyValue::String("Alice".into()))).await?;
    let b = tx.add_node(Node::new("Person")
        .with_property("name", PropertyValue::String("Bob".into()))).await?;
    tx.add_edge(Edge::new(a, b, "KNOWS"))?;
    tx.commit().await?;

    let result = graph.execute_nql("find p.name from (p:Person)").await?;
    for row in result.rows() {
        println!("{:?}", row.get("p.name"));
    }
    Ok(())
}

§Feature tiers

TierWhat you get
defaultProperty graph + NQL + MVCC + WAL (sled storage)
core+ Arrow/Parquet export, graph algorithms, embeddings + HNSW, full-text search, ML helpers
semantic+ OWL-EL reasoner, Turtle import/export, SHACL validation
full+ full-isolation: isolation levels, per-node lock manager, deadlock detection

These docs are built with full, so every feature-gated module is listed; an item’s cfg badge says which feature you need.

§Where to go next

  • Graph is the entry point: open, transactions, upsert, search, export.
  • Graph::execute_nql runs NQL; the language reference lives in the repository under docs/en/NQL_REFERENCE.md.
  • rdf_owl documents exactly what the Turtle bridge keeps and loses.
  • Operational rules (one process per directory, durability, isolation, bulk loading) are in docs/ADOPTION.md in the repository.

Re-exports§

pub use reasoner::Axiom;
pub use reasoner::CompletionRule;
pub use reasoner::ELReasoner;
pub use reasoner::Inference;
pub use shacl::ShaclValidator;
pub use shacl::Shape;
pub use shacl::ValidationReport;
pub use shacl::ConstraintViolation;
pub use ml::PyGData;
pub use error::NopalError;
pub use error::Result;
pub use error::StorageError;
pub use error::StorageErrorKind;
pub use types::Node;
pub use types::Edge;
pub use types::NodeId;
pub use types::EdgeId;
pub use types::PropertyValue;
pub use types::Properties;
pub use storage::MigrationReport;
pub use storage::Storage;
pub use storage::StorageEngine;
pub use storage::StorageOptions;
pub use storage::StorageProfile;
pub use storage::StorageTuning;
pub use graph::Graph;
pub use graph::Direction;
pub use graph::BulkLoader;
pub use graph::BulkLoadStats;
pub use graph::AutoGcConfig;
pub use graph::AutoGcStatus;
pub use graph::GraphView;
pub use graph::Subgraph;
pub use graph::LinkSpec;
pub use graph::UpsertOutcome;
pub use graph::UpsertRequest;
pub use graph::BranchReport;
pub use graph::ExplainedHit;
pub use graph::HybridExplain;
pub use graph::HybridFilter;
pub use graph::HybridHit;
pub use graph::HybridQuery;
pub use graph::VectorPath;
pub use traversal::TraversalResult;
pub use traversal::TraversalConfig;
pub use traversal::NodeFilter;
pub use query::TraverseBuilder;
pub use query::SackBuilder;
pub use query::SackBlock;
pub use query::SackResult;
pub use query::SackItem;
pub use query::CycleMode;
pub use query::Truncation;
pub use transaction::Transaction;
pub use transaction::IsolationLevel;
pub use lock_manager::LockManager;
pub use lock_manager::LockType;
pub use query::nql::parse;
pub use query::nql::parse_query;
pub use query::nql::parser::ast::Query as NQLQuery;
pub use query::nql::parser::ast::Statement as NQLStatement;
pub use query::nql::Executor;
pub use query::nql::NqlResult;
pub use query::nql::ProfileResult;
pub use query::nql::WriteResult;

Modules§

algorithms
arrow_export
embeddings
error
graph
index
lock_manager
ml
mvcc
planner
Query Planner - Cost-based optimizer for NopalDB
query
rdf_owl
Turtle/OWL bridge: load an ontology and its data into the property graph, and write the ontological part of the graph back out as Turtle.
reasoner
OWL-EL Reasoner — Steps 5, 9 and CR3 of the NopalDB ontological roadmap.
schema
Schema inspection and management for NopalDB
shacl
SHACL Core — validacion de shapes sobre el grafo NopalDB.
storage
transaction
traversal
types
wal

Structs§

RecordBatch
A two-dimensional batch of column-oriented data with a defined schema.

Constants§

VERSION