How to Use Advanced Mode Action Forms

This section explains how to use Advanced Mode Action forms.

When you create a rule with Advanced Mode, Rules Designer presents a list with the available actions shown in Advanced Mode Action Options in Rule Designer. For each form shown in Advanced Mode Action Options, the options that Rules Designer presents are context sensitive. Thus, the lists and the number of items you see when you work with the action types are context sensitive, depending on which action you add and the choices you make while you enter the action.

To use advanced mode action forms:

  1. In Rules Designer, select a ruleset from the Rulesets navigation tab.
  2. Select or add a rule or a Decision Table.
  3. In the rule or Decision Table click the Show Advanced Settings button next to the rule or Decision Table name.
  4. Select Advanced Mode.
  5. With the insertion areas showing, in a rule in the THEN area select <insert action>. This displays the action list.

    Figure 1-45 Adding an Action to a Rule in Advanced Mode

    Description of Figure 1-45 follows
    Description of "Figure 1-45 Adding an Action to a Rule in Advanced Mode"
  6. In the list, select the action you want to add.

    For example, select assign new.

  7. In the THEN area, select the context sensitive parameters for the action and enter appropriate values.

Advanced Mode Action Options in Rule Designer

Table 1-18 Advanced Mode Action Options

Action Form Description

Assert

Assert a fact

Assert Tree

Asserts a tree of facts given the root.

Assert New

Assert a new fact.

Assign

Assign a value to a variable.

Assign New

Assign a value to a new variable.

Expression

Perform expression.

Call

Call a function.

For

Oracle RL, like Java, has a for loop. A for loop includes a type with a variable and a collection. The type and variable defines the loop variable that holds the collection value used within the loop. Collection is an expression that evaluates to a collection of the correct type for the loop variable. You can use a for loop to iterate through any collection.

A return, throw, or halt may exit the action block.

If

Using the if else action, if the test is true, execute the first action block, and if the test is false, execute the optional else part, which may be another if action or an action block. Oracle RL, unlike Java, requires action blocks and does not allow a single semicolon terminated action.

Modify

Modify a data value associated with a matched fact.

Retract

Retract a fact.

Return

The return action returns from the action block of a function or a rule. A return action in a rule pops the ruleset stack, so that execution continues with the activations on the agenda that are from the ruleset that is currently at the top of the ruleset stack.

rl

Use an Oracle RL expression that you supply.

synchronized

As in Java, the synchronized action is useful for synchronizing the actions of multiple threads. The synchronized action block lets you acquire the specified object's lock, then execute the action-block, then release the lock.

throw

Throw an exception, which must be a Java object that implements java.lang.Throwable. A thrown exception may be caught by a catch in a try action block.

try

The try, catch, and finally in Oracle RL is like Java both in syntax and in semantics. There must be at least one catch or finally clause.

while

While the test is true, execute the action block. A return, throw, or halt may exit the action block.