3 ms·
For those interested in database query languages, it is worth knowing about Datalog, the query language behind Datomic, XTDB and Datahike: http://www.learndatal
by pgt 4y ago
For those interested in database query languages, it is worth knowing about Datalog, the query language behind Datomic, XTDB and Datahike: http://www.learndatalogtoday.org/ http://www.learndatalogtoday.org/
E.g. a parameterised aggregate query that retrieves the name and average rating of a film starring cast members whose names match the input names:
[:find ?name (avg ?rating)
:in $ [?name ...] [[?title ?rating]]
:where
[?p :person/name ?name]
[?m :movie/cast ?p]
[?m :movie/title ?title]]
To reveal the answer, click on tab labelled "3" and then "I give up!": http://www.learndatalogtoday.org/chapter/7 http://www.learndatalogtoday.org/chapter/7
- jitl 4y agoThis is the Datomic/Clojure dialect of Datalog. I had an easier time learning a stand-alone datalog variant. I think compiling Datalog to SQL is an interesting idea. I wrote a toy Datalog -> SQLite compiler: https://percival.jake.tl/ https://percival.jake.tl/ Other Datalog -> SQL compilers I know of: - Originally from Mozilla, now independent: https://github.com/qpdb/mentat https://github.com/qpdb/mentat - From Google: https://logica.dev/ https://logica.dev/
- techplex 4y agoSee also - https://github.com/sqwishy/owoof https://github.com/sqwishy/owoof