TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A relatively simple Datalog engine

207 pointsby dmitabout 7 years ago

7 comments

stickykbdabout 7 years ago
For those who may have missed it, Mozilla is working on Datalog knowledge store backed by SQLite called Project Mentat [1] (also written in Rust). Announcement and rationale written by one of its devs can be found here [2]. Also previous HN discussion is located here [3].<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;mozilla&#x2F;mentat" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mozilla&#x2F;mentat</a><p>[2] <a href="https:&#x2F;&#x2F;medium.com&#x2F;project-tofino&#x2F;introducing-datomish-a-flexible-embedded-knowledge-store-1d7976bff344" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;project-tofino&#x2F;introducing-datomish-a-fle...</a><p>[3] <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=13568559" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=13568559</a>
评论 #17109051 未加载
steveklabnikabout 7 years ago
For some interesting backlog here: As Rust moves from lexical to non-lexical lifetimes, there&#x27;s been a few different ways of actually implementing it. The initial implementation had some bugs and was fairly slow; but Niko had some other ideas: <a href="http:&#x2F;&#x2F;smallcultfollowing.com&#x2F;babysteps&#x2F;blog&#x2F;2018&#x2F;04&#x2F;27&#x2F;an-alias-based-formulation-of-the-borrow-checker&#x2F;" rel="nofollow">http:&#x2F;&#x2F;smallcultfollowing.com&#x2F;babysteps&#x2F;blog&#x2F;2018&#x2F;04&#x2F;27&#x2F;an-a...</a><p>The initial implementation used differential dataflow, but this was just merged in: <a href="https:&#x2F;&#x2F;github.com&#x2F;rust-lang-nursery&#x2F;polonius&#x2F;pull&#x2F;36#issuecomment-390393717" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rust-lang-nursery&#x2F;polonius&#x2F;pull&#x2F;36#issuec...</a><p>Very cool stuff!
评论 #17108143 未加载
triskaabout 7 years ago
Nice! It&#x27;s always good to see Datalog in action. In my experience, Datalog is often more convenient and more readable than SQL.<p>As the post mentions, the current ergonomics (&quot;<i>a wall of definitions</i>&quot;) are indeed the main shortcoming of the present approach, which is syntactically far removed from Datalog.<p>My suggestion towards an automated conversion is to consider Prolog: Syntactically, a Datalog clause is a valid Prolog term. In fact, Datalog is a syntactic subset of Prolog. Therefore, it can be easily parsed with Prolog (using the predicate read&#x2F;1), and then inspected via built-in mechanisms. You may be able to write a Prolog program that converts proper Datalog definitions to such Rust snippets.
评论 #17107970 未加载
xvilkaabout 7 years ago
Since DataLog is just a subset of Prolog I want to link a very good book about modern Prolog and its applications [1].<p>[1]. <a href="https:&#x2F;&#x2F;www.metalevel.at&#x2F;prolog" rel="nofollow">https:&#x2F;&#x2F;www.metalevel.at&#x2F;prolog</a>
评论 #17109041 未加载
wernseyabout 7 years ago
Awesome. I look forward to browsing its code.<p>I implemented a Datalog engine in Java a while back. Looking back on it now there are a bunch of things I might have done differently, but I&#x27;ve never tried to implement anything like it before.<p>I remember that doing the stratified negation was quite complex and I won&#x27;t be able to explain it of the top of my head anymore.<p>Anyway, here&#x27;s my version: <a href="https:&#x2F;&#x2F;github.com&#x2F;wernsey&#x2F;Jatalog" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;wernsey&#x2F;Jatalog</a>
评论 #17111028 未加载
justincormackabout 7 years ago
If you want a Go implementation, look at OPA <a href="https:&#x2F;&#x2F;github.com&#x2F;open-policy-agent&#x2F;opa" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;open-policy-agent&#x2F;opa</a> - designed for authorization but quite general.
myWindoonnabout 7 years ago
What would be some advantages of this design over the µKanren design [0] which uses a search monad [1] and expresses unification and relations directly as plain values and functions?<p>[0] <a href="http:&#x2F;&#x2F;webyrd.net&#x2F;scheme-2013&#x2F;papers&#x2F;HemannMuKanren2013.pdf" rel="nofollow">http:&#x2F;&#x2F;webyrd.net&#x2F;scheme-2013&#x2F;papers&#x2F;HemannMuKanren2013.pdf</a><p>[1] <a href="http:&#x2F;&#x2F;homes.soic.indiana.edu&#x2F;ccshan&#x2F;logicprog&#x2F;LogicT-icfp2005.pdf" rel="nofollow">http:&#x2F;&#x2F;homes.soic.indiana.edu&#x2F;ccshan&#x2F;logicprog&#x2F;LogicT-icfp20...</a>
评论 #17108382 未加载