Expand description
Nested query support for backward chaining
This module implements nested/subqueries in backward chaining queries. Subqueries allow using the results of one query as input to another query.
§Examples
ⓘ
// Find grandparents: people who are parents of parents
let results = engine.query(
"grandparent(?x, ?z) WHERE
parent(?x, ?y) AND
(parent(?y, ?z) WHERE child(?z, ?y))",
&mut facts
)?;
// Find high-value customers: VIPs or those with large purchases
let results = engine.query(
"high_value(?customer) WHERE
(vip(?customer) OR
(purchase(?customer, ?item, ?amount) WHERE ?amount > 1000))",
&mut facts
)?;Structs§
- Nested
Query - Represents a nested query (subquery) within a larger query
- Nested
Query Evaluator - Evaluator for nested queries
- Nested
Query Parser - Parser for nested queries
- Nested
Query Result - Result of evaluating a nested query
- Nested
Query Stats - Statistics for nested query evaluation
- Query
- Represents a query that may contain nested subqueries