Fork me on GitHub
#datomic
<
2020-10-09
>
zilti11:10:25

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"

manutter5111:10:40

Check out missing? in the query docs

đź‘Ť 6
souenzzo13:10:35

@zilti you can also do

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

đź‘Ť 9
souenzzo19:10:37

Looks like that datomic-peer do not respect socks proxy JVM props -DsocksProxyHost=127.0.0.1 -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

ChicĂŁo20:10:34

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

datomic-pro-0.9.5561 bin/transactor config/dev-transactor-template.properties
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(MultiFn.java:233)
Can someone help me?

marshall20:10:31

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

ChicĂŁo20:10:06

I got the same error when I unzipped

marshall20:10:19

untarred/unzipped

marshall20:10:23

it should be a directory

marshall20:10:29

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

ChicĂŁo20:10:02

backup ls
owner  roots  values

marshall20:10:22

you need to make a URI for it

marshall20:10:38

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

zilti22:10:28

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?

zilti22:10:14

I thought this:

(d/q '[:find ?eid .
       :in $ ?comp-domain ?comp-name
       :where
       (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
       :where
       [?eid :company/domain ?comp-domain]]
     db comp-domain))
     (d/q '[:find ?eid .
       :in $ ?comp-domain ?comp-name
       :where
       [?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?

zilti23:10:49

I'm trying...

zilti23:10:23

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

zilti23:10:41

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 ^^

zilti23:10:52

🙂

steveb8n23:10:47

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

thanks2 2
steveb8n23:10:22

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

steveb8n23:10:02

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 🙂

steveb8n23:10:47

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 🙂

steveb8n23:10:37

exactly. you supplied the bait