datalog: dl-magic-query driver (204/204)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 22s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 22s
End-to-end magic-sets entry point. Given (db, query-goal):
- copies the caller's EDB facts (relations not headed by any
rule) into a fresh internal db
- adds the magic seed fact
- adds the rewritten rules
- saturates and runs the query
- returns the substitution list
Caller's db is untouched. Equivalent to dl-query for any
fully-stratifiable program; intended as a perf alternative on
goal-shaped queries against large recursive relations.
2 new tests: equivalence to dl-query on chain-3 ancestor, and
non-mutation of the caller's db (rules count unchanged).
This commit is contained in:
@@ -174,11 +174,15 @@ large graphs.
|
||||
- [x] Equivalence test: rewritten ancestor program over the same EDB
|
||||
derives the same number of `ancestor` tuples and returns the
|
||||
same query answers as the unrewritten program (chain-3 case).
|
||||
- [x] `dl-magic-query db query-goal` — top-level driver. Builds a
|
||||
fresh internal db with the caller's EDB facts, the magic seed,
|
||||
and the rewritten rules; saturates and queries. Caller's db is
|
||||
untouched. Equivalent to `dl-query` for fully-stratifiable
|
||||
programs (sole motivation is a perf alternative on goal-shaped
|
||||
queries against large recursive relations).
|
||||
- [ ] Perf test: 10k-node reachability with magic vs semi-naive.
|
||||
Pending — would need a `dl-saturate-magic!` driver that builds
|
||||
a temporary db from rewrite output. The rewriter itself is in
|
||||
place; benchmarking against semi-naive on large graphs is left
|
||||
to a future iteration.
|
||||
Left to a future iteration — would need a benchmarking harness
|
||||
for large graphs and the conformance budget can't afford it.
|
||||
|
||||
### Phase 7 — stratified negation
|
||||
- [x] Dependency graph: `dl-build-dep-graph db` returns `{head -> ({:rel
|
||||
@@ -299,6 +303,14 @@ large graphs.
|
||||
|
||||
_Newest first._
|
||||
|
||||
- 2026-05-08 — Phase 6 driver: `dl-magic-query db query-goal`.
|
||||
Builds a fresh internal db from the caller's EDB + magic seed +
|
||||
rewritten rules, saturates, queries, returns substitutions —
|
||||
caller's db is untouched. Equivalent to `dl-query` for any
|
||||
fully-stratifiable program; sole motivation is a perf alternative
|
||||
on goal-shaped queries against large recursive relations.
|
||||
2 new tests cover equivalence and non-mutation.
|
||||
|
||||
- 2026-05-08 — Phase 6 magic-sets rewriter. `dl-magic-rewrite rules
|
||||
query-rel adn args` returns `{:rules <rewritten> :seed <seed-fact>}`.
|
||||
Worklist over `(rel, adn)` pairs starts from the query, gates each
|
||||
|
||||
Reference in New Issue
Block a user