datalog

Find entities whose ref-to-many attribute contains all elements of input

☆樱花仙子☆ 提交于 2019-12-01 06:30:36
Suppose I have entity entry with ref-to-many attribute :entry/groups . How should I build a query to find entities whose :entry/groups attribute contains all of my input foreign ids? Next pseudocode will illustrate my question better: [2 3] ; having this as input foreign ids ;; and having these entry entities in db [{:entry/id "A" :entry/groups [2 3 4]} {:entry/id "B" :entry/groups [2]} {:entry/id "C" :entry/groups [2 3]} {:entry/id "D" :entry/groups [1 2 3]} {:entry/id "E" :entry/groups [2 4]}] ;; only A, C, D should be pulled Being new in Datomic/Datalog, I exhausted all options, so any help

Find entities whose ref-to-many attribute contains all elements of input

走远了吗. 提交于 2019-12-01 05:32:06
问题 Suppose I have entity entry with ref-to-many attribute :entry/groups . How should I build a query to find entities whose :entry/groups attribute contains all of my input foreign ids? Next pseudocode will illustrate my question better: [2 3] ; having this as input foreign ids ;; and having these entry entities in db [{:entry/id "A" :entry/groups [2 3 4]} {:entry/id "B" :entry/groups [2]} {:entry/id "C" :entry/groups [2 3]} {:entry/id "D" :entry/groups [1 2 3]} {:entry/id "E" :entry/groups [2 4