 ;  [:?id])
 ;  [?todo <- Todo (= id ?id)])
 ;
-(defquery find-todo [:?eid]
-  [?todo <- :all [[e a v]] (= e ?eid)])
-
+(defquery entity- [:?eid]
+  [?entity <- :all [[e a v]] (= e ?eid)])
+
+(defn entity [session id] (mapv :?entity (query session entity- :?eid id)))
 ;; MVCtodo uses sequential ids. Since this is a horrible idea, I'm skipping it this pass.
 ;(defquery find-max-id
 ;  []

;  [?todos <- (acc/all) :from [Todo (= done true)]])
;
(defquery find-all-done []
  ;[:all [[e a v]] (= e ?e) (= a ?a) (= v ?v)]
  [:all [[e a v]] (= e ?e) (= a ?a) (= v ?v)]
  [:test (= (attr-ns ?a) "todo")])

;(defquery find-done-count
;  []


@(def session (fire-rules (insert-all todos facts)))

(def all-done (query session find-all-done))

(defn clara-tups->maps
  [tups]
