This commit is contained in:
Hassan Abedi 2026-03-09 10:49:50 +01:00
parent e12d2d811c
commit aac85af9a1

View File

@ -1,27 +1,27 @@
# chase-rs ## Chase-rs
An efficient implementation of the chase algorithm in Rust for advanced reasoning engines. An implementation of the chase algorithm in Rust for advanced reasoning engines.
## Overview ### Overview
The chase algorithm is a fundamental technique in database theory and knowledge representation used for: The chase algorithm is a fundamental technique in context of database theory and knowledge representation used for:
- Query answering under tuple-generating dependencies (TGDs) - Query answering under tuple-generating dependencies (TGDs)
- Computing universal models - Computing universal models
- Ontology-based data access (OBDA) - Ontology-based data access (OBDA)
- Datalog with existential rules - Datalog with existential rules
This implementation provides a **restricted chase** that ensures termination even with existential rules by tracking applied triggers. This implementation provides a **restricted chase** that guarantees termination even with existential rules by tracking applied triggers.
## Features ### Features
- **Core Data Types**: Terms, Atoms, Rules, Instances - **Core Data Types**: Terms, Atoms, Rules, and Instances
- **Existential Quantification**: Automatic generation of labeled nulls - **Existential Quantification**: Automatic generation of labeled nulls
- **Restricted Chase**: Termination guarantees via trigger tracking - **Restricted Chase**: Termination guarantees via trigger tracking
- **Fluent API**: `RuleBuilder` for readable rule construction - **Fluent API**: `RuleBuilder` for readable rule construction
- **Zero Dependencies**: Pure Rust with no external runtime dependencies - **Zero Dependencies**: Pure Rust with no external runtime dependencies
## Quick Start ### Quick Start
```rust ```rust
use chase_rs::{chase, Atom, Instance, Term}; use chase_rs::{chase, Atom, Instance, Term};
@ -54,7 +54,7 @@ assert!(result.terminated);
println!("Derived {} facts", result.instance.len()); println!("Derived {} facts", result.instance.len());
``` ```
## Existential Rules ### Existential Rules
Rules with head-only variables (existential quantification) automatically generate fresh labeled nulls: Rules with head-only variables (existential quantification) automatically generate fresh labeled nulls:
@ -66,39 +66,19 @@ let rule = RuleBuilder::new()
.build(); .build();
``` ```
## Project Structure ### Building and Testing
```
src/
├── lib.rs # Library root and re-exports
├── main.rs # Binary entry point
└── chase/
├── mod.rs # Module exports
├── term.rs # Terms: Constants, Nulls, Variables
├── atom.rs # Atoms: Predicate(term1, term2, ...)
├── instance.rs # Database instance (set of facts)
├── rule.rs # TGDs with RuleBuilder
├── substitution.rs # Variable bindings and unification
└── engine.rs # Core chase algorithm
tests/
├── integration_tests.rs
├── regression_tests.rs
└── property_tests.rs
```
## Building and Testing
```bash ```bash
# Run all tests ## Run all tests
cargo test cargo test
# Run with optimizations ## Run with optimizations
cargo build --release cargo build --release
# Check for lint warnings ## Check for lint warnings
cargo clippy cargo clippy
``` ```
## License ### License
This project is licensed under [BSD-3](LICENSE). This project is licensed under [BSD-3](LICENSE).