Retaking rules for developers

Rules can greatly simplify business logic, but often come in the form of limited mini-languages and complex tools. Let's take them back.

Simple

Clara offers a simpler way to express domain knowledge in code, without the weight of an enterprise rule system.

Expressive

Simple rules stay simple, but users can write rich logic or invoke external libraries when they need to.

It's just Clojure

Rules are just Clojure code, and can be managed and reused like anything else.

(defrule work-approval
  "Check order approval."
  [WorkOrder (= type :repair)
             (= ?order-id order-id)]
  [:not [ApprovalForm (= ?order-id approved-id)
                      (= formname "27B-6")]]
  =>
  (insert! (->MissingApproval ?id "No 27B-6.")))
Check out the developer guide.

Easily used from Java

Just include your rules as a resource and use Java Beans or Clojure records as facts.

List<QueryResult> results =
  RuleLoader.loadRules("clara.examples")
    .insert(facts)
    .fireRules()
    .query("clara.examples/approvals");

for (QueryResult result: results)
  System.out.println(result.getResult("?id"));
See the Java documentation for more.

Drawn from multiple worlds

Clara aims to combine the best ideas from expert systems, functional programming, and the best known develpment practices.

Learn more about Clara's approach.

And many other features...

Clara supports the features you'd expect from a rule engine, such as support for truth maintenance, durability, rule activation explanations, accumulators to reason across sets of facts, and others.

Get Started