This section covers the core BRE concepts that you need to understand before delving into the practical examples throughout the remainder of the chapter.
BRE rules are expressed in this following format: IF <CONDITION> THEN <ACTION>. Note that there is no ability to express an ELSE clause. To implement such a clause, you just use an opposite rule.
A number of algorithms are available to implement rules engines. The BRE, the focus of our attention here, uses the Rete (Latin for "network") algorithm. The Rete alogorithm was designed by Dr. Charles Forgy in 1978, and is available in the public domain. Subsequent to the development of the original Rete algorithm, Rete II and Rete III have been developed. Both offer higher levels of performance but, unlike Rete, are not available in the public domain.
The Rete algorithm, a highly optimized and scalable rules engine algorithm, executes both small and large rulesets quickly (in most cases). It scales particularly well when dealing with a large ruleset (as explained in the following section).
You don't have to understand the intricacies of the Rete engine to appreciate and make full use of the BRE. Therefore, this discussion avoids the complexities and instead provides some examples that explain the fundamentals. If you must know more about Rete, you can find plenty of in-depth discussions on the Internet (but be prepared for some heavy reading).
So, how does the Rete ...