Fork me on GitHub

is there any way to transform a result from :find (within the query itself)? for example, to create a query that returns true if [?somevar ...] has one or more elements in it and false if it has zero elements / is empty


or alternatively if ?a . is either nil or not nil


An attribute cant be nil (only be omitted); but you can use an or/or-join to do this.

 (and [?e :arrt _] [(ground true) ?mybool])
 (and (missing? ?e :attr) [(ground false) ?mybool]))
Here ?mybool is bound to either true or false depending if the preceding clause matches (Alternatively this can be expressed as a datomic rule too)


Thank you. I was wondering if it might have been possible within the :where bindings


does that needs to be or-join or will or suffice ?


both or clauses refer to the same set of variables (`?e` and ?mybool), so i don't think u need or-join. > An or-join clause is similar to an or clause, but it allows you to specify which variables should unify with the surrounding clause; only this list of variables needs binding before the clause can run. The /variable/s specifies which variables should unify. —


(as a boolean)