     ;;[acc res]
     res))
 
-#_(defn select
+(defn select
   [g s p o]
   (let [acc (add-vertex! g {::val {} ::collect-fn collect-select})
         ctx (async-context

     [fabric type project]
     [toxi type person]]))

(def ctx (async-context {:graph g :processor eager-vertex-processor :timeout nil}))
(def toxi (register-query g 'toxi nil nil))
(def types (register-query g nil 'type nil))
(def projects (register-query g nil 'type 'project))

(execute! ctx)

;;(warn :free-ram (.freeMemory (Runtime/getRuntime)))

(def aggregate-select
  (simple-collect
   (fn [val incoming]
     (let [res (vals (peek incoming))]
       ;;(info :res res)
       (when (and (seq res) (every? #(not= #{nil} %) res))
         (->> res
              (map #(disj % nil))
              (set)
              (sort-by count)
              (reduce set/intersection)
              (map #(deref (vertex-for-id g %)))))))))

;; TODO figure out way how to at to a running context
(defn add-query
  [g s p o]
  (let [acc (add-vertex! g {::val {}  ::collect-fn collect-select})
        res (add-vertex! g {::val nil ::collect-fn aggregate-select})]
    (connect-to! s-idx acc signal-select [0 s])
    (connect-to! p-idx acc signal-select [1 p])
