Reference > Rule Languages > ILOG Rule Language > IRL Keywords > agendafilter

Summary

The keyword used to define an agenda filter in a rule task. This agenda filter will be used if the rule task's algorithm is RetePlus. This keyword is used in ruletask definition.

Syntax

(1) ruletask ruleTaskName  
    { 
      agendafilter = filter (variableName) 
      { 
          action1 
          ... 
          actionn 
      }
    }; 
 
(2) ruletask ruleTaskName  
    { 
      agendafilter = value;
    }; 

Description

Syntax (1) presents a way to define an agenda filter in the rule task. In this case the code of the agenda filter is inlined in the task definition. It can be seen as an IRL function with an ilog.rules.engine.IlrRuleInstance parameter and whose return type is Boolean. The variable in parentheses represents this IlrRuleInstance object. It can be referenced in the inlined code of the agenda filter. Ruleset variables are accessible from the agenda filter code. This agenda filter will be applied on each instance of rules that compose the task body. The instance for which the agenda filter returns true will be effectively fired; otherwise it is not.

Syntax (2) presents a second way to define an agenda filter in the rule task. In this case the agenda filter is an instance of a class that will implement ilog.rules.engine.IlrAgendaFilter. This filter will be applied on each instance of rules that compose the task body. The instance for which the agenda filter returns true will be effectively fired; otherwise it is not.

Examples

ruletask ruletask1
{
   body = select(?rule) {return true;}
   agendafilter = filter(?instance)
   {
      String name = ?instance.ruleName;
      return inputParam.contains(name);
   }
};

This example defines a rule task ruletask1 whose body is composed of all the ruleset rules. The agenda filter defined on the task filters the rule instances contained in the rule task. Only those rule instances with their names contained in the input parameter of the ruleset are executed; the others are not.

ruletask ruletask1
{
   body = select(?rule) {return true;}
   agendafilter = new MyAgendaFilter();
};

This example defines another rule task whose body is composed of all the ruleset's rules. The agenda filter defined on the task is an instance of the Java class MyAgendaFilter that will implement ilog.rules.engine.IlrAgendaFilter.

See Also

ruletask