Fork me on GitHub

Is there a way to query for entities that don't have a certain attribute? Something like "show me all entities that have a :company/id but don't have a :company/owner"


Check out missing? in the query docs

👍 6

@zilti you can also do

[?e .....]
(not [?e :attr])

👍 9

Looks like that datomic-peer do not respect socks proxy JVM props -DsocksProxyHost= -DsocksProxyPort=5000 Is it a know issue? slurp respect this settings both for dns resolution and packages. Datomic do not respect the proxy for names resolution I can't know about packages


Hi, I want to restore my backup db then I run bin/transctor the transactor

datomic-pro-0.9.5561 bin/transactor config/
Launching with Java options -server -Xms1g -Xmx1g -XX:+UseG1GC -XX:MaxGCPauseMillis=50
Starting datomic:>, storing data in: data ...
System started datomic:>, storing data in: data
and I ran this command and I got an error
datomic-pro-0.9.5561 bin/datomic restore-db backup.tgz datomic:                                                                                        
java.lang.IllegalArgumentException: :storage/invalid-uri Unsupported protocol:
        at datomic.error$arg.invokeStatic(error.clj:57)
        at datomic.error$arg.invoke(error.clj:52)
        at datomic.error$arg.invokeStatic(error.clj:55)
        at datomic.error$arg.invoke(error.clj:52)
        at datomic.backup$fn__19707.invokeStatic(backup.clj:306)
        at datomic.backup$fn__19707.invoke(backup.clj:304)
        at clojure.lang.MultiFn.invoke(
Can someone help me?


your backup (source) needs to be an unzipped backup, not a tar


I got the same error when I unzipped




it should be a directory


a top level dir with roots and values dirs inside of it


backup ls
owner  roots  values


you need to make a URI for it


it will be like: file:///User/Home/backup/


Okay, I don't get it... or-join works completely different from what I expect. When there's no result fulfilling any of the clauses in or-join it will match everything. Is that on purpose? How can I avoid that?


I thought this:

(d/q '[:find ?eid .
       :in $ ?comp-domain ?comp-name
       (or-join [?eid]
                [?eid :company/name ?comp-name]
                [?eid :company/domain ?comp-domain])]
     db comp-domain (:company/name data)))
Would be equivalent to this:
(or (d/q '[:find ?eid .
       :in $ ?comp-domain ?comp-name
       [?eid :company/domain ?comp-domain]]
     db comp-domain))
     (d/q '[:find ?eid .
       :in $ ?comp-domain ?comp-name
       [?eid :company/name ?comp-name]]
     db (:company/name data))))
But it is not.

Lennart Buit22:10:34

In the first query, you are getting all ?eid s because the or-join you specify does not unify with ?comp-name nor ?comp-domain. So, practically, the ?comp-domain/`?comp-name` in your :in clause are not the same as the ones you use in the or branches of your or-join

Lennart Buit22:10:42

So your first query now says “Give me al entity ids of entities that have either a name, or a domain”, the bindings in your :in make no difference

Lennart Buit22:10:55

If you change (or-join [?eid] ...) to (or-join [?eid ?comp-domain ?comp-name] ...), do you get what you want?


I'm trying...


Yes, that gives me an empty result, which is correct in this case


And it works for a valid binding too. Thanks! I misinterpreted how that first vector works in or-join, I thought that is to declare the common variable.

Lennart Buit23:10:50

It declares what variables from outside the or-join to unify with ^^


Q: what’s the best way to query for the most recently created entity (with other conditions) in Datalog?

thanks2 2

I can include a :where [?e :some/attr _ ?t] and then sort all results by ?t but it feels like there must be some way to use max to do this


perfect! thank you 🙂

Lennart Buit23:10:13

Not sure if your use is exactly in there, but I often use it as a reference if I want to find something history related 🙂


it’s a good start. I’ll be able to make it work from this

Lennart Buit23:10:23

haha, teach a man to fish, and all 🙂


exactly. you supplied the bait