Repository navigation
Phase 7.3: Add or/or-join disjunction to Datalog query language - #24
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…_invocation arm) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds Or(Vec<Vec<WhereClause>>) and OrJoin { join_vars, branches } variants
to WhereClause, extends rule_invocations(), has_negated_invocation(), and
collect_rule_invocations_recursive() to recurse into branches, and adds
stub arms in stratification.rs, parser.rs, and evaluator.rs to keep the
codebase compiling until later tasks implement full or/or-join support.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…pendency graph Replace the stub Or/OrJoin match arm in DependencyGraph::from_rules with a recursive free function collect_clause_deps that traverses Or/OrJoin branches and propagates positive edges, while preserving negative edges for Not/NotJoin. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add parsing of (or ...), (or-join [...] ...), and (and ...) grouping in :where clauses, including safety checks that all or-branches introduce the same new variables and that or-join join-vars are already bound. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ute_query paths Implements Or/OrJoin disjunction evaluation in the executor layer: - evaluate_branch: evaluates a single or/or-join branch (patterns → nested-or → not/not-join → expr) - apply_or_clauses: unions branch results with deduplication; OrJoin projects out branch-private vars - Wired into execute_query (filtered_storage) and execute_query_with_rules (derived_storage) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ly_or_clauses Extend the has_not inline closure to include WhereClause::Or and WhereClause::OrJoin so rules with disjunction bodies are routed to the mixed_rules path. Wire apply_or_clauses into the mixed-rules loop after match_patterns and before apply_expr_clauses_in_evaluator. Add unit test verifying both entities are derived when a rule body contains Or. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ranch, nested Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…fication tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…or/or-join Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… comments Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…deQL) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversati
6369
on on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
(or branch1 branch2 ...)and(or-join [?vars] branch1 ...)disjunction clauses to Datalog queries and rule bodiesPattern,RuleInvocation,not,not-join,Expr, and nestedor/or-join;(and ...)groups multiple clauses into one branchapply_or_clauses, then existingnot/not-join/Exprfilters; rules withor/or-joinroute to themixed_rulespath inStratifiedEvaluatorTechnical changes
WhereClausegainsOr(Vec<Vec<WhereClause>>)andOrJoin { join_vars, branches }variantspub(crate)functions inexecutor.rs:evaluate_branch,apply_or_clausespub(crate)method onPatternMatcher:match_patterns_seededDependencyGraph::from_rulesrefactored with recursivecollect_clause_depshelperorbranches must introduce the same new variables;or-joinjoin vars must be pre-bound;or/or-joininsidenot/not-joinbodies rejected at parse timeTest plan
cargo test— 384 lib tests + 17 integration tests, all passingtests/disjunction_test.rscovering: union, filter, dedup,notinside branch, nestedor,or-joinvariable stripping, multiple join vars, safety errors, rule bodies,:as-oftemporal filter, stratification cycle detectionNotes
.wiki/Datalog-Reference.mdhas been updated with a new## Disjunctionsection but the wiki commit requires GPG signing (/dev/ttyunavailable in CI). Please commit it manually:🤖 Generated with Claude Code