                (ancestoro c p)
                (l/== q true))))))
 
-  (pldb/with-db db
+  (pldb/with-db db3
+    (l/run 10 [sha]
+     (l/fresh [obj-sha]
+       (r-tree sha "project.clj" :blob obj-sha))))
+
+  (pldb/with-db db3
     (l/run* [filename]
      (l/fresh [sha ftype]
-       (r-tree sha filename ftype (str->sha "7a317ed2bc19d4518d403f011a1f542b67e96ef")))))
-  (pldb/with-db db
+       (r-tree sha filename ftype (str->sha "7b3e68a8839aeb4")))))
+  (pldb/with-db db3
     (l/run 5 [dirname]
             (l/fresh [obj-sha proj-dir-sha otherdir]
                      (r-tree proj-dir-sha "project.clj" :blob obj-sha)
                      (r-tree otherdir dirname :tree proj-dir-sha))))
+  (pldb/with-db db3
+    (l/run 5 [q]
+           (l/fresh [a b c d e f g]
+                    (r-proj a b c d e f g)
+                    (l/== q [a b c d e f g]))))
   )
 
 (def my-write-handlers

      (when-not (= 128 (:exit (ex-data e)))
        (println "Ignoring error:" (pr-str e)))
      nil)))

(defn origin-branches
  [gitdir]

                     (r-commit-parent childer nparent)
                     (ancestoro nparent parenter))])))

(defn sem-ver-parse [ver-str]
  (let [vparts (re-matches #"(?:(\d+)\.)?(?:(\d+)\.)?(?:(\d+)-)?(.*)" ver-str)
        [vqual & vnums] (reverse (filter identity (next vparts)))
        [vmajor vminor vinc] (map #(if (and (string? %) (re-matches #"[0-9]*" %))
                                     (Integer/parseInt %)
                                     %) (reverse vnums))]
    [vmajor vminor vinc vqual]))

(defn add-r-projs
  [gitdir db]
  (pldb/with-db db
    (let [proj-blobs (l/run* [blob-sha]
                       (l/fresh [proj-dir-sha]
                         (r-tree proj-dir-sha "project.clj" :blob blob-sha)))
          read-blobs (l/run* [blob-sha]
                       (l/fresh [proj-name vmajor vminor vinc vqual has-snaps?]
                         (r-proj blob-sha proj-name
                                 vmajor vminor vinc vqual has-snaps?)))
          blobs-to-read (apply disj (set proj-blobs) read-blobs)]
      (reduce
       (fn [db blob-sha]
         (if-let [proj (robust-read-proj-blob gitdir blob-sha)]
           (let [proj-name (symbol (:group proj) (:name proj))
                 has-snaps? (some #(.contains ^String % "-SNAPSHOT")
                                  (map second (:dependencies proj)))
                 [vmajor vminor vinc vqual] (sem-ver-parse (:version proj))]
             (pldb/db-fact db r-proj blob-sha proj-name
                           vmajor vminor vinc vqual has-snaps?))
           db))
       db
       blobs-to-read))))

(comment
  (def xdb1 (pldb/db [r-tree :a :b :c :d]))
  (pldb/with-db xdb1 (l/run* [a] (r-tree a :b :c :d)))
