           :path     (:path     state)}]))))
 
 (defn required-keys-for-type [parent-type]
-  (set (for [[t _ k]  (*schema-rules* [:requires-key parent-type])
+  (set (for [[t _ k]  (schema-rules [:requires-key parent-type])
                   :when (= t parent-type)]
               k)))
 

      (fetch-pred :=> parent-type)))

(defn all-types [parent-type]
  (let [res (map last (*schema-rules* [:-- parent-type]))]
    (distinct (cons parent-type (concat res (mapcat all-types res))))))

(defn all-predicates [parent-type]

     (group-by (juxt second first) spc))))

(defn fetch-pred [pred-type parent-type]
  (if-let [res (not-empty (map last (schema-rules [pred-type parent-type])))]
    [pred-type (first res) parent-type] ))

(defn leaf-pred? [parent-type]
