• (apply-rule db rule)
  • (apply-rule db-1 db-2 rule)
Apply the rule against db-1, adding the results to the appropriate
relation in db-2. The relation will be created if needed.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/datalog/rules.clj:183 top

(defn apply-rule
  "Apply the rule against db-1, adding the results to the appropriate
   relation in db-2.  The relation will be created if needed."
  ([db rule] (apply-rule db db rule))
  ([db-1 db-2 rule]
     (trace-datalog (println)
                    (println)
                    (println "--------------- Begin Rule ---------------")
                    (println rule))
     (let [head (:head rule)
           body (:body rule)
           step (fn [bs lit]
                  (trace-datalog (println bs)
                                 (println lit))
                  (join-literal db-1 lit bs))
           bs (reduce step empty-bindings body)]
       (do (trace-datalog (println bs))
           (project-literal db-2 head bs)))))
Vars in clojure.contrib.datalog.rules/apply-rule: defn let println
Used in 0 other vars

Comments top

No comments for apply-rule. Log in to add a comment.