type-bridge-core-lib
Pure-Rust TypeQL AST, schema parser, query compiler, validation engine, and value coercer for type-bridge.
Modules
| Module | Purpose |
|---|---|
ast |
TypeQL Abstract Syntax Tree — patterns, statements, clauses, and values |
schema |
Schema representation with entity / relation / attribute types and inheritance resolution |
validation |
Schema-aware query validation plus a portable JSON validation-rule DSL |
compiler |
Compiles an AST back into a TypeQL query string |
query_parser |
Parses a TypeQL query string into the AST (bidirectional round-trip) |
value_coercion |
Coerces raw values into TypeDB value-types and formats TypeQL literals |
reserved_words |
TypeQL reserved-word detection |
parser |
Low-level Winnow grammar consumed by query_parser and schema |
Usage
use parse_typeql_query;
use QueryCompiler;
use TypeSchema;
use ValidationEngine;
// Parse a TypeQL query into AST clauses
let clauses = parse_typeql_query.unwrap;
// Compile back to TypeQL
let compiler = new;
let typeql = compiler.compile;
assert_eq!;
// Validate against a schema
let schema = from_typeql.unwrap;
let engine = new;
let result = engine.validate_query;
assert!;
Feature flags
| Feature | Default | Effect |
|---|---|---|
pyo3 |
no | Enables #[derive(FromPyObject)] on AST types for PyO3 interop |
Testing
License
MIT