lance_graph/lib.rs
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright The Lance Authors
3
4//! Lance Graph Query Engine
5//!
6//! This crate provides graph query capabilities for Lance datasets using Cypher syntax.
7//! It interprets Lance datasets as property graphs and translates Cypher queries into
8//! DataFusion SQL queries for execution.
9//!
10//! # Features
11//!
12//! - Cypher query parsing and AST representation
13//! - Graph pattern matching on columnar data
14//! - Property graph interpretation of Lance datasets
15//! - Translation to optimized SQL via DataFusion
16//! - Support for nodes, relationships, and properties
17//!
18//! # Example
19//!
20//! ```no_run
21//! use lance_graph::{CypherQuery, GraphConfig, Result};
22//!
23//! # fn example() -> Result<()> {
24//! let config = GraphConfig::builder()
25//! .with_node_label("Person", "person_id")
26//! .with_relationship("KNOWS", "src_person_id", "dst_person_id")
27//! .build()?;
28//!
29//! let query = CypherQuery::new("MATCH (p:Person) WHERE p.age > 30 RETURN p.name")?
30//! .with_config(config);
31//!
32//! // Execute against a dataset (would need actual dataset integration)
33//! // let results = query.execute(&dataset).await?;
34//! # Ok(())
35//! # }
36//! ```
37
38pub mod ast;
39pub mod config;
40pub mod datafusion_planner;
41pub mod error;
42pub mod lance_native_planner;
43pub mod logical_plan;
44pub mod parser;
45pub mod query;
46pub mod query_processor;
47pub mod semantic;
48pub mod simple_executor;
49pub mod source_catalog;
50pub mod sql_converter;
51
52/// Maximum allowed hops for variable-length relationship expansion (e.g., *1..N)
53pub const MAX_VARIABLE_LENGTH_HOPS: u32 = 20;
54
55pub use config::{GraphConfig, NodeMapping, RelationshipMapping};
56pub use error::{GraphError, Result};
57pub use query::{CypherQuery, ExecutionStrategy};