       [link 'b 'd]
       ))
   
-  (defn has-parent?
+  (defn childo
     [x]
     (fresh [z] (link z x)))
   
   (pldb/with-db dbg-facts
     (run* [childs]
-      (has-parent? childs))
+      (childo childs))
     ))
 
 

      ))
  
  (pldb/with-db dbg-facts
    (run* [childs]
      (has-parent? childs))
    ))



  
  (def parent-view (into {} (:parent-rels db)))
  (def childs-view (into {} (map (comp vec reverse)) (:parent-rels db)))
  (defn has-parent? [c] (contains? childs-view c))
  (keys childs-view))



(defn test-dbg-4
  "Different modelization: using unify and clojure.set/join"
  []
  
  ;;Based on the amazing API:
  ;;(uni/unify '((?a * ?x ** 2) + (?b * ?x) + ?c) '(?z + (4 * 5) + 3))
  
  (def parent-rel '[::parent ?parent ?child])
  (def parent-db
    [[::parent 'a 'b]
     [::parent 'a 'c]
     [::parent 'b 'c]
     [::parent 'b 'd]])

  (def sex-rel '[?sex ?person])
  (def sex-db
    [[::male 'a]
     [::female 'b]
     [::male 'c]
     [::female 'd]])
  
  (defn bind-relation [rel values]
    (map #(uni/unify rel %) values))
   
  (defn get-children-sex
    []
    (let [children (bind-relation parent-rel parent-db)
          sexes (bind-relation '[?sex ?child] sex-db)]
      (map (juxt '?child '?sex) (set/join children sexes))
      ))
  
  (get-children-sex))


;; ---------------------------------------------------------
