Locy¶
Locy is Uni's logic programming layer: Logic + Cypher. It extends OpenCypher with recursive rules, hypothetical reasoning, graph derivation, and abductive remediation workflows.
Who This Is For¶
- Application engineers who need graph reasoning beyond one-shot queries.
- Data and policy teams modeling compliance, access control, and propagation rules.
- Advanced users who want compiler/runtime internals and TCK-level semantics.
What You Get¶
- Declarative rules with recursion (
CREATE RULE). - Goal-directed evaluation (
QUERY). - Hypothetical analysis (
ASSUME ... THEN). - Remediation search (
ABDUCE). - Derivation/proof explainability (
EXPLAIN RULE). - Graph materialization (
DERIVE).
Start Here¶
- Read Foundations.
- Run the Quickstart.
- Learn syntax in Language Guide.
- Move to Advanced Features.
Locy vs Plain Cypher¶
Use plain Cypher when you need direct reads/writes on existing graph state. Use Locy when you need:
- Recursive closure and fixed-point reasoning.
- Explainable inferred facts.
- What-if analysis with rollback boundaries.
- Suggested minimal changes to satisfy or prevent outcomes.
API Entry Points¶
- Rust:
session.locy(program).await?and theLocyBuilderfluent API viasession.locy_with(program).param(...).timeout(...).with_config(...).run().await?. - Python (sync):
session.locy(program)and the fluent API viasession.locy_with(program).param(...).with_config(...).run(). - Python (async):
await session.locy(program)andawait session.locy_with(program).run().
Sessions are created from a Uni instance: session = db.session().