Fork me on GitHub
#datomic
<
2016-06-10
>
danielwoelfel03:06:37

Does anybody else run Datomic on FreeBSD? About to upgrade from openjdk7->openjdk8 and was curious if there are any known problems.

mitchelkuijpers12:06:49

(d/q '[:find [?e ...]
              :in $ ?host-id [?ignore-keys ...]
              :where
              [?e :host/belongs-to ?host-id]
              [(!= ?e ?ignore-keys)]]
            (d/db (user/get-connection))
            :company/name
            (:db/id (user/get-tenant))
            [17592186104562 17592186081714 17592186098554])
Does anyone know why [(!= ?e ?ignore-keys)] does not work? it works when I change != to =

mitchelkuijpers12:06:57

Or is the problem that I try to filter by id's

rwtnorton16:06:45

I see the same result. If I pass in ?ignore-keys whole (`:in $ ?host-id ?ignore-keys`) and look for ?e missing from ?ignore-keys via homegrown predicate (`(defn nadda [e vs] (-> vs set (get e) not))`), I get the expected behavior, using [(#'datomic.fun/nadda ?e ?ignore-keys)].

bhagany17:06:37

I'm not sure why it doesn't work, but in this case I'd just leave that where clause out, and filter the result of the query. The data's all local.

bhagany17:06:48

unless you're using the rest api

bhagany17:06:25

I'm all about encouraging people to remember the data is local, because I'm using the rest api, and I'm constantly wishing it were true for me.

stuartsierra18:06:17

Negation in Datalog is tricky.

stuartsierra18:06:04

[(!= ?e ?ignore-keys)] will be evaluated as a predicate.

stuartsierra18:06:15

That means, for all bindings of ?e and ?ignore-keys established so far in the query, it will evaluate the expression (!= ?e ?ignore-keys) and remove any bindings for which that expression returns false.

stuartsierra18:06:50

The bindings include every possible combination of ?e and ?ignore-keys, so the != predicate will return true at least once for every ?e.

pheuter19:06:30

is it possible to parameterize the pull query like so?

(d/q ‘[:find (pull ?e ?query) :in $ ?query :where [?e …]] db query)

petterik21:06:37

use not= instead of !=?