The Rule language

Now that we have executed our first rule, it is time to learn a little bit more about the language that we use to define them. In order to do this, we will start by analyzing the rule that we wrote previously and then we will start creating more advanced rules.

All the rules and examples contained in this section can be found in the chapter-02/chapter-02-kjar/ project. We will use this project throughout the rest of the chapter to store different rules.

As it was mentioned in the first chapter, the rule structure is composed of the conditions and consequence, as follows:

rule "name"
when
    (Conditions) - also called Left Hand Side of the Rule (LHS)
then
    (Actions/Consequence) - also called Right Hand Side of the Rule (RHS)
end

The ...

Get Mastering JBoss Drools 6 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.