Fork me on GitHub
#datalog
<
2022-03-15
>
jjttjj19:03:14

Has anyone ever attempted to make an abstraction layer over the various clojure datalog dbs? I know it'd be pretty leaky

Braden Shepherdson19:03:20

I've kind of done this by accident in a Polylith app. since all the updates and queries are happening behind the .app.database.interface surface, I could change it not just between Datomic and Datahike, but all the way to SQL, without anyone else caring.

Braden Shepherdson19:03:57

in terms of querying, though, Datomic is a de-facto standard and most queries will work identically (up to ordering of results) in Datahike, Datalevin, and DataScript.

Braden Shepherdson20:03:17

(Crux is another matter)

jjttjj21:03:11

Yeah I was just trying something with both datascript and datalevin and it got me curious if someone took that kind of thing to the extreme.

refset23:03:39

A lot of ~portable edn Datalog should "just work" with XT (Crux), with the most notable caveats being: 1. variable attributes - XT's query planner has to know all attributes in advance, but as a workaround you can usually just generate lots of queries instead 2. multiple db sources - XT query execution assumes a single index 3. transaction entities and 5-tuple clauses - not supported 4. pull - XT implements the EQL spec instead 5. rules are defined slightly differently, since they have to be known during query compilation There are also quite a few DataScript tests in the XT repo that can give a feel for what else works and what doesn't https://github.com/xtdb/xtdb/blob/1693a633910b9a7815ad514da2e0685b4c21cc4f/test/test/xtdb/query_test.clj#L2123-L2870

👍 1