Databases Reference
In-Depth Information
Using Business Rules to
Implement Services
We have looked at how we can use the rules engine to define business rules that
can then be invoked as a decision component within a composite. The examples
we have used so far have been pretty trivial. However, the rules engine uses the
Rete algorithm, which was developed by researchers into artificial intelligence in
the 1970s.
Rete has some unique qualities, when compared to more procedural-based
languages such as PL/SQL, C, C++, or Java, making it ideal for evaluating a
large number of interdependent rules and facts. This not only makes it simpler
to implement highly complex rules than would typically be the case with more
procedural-based languages, but also makes it suitable for implementing particular
categories of first-class business services.
In this chapter, we look in more detail at how the rule engine works, and armed
with this knowledge, we write a set of rules to implement the auction algorithm
responsible for determining the winning bid according to the rules set out in
Chapter 10 , oBay Introduction .
How the rule engine works
So far, we have only dealt with very simple rules that deal with a single fact. Before
we look at a more complicated ruleset that deals with multiple facts it's worth taking
some time to gain a better understanding of the inner workings of the rule engine.
The first thing to take into account is that when we invoke a ruleset, we do it through
a rules session managed by the decision function (or service). When invoking the
decision function, it first asserts the facts passed in by the caller. It then executes the
ruleset against those facts, before finally retrieving the result from the rule sessions.
Search WWH ::




Custom Search