| Reference > Rule Languages > ILOG Rule Language > IRL Keywords > body (in Rule Task) |
body (in Rule Task) |
PREVIOUS NEXT |
The keyword used to define a rule task body. This keyword is used in the ruletask definition
(1) ruletask ruleTaskName
{
body {ruleName1, ..., ruleNamen}
};
(2) ruletask ruleTaskName
{
body = select([variableName])
{
action1;
...
actionn;
}
};
(3) ruletask ruleTaskName
{
body = dynamicselect([variableName])
{
action1;
...
actionn;
}
};
(4) ruletask ruleTaskName
{
body = dynamicselect([variableName])
{
action1;
...
actionn;
} in Expression;
};
In syntax (1) the rule task body is composed of the rules that have been explicitly listed by their names. These rules must belong to the same ruleset as the rule task.
In syntax (2) the rule task body has been specified by comprehension: the rules composing the task body have not been explicitly listed. The contents of the task body will be computed by executing the code given as body for each rule in the ruleset. This body definition can be seen either:
boolean, with an argument of type ilog.rules.engine.IlrRule, in which case a variable name is specified. The code is executed for each ruleset rule: when it returns true, the rule becomes part of the rule task; otherwise it does not.
ilog.rules.engine.IlrRule[]. In this case the rule task body contains the rules returned by the code.
In all cases for syntax (2), the code is executed only once for the task, even if the task is executed several times. It is evaluated the first time it is needed.
In syntax (3) the difference with synopsis (2) is the time at which the body is computed before each task's execution. This is useful when the body content depends on variables whose values change during the ruleflow execution.
In syntax (4) you can specify a domain, of type ilog.rules.engine.IlrRule[]. When the domain is specified, the code of the dynamicselect iterates on the rules of the domain to determine if they are part of the rule task or not. With the specified domain, the rule engine knows the superset of rules that will compose the rule task. When the rule task execution mode is Sequential, it means that the superset needs to be processed (JIT) only once, even if the task body is dynamic. If no domain is given, the iteration is done on the whole ruleset.
ruletask DetectGridFull
{
ordering = literal;
firinglimit = 1;
body = { DetectGridFull }
};
ruletask ExpandObjects
{
ordering = dynamic;
firing = allrules;
body = select(?rule)
{
String ?task = ?rule.getProperties().getString("task","");
return ?task.equals("ExpandObjects");
}
};
| Copyright © 1987-2008 ILOG S.A. All rights reserved. Legal terms. Documentation homepage. | PREVIOUS NEXT |