Module nested

Module nested 

Source
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§

NestedQuery
Represents a nested query (subquery) within a larger query
NestedQueryEvaluator
Evaluator for nested queries
NestedQueryParser
Parser for nested queries
NestedQueryResult
Result of evaluating a nested query
NestedQueryStats
Statistics for nested query evaluation
Query
Represents a query that may contain nested subqueries