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

Summary

Predicates to deal with hierarchical property values. This keyword is used in any expression involving IlrRule.

Syntax

rule property access value match string value; 
rule property access value match up string value; 
rule property access value match updown string value; 
rule property access value match down string value; 

Description

The match predicates have two arguments: the left argument is an access to a rule hierarchical property. To make this possible, the rule property should have been defined in a propertydefinition section. The right argument is a string.

Example

Let Geography be a hierarchical property defined as follows:

hierarchy Geography { "North" 
  { "USA" { "California" { "San Francisco" } "Texas" { "Houston" "Paris" } } 
    "Europe" { "France" { } "Germany" } } 
} 

location be a rule property whose type is Geography,

and ?rule :

Given the sample code:

hierarchy Geography { "North" 
  { "USA" { "California" { "San Francisco" } "Texas" { "Houston" "Paris" } }
    "Europe" { "France" { } "Germany" } } 
} 
propertydefinition { Geography location; } 
rule usa { property location = "USA"; when { ... } then { ... } } 
rule california { property location = "California"; when { ... } then { ... } }
rule france { property location = "France"; when { ... } then { ... } } 
ruletask main 
{ 
  body = dynamicselect()
  { 
    Collection rules = collect IlrRule(?this.?location match up "California")
      in getRuleset().getAllRules(); 
    return rules; 
  } 
} 

In the above example the ruletask selects all the rules except the rule France.

See Also

hierarchy, rule