             (subs (name create-fact-fn) 2)))) ; Return the record type.
     #{}))
 
-(defn insertions-to-dot [productions]
+(defn- get-uses
+  "Returns the facts consumed by a production."
+  [production]
+  (into #{}
+        (for [[condition id] (condition-to-id-map production)
+              :when (:type condition)]
+          (.getName (:type condition)))))
+
+(defn- insertions-to-dot [productions]
   (let [types-to-ids ; A map of all conditions and their node ids.
         (reduce
          (fn [map [type id]]

        [:tr [:td [:b (str (last (string/split (.getName (:type condition)) #"\.")))]]])
      [:tr [:td (h/h (str (:constraints condition)))]]])))

(defn rhs-to-html
  "Returns an HTML-based description of the right-hand side of a production.."
  [{:keys [name rhs] :as production}]
 (h/html [:table  {:border "0" :cellborder "0"}

          conditions
          (range)))))

(defn- production-to-dot [production]
  (let [condition-to-ids (condition-to-id-map production) 

        ;; Identify root conditions by first finding all children,
