Skip Headers
Oracle® Fusion Middleware Business Process Composer User's Guide for Oracle Business Process Management
11g Release 1 (11.1.1.6.3)

Part Number E15177-10
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

8
Using Oracle Business Rules

This chapter describes how to use the Oracle Business Rules editor that is part of Business Process Composer. It contains a general introduction to Oracle Business Rules and provides tasks for working with them.

Note:

You cannot create new business rules or rules dictionaries using Business Process Composer. You can edit rules dictionaries that were defined as part of the business catalog of a project template.

This chapter includes the following sections:

8.1 Introduction to Oracle Business Rules

This section provides a brief introduction to Oracle Business Rules.

Business rules are statements that describe business policies or describe key business decisions. For example, business rules include:

For example, a car rental company might use the following business rule:

IF
Rental_application.driver age < 21
THEN
modify Rental_application(status: "Declined")

An airline might use a business rule such as the following:

IF
Frequent_Flyer.total_miles > 10000
THEN
modify Frequent_Flyer (status : "GOLD")

A financial institution could use a business rule such as:

IF
Application_loan.income < 10000
THEN
modify Application_loan (deny: true)

These examples represent individual business rules. In practice, you can use Oracle Business Rules to combine many business rules or to use more complex tests.

Oracle Business Rules allow process analysts to change policies that are expressed as business rules, with little or no assistance from a process developers. Applications using Oracle Business Rules support continuous change that enables the applications to adapt to new government regulations, improvements in internal company processes, or changes in relationships between customers and suppliers.

Business rules follow an if-then structure and consists of two parts:

Alternatively, you can express rules in a spreadsheet-like format called a decision table.

8.1.1 Introduction to Rule Conditions

The rule IF part is composed of conditional expressions, rule conditions, that refer to facts. For example:

IF Rental_application.driver age < 21

The conditional expression compares a business term (Rental_application.driver age) to the number 21 using a less than comparison.

The rule condition activates the rule whenever a combination of facts makes the conditional expression true. In some respects, the rule condition is like a query over the available facts in the Rules Engine, and for every row returned from the query the rule is activated.

8.1.2 Introduction to Rule Actions

The rule THEN part contains the actions that are run when the rule is fired. A rule is fired after it is activated and selected among the other rule activations using conflict resolution mechanisms such as priority. A rule might perform several kinds of actions. An action can add facts, modify facts, or remove facts. An action can run a Java method or perform a function which may modify the status of facts or create facts.

Rules fire sequentially, not in parallel. Note that rule actions often change the set of rule activations and thus change the next rule to fire.

8.1.3 Introduction to Decision Tables

A Decision Table is an alternative business rule format that is more compact and intuitive when many rules are needed to analyze many combinations of property values. You can use a Decision Table to create a set of rules that covers all combinations or where no two combinations conflict.

8.1.4 Introduction to Facts and Bucketsets

In Oracle Business Rules, facts are the objects that rules reason on. Each fact is an instance of a fact type. You must import or create one or more fact types before you can create rules.

In Oracle Business Rules a fact is an asserted instance of a class. The Oracle Business Rules run time or a developer writing in the RL Language uses the RL Language assert function to add an instance of a fact to the Oracle Business Rules Engine.

In Rules Designer you can define a variety of fact types based on, XML Schema, Java classes, Oracle RL definitions, and ADF Business Components view objects. In the Oracle Business Rules run time such fact type instances are called facts.

You can create bucketsets to define a list of values or a range of values of a specified type. After you create a bucketset you can associate the bucketset with a fact property of matching type. Oracle Business Rules uses the bucketsets that you define to specify constraints on the values associated with fact properties in rules or in Decision Tables. You can also use bucketsets to specify constraints for variable initial values and function return values or function argument values.

8.1.5 Introduction to Rulesets

A ruleset is an Oracle Business Rules container for rules and Decision Tables. A ruleset provides a namespace, similar to a Java package, for rules and Decision Tables. In addition you can use rulesets to partially order rule firing.

8.1.6 Introduction to Decision Functions

A decision function provides a contract for invoking rules from Java or SOA (from an SOA composite application or from a BPEL process). The contract includes input fact types, rulesets to run, and output fact types.

8.1.7 Introduction to Decision Points

Oracle Business Rules SDK (Rules SDK) provides APIs that let you write applications that access, create, modify, and run rules in Oracle Business Rules dictionaries (and all the contents of a dictionary). The Rules SDK provides the Decision Point API to access and run rules or Decision Tables from a Java application.

8.1.8 Introduction to Dictionaries

A dictionary is an Oracle Business Rules container for facts, functions, globals, bucketsets, links, decision functions, and rulesets. A dictionary is an XML file that stores the application's rulesets and the data model. Dictionaries can link to other dictionaries. Oracle JDeveloper creates an Oracle Business Rules dictionary in a.rules file. You can create as many dictionaries as you need. A dictionary may contain any number of rulesets.

8.2 Introduction to the Business Process Composer Rules Editor

The Business Process Composer rules editor enables you to view and edit a rules dictionary. Rules dictionaries are displayed in a tabbed window similar to the process editor and data association editor.

This window is divided into two main areas:

Figure 8-1 shows the Globals tab displaying information for the globals contained in the Sales Quote example project.

Note:

This tab only displays globals that were marked as final when the rules dictionary was created.

Figure 8-1 The Globals Tab of the Oracle Business Rules Editor

Description of Figure 8-1 follows
Description of "Figure 8-1 The Globals Tab of the Oracle Business Rules Editor"

Figure 8-2 shows the Bucketsets tab displaying details for the bucketsets contained in the Sales Quote example project.

Figure 8-2 The Bucketsets Tab of the Oracle Business Rules Editor

Description of Figure 8-2 follows
Description of "Figure 8-2 The Bucketsets Tab of the Oracle Business Rules Editor"

Figure 8-3 shows the Rulesets tab displaying details for the rulesets contained in the Sales Quote example.

Figure 8-3 The Rulesets Tab of the Oracle Business Rules Editor

Description of Figure 8-3 follows
Description of "Figure 8-3 The Rulesets Tab of the Oracle Business Rules Editor"

8.3 Viewing and Editing Business Rules in Business Process Composer

The following sections provide specific procedures for viewing and editing Oracle Business Rules using Business Process Composer.

8.3.1 How to Open a Business Rule

Oracle Business Rules can be included as part of the reusable business catalog, enabling you to use business rules when editing Oracle BPM projects created from project templates.

To open a business rule from the Project Navigator:

  1. From the project home page, expand Rules, then click the name of the rule you want to open.

The business rule appears in the rules editor. If you want to edit the rule, ensure that the project is in edit mode.

8.3.2 How to Add a Bucketset

Using Business Process Composer you can add new bucketsets to a rules dictionary.

To add a new bucketset:

  1. Open the rules dictionary where you want to edit the bucketset.

  2. Select the Bucketsets tab. This displays a table listing the bucketsets in the dictionary as shown in Figure 8-2.

  3. Click the Add Bucketset drop-down list, then select the type of bucket set you want to create.

    • List of values

    • List of ranges

  4. Select the bucketset from the list, then click Edit Bucketset.

  5. Edit the bucket set as required, then click OK.

8.3.3 How to Edit an Existing Bucketset

In Business Process Composer, selecting the Bucketsets tab shows you a table listing the bucketsets in the dictionary. To edit a bucketset, select the appropriate row and click the Edit icon. Depending on the type of the bucketset, Range, Enum, or LOV, this displays a corresponding Edit bucketset page.

You can create a Range Bucketset by clicking Add in the menu bar and selecting a type. This adds a new row in the Bucketsets table. Adding a bucket automatically adds an end point for a range bucket and a value for an LOV bucket based on the data type. You can modify the newly added bucket end point or value. Note that the alias is modified when an end point or value is changed.

To delete a bucketset, select a row and click Delete.

To edit a bucketset:

  1. Open the rules dictionary where you want to edit the bucketset.

  2. Select the Bucketsets tab. This displays a table listing the bucketsets in the dictionary as shown in Figure 8-2.

  3. Select the appropriate bucketset row and click the Edit Bucketset icon.

  4. Use the Bucketset Editor to edit the appropriate fields in the bucketset.

  5. Click OK to confirm the changes.

8.3.4 How to View Globals in the Oracle Rules Dictionary

When you open a rules dictionary, Business Process Composer displays the Globals tab. The Globals tab only shows final global variables (global variables with Final option selected).

You cannot create or delete global variables. From the Globals tab, in edit mode you can edit the Name, Description, and Value fields. For the Value field, you can use the expression builder to set the value.

To view globals:

  1. Open the rules dictionary where you want to view globals.

  2. Select the Globals tab. This displays a table listing the globals defined for this rules dictionary as shown in Figure 8-1.

8.3.5 How to Add a Rule to a Ruleset

Using Business Process Composer you can edit, add, and delete rules in a ruleset.

To add a rule to a ruleset:

  1. Open the rules dictionary containing the ruleset where you want to add a rule.

  2. Click the tab of the ruleset you want to edit. This displays a table listing the rulesets defined for this dictionary as shown in Figure 8-3

  3. Click the New Rule icon.

  4. Enter a name for the new rule.

  5. Click the Show Advanced Settings icon.

  6. In the IF area, use the controls, icons, and selection boxes, including the Left Value expression icon, drop-down list for an operator, and Right Value expression icon to modify the condition.

  7. In the THEN area for the rule, next to the rule action click Add Action.

  8. Click Save in the editor toolbar to save the changes to the rule dictionary.

8.4 Editing Oracle Business Rules at Run Time

You can use Business Process Composer to open deployed Oracle BPM projects. Opening a deployed project enables you to edit the Oracle Business Rules contained in the project and deploy your changes back to Oracle BPM run time.

Note:

When editing a deployed project, you can only edit the Oracle Business Rules for that project. You can view other project resources, but cannot edit them.

To open a deployed project:

  1. From the Project menu select Open a Deployed Project.

    If you are currently editing a project, your changes are automatically saved.

  2. Select Deployed Projects, then select the project you want to open from the project list.

  3. Expand Repository, then select the deployed project you want to open.

  4. Click Ok.

  5. In the Project Navigator, expand Business Rules then expand the rules dictionary where whose Oracle Business Rules you want to edit.

  6. Click Edit in the rules editor.

  7. Edit the rules as required, then click Save.

  8. Click Validate to ensure the changes you made to the business s made are valid.

  9. Click Commit to commit the changes to Oracle BPM run time.

  10. Click Yes.

  11. From the Project menu, select Close Project.

8.5 Assigning a Rule to a Business Rules Task

The business rules task is an Oracle BPMN element that enables you to incorporate Oracle Business Rules within a process model.

When editing a project based on a project template containing business rules in the business catalog, you can assign business rules to business rules task.

To assign a business rule to a business rules task:

  1. Open the process containing the business rules task you want to edit.

  2. Right-click the business rules task, then select Properties.

  3. Select the Implementation tab.

  4. Click Change. The displays the business rules browser containing a table of available business rules.

  5. Double-click a rule from the table.

  6. Click OK.