cloj-rules-engine is a very simple rules engine written in Clojure and designed to work with Java.
Features:
Each rule has a condition (composed of conditional expressions -written in Clojure- that refer to facts), and a set of actions that are activated if the condition is satisfied. Facts are the data upon which rules operate. The fired actions are a represented as a set of identifiers (strings).
Rules are expressed in a simple and easy to read Clojure format (clojure maps)
{
:RULE_1 {:cond "(and (< #A 10) (> #B 50))"
:actions ["action-1"]}
...
}
(update-map-facts {"#A" "14"})
PersistentArrayMap facts_map = new PersistentArrayMap(new Object[] {
"#A", "14"
});
clrules.updateMapFacts(facts_map);
This library can be used from Java or Clojure code
Third party libraries used in this project:
Libs | Version | License |
---|---|---|
clojure | 1.8.0 | |
tools.logging | 0.3.1 | |
log4j | 1.2.17 | |
data.json | 0.2.6 | |
proto-repl | 0.3.1 | |
math.numeric-tower | 0.0.4 |
Main methods:
(initialize "rules.clj")
clrules.initialize("rules.clj");
(update-map-facts {"#A" "14"})
clrules.updateMapFacts(facts_map);
(get-rules-actions)
clrules.getRulesActions();
get-fired-rules
initialize-from-json
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close