You can express a business policy in one or more action rules.
An action rule defines the specific actions that are taken if particular conditions are met. An action rule consists of definitions, conditions, and actions.
In a rule editor, your rules appear as complete sentences because they use a natural-language, but when editing them you see that they are made up of combinations of modifiable building blocks that represent business terms, operators, and values. For example, the following action rule expresses the policy statement reject the loan of customers whose credit score is below the minimum of 200 and uses a number of building blocks:
if the credit score of ‘the borrower’ is less than 200 then in 'the loan report' , reject the loan with the message "Credit score too low.";
The building block the credit score of the borrower is a business term, is less than is an arithmetic operator, and 200 is a value.
You integrate business rules into your enterprise environment so that they are executed whenever a business application calls them. A business rule is integrated in such a way that it has access to the data values of relevant business terms that the rule requires for execution. In this example, the action rule needs to know the credit score of the borrower applying for a loan, and needs to be able to manipulate the loan report.
Action rules have the following basic structure:
definitions
You use the optional definitions part of a rule to define variables for use in the action rule.
In this example, no rule variables are defined.
if
You use the optional if part of a rule to specify the conditions under which the actions in the then and else parts are carried out.
In this example, the single condition imposed on the business data is that the credit score of the borrower must be less than 200.
then
You use the mandatory then part of a rule to define one or more actions to be taken if the conditions defined in the if part are true.
In this example, two actions are taken: an explanatory message is provided and the loan is rejected. These actions are taken only if the input data satisfies the condition that the credit score of the borrower is less than 200.
else
You use this optional part of the rule to define one or more actions to be performed if the conditions in the if part are false.
In this example, no alternative actions are defined: if it is not true that the credit score of the borrower is less than 200, no actions are taken.