Special nodes in the network
So far we have covered the basic types of nodes present in PHREAK that allow us to create simple rules in Drools. But there are some others nodes with very specific behaviors that are used for some conditional elements we haven't discussed so far. This section will analyze the most commonly used of these conditional elements: not, exists, accumulate, and from.
The Not Node
The not conditional element is the non-existential quantifier in Drools that checks for the absence of one or more patterns in the working memory.
Drools provides a specialized version of a Beta Node to implement the necessary logic of the not conditional element.
As an example, let's use the following rule:
rule "Sample Rule 1"
when
$c: Customer()
not (SuspiciousOperation(customer == $c))
then
channels["clean-customer-channel"].send($c);
end
This rule is activated when there is a Customer
in the session without any SuspiciousOperation
. With this example, we can tell that the not element...