|
|
|
|
|
by deosjr
375 days ago
|
|
I appreciate it; this kind of exchange is exactly why I read HackerNews.
If you have any good sources on extending Datalog to N-ary relations, I'd love to know. Just had a look at the implementation I based mine on and it exclusively talks about triples: https://www.instantdb.com/essays/datalogjs Coming from Prolog I'd like to get closer to the original if possible :) |
|
E.g., if you have a fact id=(a,b,c,d), you can record triples (id, 1, a), (id, 2, b), (id, 3, c) and (id, 4, d) and reconstruct original fact.
Look at it as columnar storage in databases.
Then, if your query only needs a third value from a 4-tuple facts, you can get only those, ignoring first, second and fourth values. This is what columnar storage engines do.
In fact, I read that one of most efficient datalog engines use relational query execution under the hood.
Take a look here: https://github.com/philzook58/awesome-egraphs
The paper you'll most probably find interesting is "Better Together: Unifying Datalog and Equality Saturation," but there are many others interesting things there.