Last active
August 29, 2015 13:57
-
-
Save paologf/9665581 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns clara-project.core | |
(:require [clara.rules.accumulators :as acc] | |
[clara.rules :refer :all])) | |
(defrecord SupportRequest [client]) | |
(defrule get-var1 | |
"SupportRequest count var1" | |
[?var1 <- (acc/count) :from [ SupportRequest]]) | |
(defrule get-var2 | |
"SupportRequest count var2" | |
[?var2 <- (acc/count) :from [ SupportRequest]]) | |
(defn print-all-test [session] | |
(prn "ALL TEST11 : " (query session get-var1)) | |
(prn "ALL TEST22 : " (query session get-var2))) | |
(defn -main [] | |
(let [ | |
session (-> (mk-session 'clara-project.core) | |
(insert (->SupportRequest "Acme") | |
(->SupportRequest "Dentist") | |
(->SupportRequest "Curling")) | |
(fire-rules))] | |
(print-all-test session))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defproject clara-project "0.1.0-SNAPSHOT" | |
:description "FIXME: write description" | |
:url "http://example.com/FIXME" | |
:main clara-project.core | |
:license {:name "Eclipse Public License" | |
:url "http://www.eclipse.org/legal/epl-v10.html"} | |
:dependencies [[org.clojure/clojure "1.5.1"] | |
[org.toomuchcode/clara-rules "0.4.0"]]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment