Fork me on GitHub
#clara
<
2016-08-19
>
wparker08:08:49

@flavio : So the or is on two different conditions on the same fact? It sounds like this need not fire twice. Or conditions in the constraints on a single fact condition don’t produce multiple firings, that is only for :or conditions that are actually part of the Rete network. I think of something like [:or B C] as firing for all elements of the union of B and C, to put it differently, whereas conditions like [B (or pred1 pred2)] are still one set that just calls clojure.core/or to determine what facts of type B should be members of that set. A concrete example might help; https://github.com/rbrush/clara-examples/blob/master/src/main/clojure/clara/examples/booleans.clj#L41 will fire once per matching Order, while https://github.com/rbrush/clara-examples/blob/master/src/main/clojure/clara/examples/booleans.clj#L19 will fire once per matching NewCustomer or ValuedCustomer. If you have a single fact that you’re trying to test it sounds like you want something more like new-or-valued-customer-basic-coupons in that examples page; the :or condition functionality is really just shorthand for writing multiple rules in a single defrule in the code. Does this help? It is a bit confusing because we’re using the same word “or” to mean fundamentally different things.

wparker08:08:46

Also, you may have seen http://www.clara-rules.org/docs/booleans, but if you haven’t that could be helpful. The key point though is that that only addresses booleans created like https://github.com/rbrush/clara-examples/blob/master/src/main/clojure/clara/examples/booleans.clj#L19 ; the way to distinguish the cases visibly is what is a clojure keyword (:or :and) versus a normal Clojure function call like (or… or (and...