Core Concepts

CleaveQL Overview

CleaveQL is the bespoke query language powering CleaveDB. It is designed from the ground up to use very easy query syntaxes. By allowing developers to write queries in plain, conversational English, it eliminates the rigid friction of traditional SQL JOINs and complex NoSQL JSON aggregates.

For a comprehensive, step-by-step guide on writing your first queries, please see the Tutorial.

Architecture & Execution Flow

Under the hood, CleaveQL operates via a multi-stage compilation pipeline that translates human-readable commands into highly optimized hardware instructions.

1. Lexer & Parser

The Python frontend contains a custom recursive-descent parser that identifies over 150 unique token types, compiling natural language into 38 distinct Abstract Syntax Tree (AST) node structures before execution.

2. Security Policy Engine

Before reaching the storage layer, the AST is evaluated by the Graph-Based Access Control (GBAC) engine, ensuring Document-Level Security (DLS) rules and field masks are dynamically enforced based on session context.

3. Rust FFI Bridge

Validated AST instructions are passed via PyO3 bindings directly into the Rust storage engine, executing against a custom B+Tree, Write-Ahead Log (WAL), and CLOCK-sweep buffer pool.

4. Hardware Pushdown

Heavy aggregation pipelines and vector similarity searches bypass standard scalar loops and are pushed directly into C++ AVX-512 SIMD registers, achieving 1-clock-cycle reductions for massive performance gains.

Core Capabilities

Graph-Relational Traversal

Unlike standard SQL which requires verbose structural mapping, CleaveQL treats relationships as native, physical edges. You describe the path you want to walk using plain language, and the database navigates the underlying pointers automatically. This eliminates the need for complex mathematical joins and drastically reduces query complexity.

Semantic Intelligence

CleaveQL is natively aware of neural embeddings. By simply querying for the "meaning" of a concept, the language processor automatically routes the request through a bundled ONNX Transformer model. This allows developers to seamlessly mix exact filtering with fuzzy, semantic intelligence without deploying any external microservices.

ACID Transactions & Soft Deletions

The language natively supports multi-step ACID transactions (Atomicity, Consistency, Isolation, Durability) via Software Transactional Memory (STM). Furthermore, deletion operations are safely sandboxed; soft-deletions automatically cascade through graph bonds and sit in an isolated rubbish bin until a background cron-worker permanently incinerates them.