0

I would like to test in a where clause in datalog if an attribute is in a particular set (or list). For example I want to test whether the :tag-type/code is in ["urgent" "todo"] . I can do this:

   (or
       [?tag-type :tag-type/code "urgent"]
       [?tag-type :tag-type/code "todo"]
        )

But I would like to be the list to be a parameter. say ?tag-names So , I would like to do something in the lines of this :

       [?tag-type :tag-type/code *in* [?tag-names])]

Is that possible ?

Peter
  • 47,963
  • 46
  • 132
  • 181

1 Answers1

1

A friend - without SO account! - has helped me out. You can specify a collection in the :in-clause like this :

[?collection-name  ...]

yielding :

(d/q '[:find (pull ?tag-type "[*]")
       :in $ [?tag-names ...] 
       :where 
       [?tag-type :tag-type/code ?tag-names]] 
        the-db ["urgent" "todo"])
Peter
  • 47,963
  • 46
  • 132
  • 181