6 ms·
What's the best example of modern Datalog?
by patrickmn 7y ago
What's the best example of modern Datalog?
- thom 7y agoDatomic. Also interesting: https://github.com/sixthnormal/clj-3df https://github.com/sixthnormal/clj-3df
- refset 7y agoDatomic provides a fantastic range of query features, but the underlying Datalog engine does have drawbacks in how it evaluates results eagerly and requires intermediate result sets to fit in memory [0]. For comparison, I work on https://opencrux.com https://opencrux.com which uses lazy Datalog evaluation and can spill to disk when necessary. Naturally there are downsides to this approach also, including a dependence on seek-heavy use of local KV indexes. clj-3df is definitely interesting although not strictly comparable :) [0] https://docs.datomic.com/on-prem/query.html#memory-usage https://docs.datomic.com/on-prem/query.html#memory-usage
- thom 7y agoOh hello! I hadn't realised JUXT had their own products now, will definitely check this out.
- triska 7y agoA good way to try Datalog is to use a state-of-the-art Prolog system that supports SLG resolution (tabling). SLG resolution is an evaluation strategy of Prolog programs that provides favourable termination properties compared to SLDNF resolution which is Prolog's default execution strategy. A great example for this is XSB Prolog, since it has pioneered and refined many of these techniques and serves as an example and benchmark for many other Prolog systems in this area: https://xsb.com/xsb-prolog https://xsb.com/xsb-prolog The nice thing is that this approach allows you to use Datalog, and at the same time gives you a Turing-complete programming language that is comparatively easy to grasp once you understand Datalog, while sharing many of the same advantages and being syntactically only a slight extension of it.
- mycall 7y agoA turning complete query language sounds like a recipe for DoS attacks.
- maweki 7y agoIt is only Turing complete if you allow new rules. Usually a client would only be allowed to formulate query goals. In that sense, GraphQL is Turing complete as well, as the underlying implementation could just simulate a Turing machine.
- onion2k 7y agoWhat I read from your post here is that GraphQL is safe by default and would require effort to make it dangerous while Datalog is dangerous by default and would require configuration to make it safe. I know which one I'd rather put on a server.
- maweki 7y agoYou have read that incorrectly. A Datalog/Prolog query does not define new rules. That's like calling arbitrary code on remote machines. You would never allow that. But IF you were allowed to define new rules, THEN you could simulate a turing machine or create infinite reductions.
- deleted 7y ago[deleted]
- tastroder 7y ago> A great example for this is XSB Prolog, I'm really sorry but it honestly cannot be. I was curious because Datalog/Prolog based technologies are intriguing so I clicked on that link. https://xsb.com/xsb-prolog https://xsb.com/xsb-prolog seems to have no download but links to http://xsb.sourceforge.net/ http://xsb.sourceforge.net/ which claims version 3.8 (October 2017) is current and links to http://xsb.sourceforge.net/downloads/downloads.html http://xsb.sourceforge.net/downloads/downloads.html which does not specify a version but offers a tar.gz that contains version 3.7 from July 2016. Going back to sourceforge and heading to the SVN https://sourceforge.net/p/xsb/src/HEAD/tree/trunk/XSB/ https://sourceforge.net/p/xsb/src/HEAD/tree/trunk/XSB/ states version 3.9, November 2019 and looks pretty active commit-wise. Okay, let's do that. Checking out trunk, I see perl and C scrolling by. While I have no problem with Perl, I know quite a few developers - especially in the web context - that find it rather off-putting. I get a README that tells me to read the manual in order to install. Fair enough. Opening that ( http://xsb.sourceforge.net/manual1/manual1.pdf http://xsb.sourceforge.net/manual1/manual1.pdf ) gives me a 622 page PDF from October 2017. Chapter 2: "Make sure that after you have obtained XSB, you have uncompressed it by following the instructions found in the file README." There were no such instructions. But well, configure and make are in build, that's fine and the rest of the instructions are clear. I was confused why configure looked for mysql and make did something with Java but whatever, both worked great out of the box. Let me check the binary. I get a REPL, claiming to be version 3.8 from October 2017 and despite having 7 lines of output I have no idea how to quit out of that process, so I turn to Google which gives me http://xsb.sourceforge.net/shadow_site/manual1/node14.html http://xsb.sourceforge.net/shadow_site/manual1/node14.html Neither ctrl^c, nor ctrl^d work, and halt + return is ignored. I go ahead, kill the process and delete the directory. Alternatives to the above? That original site tells me to contact some organisation, "xsb prolog" on Google turns up ancient results. Now compare that with https://graphql.org/graphql-js/ https://graphql.org/graphql-js/ Just like many of these rather research centric languages, it does not matter how cool their tech is if that's the first experience people get. In my view experiences like the above are why they fail to gain adoption in today's world, not some technical aspect or technique. At least unlike much of the linked data and SPARQL world this thing compiled out of the box and I would have been up and running in about 10 minutes if I had any intention to continue.
- muydeemer 7y agoYou might want to check out Grakn (https://github.com/graknlabs/grakn/ https://github.com/graknlabs/grakn/) - its query language is an implementation of recursive datalog with negation and comes with lazy execution. I am one of its developers.
- lordgrenville 7y agoCertainly not the best, but worth mentioning the Python implementation pydatalog. https://sites.google.com/site/pydatalog/home https://sites.google.com/site/pydatalog/home