Summary
Triadic selection patterns (friend-of-friend queries that exclude direct connections) do not return correct results. These patterns have the form:
MATCH (a:Person)-[:KNOWS]->(b)-[:KNOWS]->(c)
WHERE NOT (a)-[:KNOWS]->(c) AND a <> c
RETURN c
The issue is in how the executor handles negative pattern predicates (WHERE NOT (pattern)) when checking for existing relationships.
TCK Impact
~19 scenarios
Effort
Medium — executor changes to pattern predicate evaluation
Acceptance Criteria
v0.3.8 Planning
Phase: 7 — Pattern Predicates + Triadic Selection
PR branch: fix/306-302-pattern-predicates-triadic
Milestone: v0.3.8
Est. TCK gain: +12–15 (of the combined +20–25 for Phase 7; PR #364 addressed partial cases)
Effort: Part of 2–3 day combined effort
Depends on: Phase 4 (#370), Phase 7 (#306 pattern predicate foundation must land in same PR)
Primary files: src/graphforge/executor/evaluator.py, src/graphforge/planner/planner.py
Verify: uv run pytest tests/tck/ -k "triadic or friend" -v
Summary
Triadic selection patterns (friend-of-friend queries that exclude direct connections) do not return correct results. These patterns have the form:
The issue is in how the executor handles negative pattern predicates (
WHERE NOT (pattern)) when checking for existing relationships.TCK Impact
~19 scenarios
Effort
Medium — executor changes to pattern predicate evaluation
Acceptance Criteria
WHERE NOT (a)-[:R]->(b)correctly excludes nodes with the relationshipv0.3.8 Planning
Phase: 7 — Pattern Predicates + Triadic Selection
PR branch:
fix/306-302-pattern-predicates-triadicMilestone: v0.3.8
Est. TCK gain: +12–15 (of the combined +20–25 for Phase 7; PR #364 addressed partial cases)
Effort: Part of 2–3 day combined effort
Depends on: Phase 4 (#370), Phase 7 (#306 pattern predicate foundation must land in same PR)
Primary files:
src/graphforge/executor/evaluator.py,src/graphforge/planner/planner.pyVerify:
uv run pytest tests/tck/ -k "triadic or friend" -v