PR Feature comparison

From RIF
Revision as of 18:25, 6 January 2009 by PaulVincent (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Features
Clips 6.3 Jess 7.1 Drools 4.0.7 JRules ? OPSJ ? BusinessEvents 3.0
Conditional Elements
and x x x x x x
or x x x x x
exists x x x x x x
not x x x x x x
forall x x x x
collect x(via accumulate) x x  ?
accumulate x x  ?
accumulate functions x
from x x(in)  ?
set x(from)  ?
eval x(test) x(test) x(eval) x(evaluate) x(?) x(evaluate)
Pattern Matching
slot specific modifies x(default in COOL) x  ?
pattern bindings x x x x x x
field bindings x x x x x x
direct accessor x x x x x
nested accessor x x x x
lists x x x x x  ?
maps x x x x x  ?
list pattern matching x(via test) x x x  ?
no-loop/no-repeat x (rule) x(rule+match) x(Default, rule) x
consequence keywords
assert x x x x x x
retract x x x x x x
modify x x x x x x
logical assert (TMS) x x x x x x

Conditional Elements

or CE is different to an infix boolean operation. In production rules there is actually no such thing as an 'or' CE. What it does is rewrite the network through a number of transformations to move the 'or' to the root of the tree, in this way there is no 'or' just subrules representing each of the possible outcomes. These sub rules operate independantly, as though they where individual rules.

exists and not Universal quantifiers, often 'exists' is written internally as two 'nots'. These check on the existence and non existence of a pattern. Because of the way that PR systems delay the rule firing, via the agenda, the "truth" of these CEs is always maintained. For instance a 'not' CE may start of true and place activations onto the agenda, during the course of populating the working memory (before fireAllRules is called) the patttern is matched and the CE is no longer true and all created activations will be cancelled, before they fired.

Some engines support nested multiple CEs and patterns and others do not. For the first round I have not included this information, so assume I am talking about a single pattern for the 'not' and 'exists' here.

for all Checks that the pattern is true for all matched elements. Like 'not' and 'exist' it will maintain the "truth" in the system.

accumulate Jess was the first of the mainstream engines to add this. It provides a way to aggregate matching patterns to create a result - sum, average, total etc. Typically 'accumulate' has init, action, result parts. The accumulate results in a "derived" fact, as it does not exist in the working memory.

accumulate fuction Where as accumulate has an init, action and result parts an accumulate function does not. Instead a predefined function is used that encapsulates those parts.

collect' Is a cardinality quantifier, it allows you to find matching patterns against a given cardinality - more than six red buses. The matching set of Data is returned as a list, which is also a "derived" fact as it does not exist in the working memory. Jess does not implement 'collect', but in reality 'collect' is just a specialist implementation of 'accumulate' which can emulate collect.

from Allows a pattern to match against non working memory data. The Pattern will iterate over the data "from" the source. That source can be any expression, this allows the engine to reason over nested data or on data returned from method call which may involve pulling data from a database. JRules use the keyword 'in' for this, they use 'from' like 'set' below. I believe this to be semantically incorrect. A pattern input is "from" a source, or a matched pattern is "set" to a source value.

set If a Pattern source returns a set of data it may be desirable to bind to that set and not iterate it. 'set' will filter and bind to the propagated data, where as 'from' will attempt to iterate and match the contents if it is a set. JRules uses 'from' to mean set, as discussed above.

Patttern Matching

no loop Clips does not implement no-loop. Drools and Jess, but differently. For Drools the no-loop is specific to the rule and the row of matched data, so recursions on modifies is blocked, but not recursions on new data. Jess is rule specific, so no recursion can happen blocking both modify and assert for that rule. JRules (I think) is also rule specific and is on by default.

Action Keywords

Notes

TIBCO BusinessEvents uses a query specification for set operations (forall, collect, etc) outside of production rules (although the results, stored in facts, can be used in a rule: e.g. the sum of set S, the attribute of membership of collection in C, etc.