datalog: bipartite friends-with-hobby join test (229/229)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 48s

This commit is contained in:
2026-05-08 12:39:04 +00:00
parent 8e508bc90f
commit 9edccb8f33
3 changed files with 18 additions and 6 deletions

View File

@@ -1,13 +1,13 @@
{
"lang": "datalog",
"total_passed": 228,
"total_passed": 229,
"total_failed": 0,
"total": 228,
"total": 229,
"suites": [
{"name":"tokenize","passed":26,"failed":0,"total":26},
{"name":"parse","passed":18,"failed":0,"total":18},
{"name":"unify","passed":28,"failed":0,"total":28},
{"name":"eval","passed":30,"failed":0,"total":30},
{"name":"eval","passed":31,"failed":0,"total":31},
{"name":"builtins","passed":20,"failed":0,"total":20},
{"name":"semi_naive","passed":8,"failed":0,"total":8},
{"name":"negation","passed":10,"failed":0,"total":10},
@@ -16,5 +16,5 @@
{"name":"magic","passed":28,"failed":0,"total":28},
{"name":"demo","passed":21,"failed":0,"total":21}
],
"generated": "2026-05-08T12:35:21+00:00"
"generated": "2026-05-08T12:38:51+00:00"
}

View File

@@ -1,13 +1,13 @@
# datalog scoreboard
**228 / 228 passing** (0 failure(s)).
**229 / 229 passing** (0 failure(s)).
| Suite | Passed | Total | Status |
|-------|--------|-------|--------|
| tokenize | 26 | 26 | ok |
| parse | 18 | 18 | ok |
| unify | 28 | 28 | ok |
| eval | 30 | 30 | ok |
| eval | 31 | 31 | ok |
| builtins | 20 | 20 | ok |
| semi_naive | 8 | 8 | ok |
| negation | 10 | 10 | ok |

View File

@@ -273,6 +273,18 @@
(dl-saturated? db))
false)
;; Bipartite-style join: pair-of-friends who share a hobby.
;; Three-relation join exercising the planner's join order.
(dl-et-test-set! "bipartite friends-with-hobby"
(dl-query
(dl-program
"hobby(alice, climb). hobby(bob, paint).
hobby(carol, climb).
friend(alice, carol). friend(bob, alice).
match(A, B, H) :- friend(A, B), hobby(A, H), hobby(B, H).")
(list (quote match) (quote A) (quote B) (quote H)))
(list {:A (quote alice) :B (quote carol) :H (quote climb)}))
;; Repeated variable (diagonal): p(X, X) only matches tuples
;; whose two args are equal. The unifier handles this via the
;; subst chain — first occurrence binds X, second occurrence