If you see the default rule which is written in the FirstDroolsProgram project(Sample.drl), there are a lot of
keywords used. Let us explain them one by one now :
Java. When you create a new Rule by New -> Rule Resource -> then in the below window you need to mention the Rule name as well as package name.
Java. All the FACTS classes and any helper classes needs to be imported for the rules to work on. For ex:
com.sample.DroolsTest.Message;in the above example.
keywords. Post you have added the plugins you can see the drools specific keywords in red color. In the above example, rule-when-then-end are the different keywords.
rule keyword must be followed by a logical rule name.
when keyword must be followed by some condition.
then keyword must have the consequence part if the when condition is met.There are lot of other keywords which will be covered in further sections.
valuesadded in rule consequences, or for the rules to interact with the application.
Now let us walk you through the terms used in the Java file used to load the drools and execute the rules.