You can use any one of the following operators in a <rule> tag. The operator strings are case-insensitive; for example, startsWith, STARTSWITH, and startswith are equivalent.

Note that some of these operators are not supported by certain repositories. For example, HTML and XML repositories do not support the includesAll operator. For more information, see the ATG Repository Guide.

The purpose and syntax of each of the rule tag operators is discussed below, with examples of each.

eq, neq, lt, gt, lteq, gteq

Represent an equality operation on the child tags.

Operator string

Operation

eq

equal to

neq

not equal to

lt

less than

gt

greater than

lteq

less than or equal to

gteq

greater than or equal to

Rules with each of these operators must have exactly two child tags. For eq and neq operators, there is no restriction on the types of child tags; however, they are generally expected to be compatible (i.e., one shouldn’t compare a Boolean value to an Integer). If the operation is not either eq or neq, the children must both be either Numbers, Strings or Dates.

Example: Using the lteq operator with a Date Constant - This example rule tests whether the lastLogin property indicates that the last time the user logged in was before 1998.

<rule op=lteq>
  <valueof bean="Profile.lastLogin">
  <valueof constant="12/31/97 11:59 pm">
</rule>

Example: Using the gt operator – This example rule tests whether the user has more money than sense.

<rule op=gt>
  <valueof bean="Profile.money">
  <valueof bean="Profile.sense">
</rule>
contains, startsWith, endsWith

Represent a string pattern matching operation on the child tags (i.e., does the first string contain, start with, or end with the second string?). Rules with the contains, startsWith, or endsWith attributes must have exactly two child tags. Both child tags must represent String values.

Example: Comparing strings with the startsWith operator – This example rule tests whether the longestJourney property in a profile starts with the string “a single step”.

<rule op=startsWith>
    <valueof bean="Profile.longestJourney">
    <valueof constant="a single step">
</rule>

Note that these string matching operations are case-sensitive. In the example above, the rule would not find a profile whose longestJourney property starts with “A single step”. For case-insensitive matching, you can use the containsIgnoreCase, startsWithIgnoreCase, and endsWithIgnoreCase operators.

includes, notIncludes

Represents a membership operation on the child tags (i.e., does the first child contain the second child as a member?). Rules with the includes or notIncludes operator must have exactly two child tags. The first child must represent an array or a Vector object. The second child can represent any non-null Object value. Note that not every element of the first child has to be of the same type as the second child; elements of different types are simply ignored during membership testing.

Example: includes Operator with a Constant Array – In this example rule, [book, article, thesis] is a constant array expression. The rule tests whether the value of the docType property of the target repository item is one of book, article, or thesis.

<rule op=includes>
  <valueof constant="[book, article, thesis]">
  <valueof target="docType">
</rule>
includesAny, notIncludesAny

Compares the memberships of the child tags. An includesAny rule evaluates as true if at least one of the members of the second child tag is also a member of the first child tag. A notIncludesAny rule evaluates as true if none of the members of the second child tag is a member of the first child tag. Rules with the includesAny or notIncludesAny operator must have exactly two child tags, both of which are array or Vector objects.

Example: includesAny Operator – In this example rule, keywords and favoriteSubjects are each String arrays. The rule tests whether any of the values of the keywords property of the target repository item match any of the values of the favoriteSubjects property of the profile.

<rule op=includesAny>
  <valueof bean="Profile.favoriteSubjects">
  <valueof target="keywords">
</rule>
includesAll, notIncludesAll

Compares the memberships of the child tags. An includesAll rule evaluates as true if all of the members of the second child tag are also members of the first child tag. A notIncludesAll rule evaluates as true if at least one of the members of the second child tag is not a member of the first child tag. Rules with the includesAll or notIncludesAll operator must have exactly two child tags, both of which are array or Vector objects.

Example: includesAll Operator – In this example rule, keywords and favoriteSubjects are each String arrays. The rule tests whether all of the values of the keywords property of the target repository item are also members of the value of the favoriteSubjects property of the profile. If any values of the keywords property are not found in the favoriteSubjects property, the rule returns false.

<rule op=includesAll>
  <valueof bean="Profile.favoriteSubjects">
  <valueof target="keywords">
</rule>
isOneOf, isNotOneOf

The same as includes, notIncludes, but with the order of the child tag arguments reversed. Represents a membership operation on the child tags (i.e., is the first child a member of the second child?). Rules with the isOneOf or isNotOneOf operator must have exactly two child tags. The first child can represent any non-null Object value. The second child must represent an array or a Vector object. Note that not every element of the second child has to be of the same type as the first child; elements of different types are simply ignored during membership testing.

Example: isOneOf Operator with a Constant Array – In this example rule, [book, article, thesis] is a constant array expression. The rule tests whether the value of the docType property of the target repository item is one of book, article, or thesis.

<rule op=isOneOf>
  <valueof target="docType">
  <valueof constant="[book, article, thesis]">
</rule>
includesItem

Evaluates to true if the Collection property contains an element that matches the query.

For example, if the item has an addresses property that contains multiple addresses, the following rule returns true for all items whose addresses property includes an address with the zip code 90210.

<rule op="includesItem">
  <valueof target="addresses">
  <rule op="eq">
    <valueof target="postalCode">
    <valueof constant="90210">
  </rule>
</rule>
and, or, not, any

Represent a logical and, or, or not operation on the child tags. Rules that use the and or the or operators must have at least one child tag. Rules that use the not operator must have exactly one child tag. Each of the child tags must represent a Boolean expression. The any operator is the same as the or operator, except that if the any operator is used in a rule with no child tags, then the rule evaluates as true.

matchId

Represents a lookup operation on the child tags (i.e., return all the items that have the IDs specified). May have one or more child tags. Each child tag must be a <valueof constant="..."> tag that specifies a valid ID for the content repository.

Example: matchId Operator – This rule returns items whose ID is either 14427 or 14428:

<rule op=matchId>
    <valueof constant="14427">
    <valueof constant="14428">
</rule>
elementAt

Represents a lookup operation on the child tags (i.e., get me the element from the second child at the index specified by the first child). Must have exactly two child tags. The first child must represent an Integer object. The second child must represent a value that will eventually evaluate to an array or a Vector object. Rules that use the elementAt operator cannot include subrules that use the <valueof target="..."> tag.

indexOf

Represents a reverse lookup operation on the child tags (i.e., what is the index of the first child in the second child). Rules using the indexOf attribute must have exactly two child tags. The first child can represent any non-null Object value. The second child must represent a value that will eventually evaluate to an array or a Vector object. Rules that use the indexOf operator cannot include subrules that use the <valueof target="..."> tag. Note that not every element of the second child has to be of the same type as the first child; elements of different types are simply ignored during equality testing. The tag itself eventually evaluates to an Integer object (with a value of -1 if the element is not found in the array or Vector).

Example: indexOf Operator - This example rule demonstrates the use of the indexOf operator:

<rule op=lteq>
  <!-- minimum clearance level required -->
  <valueof constant="5">
  <rule op=indexOf>
    <valueof bean="Profile.securityClearance">
    <valueof constant="[uncleared, confidential, restricted,
                        classified, critical_sensitive,
                        secret, top_secret]">
  </rule>
</rule>
count

Represents a count, or size, operation on the child tag (i.e., what is the number of elements in the child?). Rules using the count operator must have exactly one child tag. The child tag must represent a value that will eventually evaluate to an array or a Vector object. Rules that use the count operator cannot include subrules that use the <valueof target="..."> tag. The tag itself eventually evaluates to an Integer object.

Example: count Operator - This example demonstrates the count operator. This rule assumes you have a pagesViewed property in your Profile that stores an array of site pages, and evaluates as true if the user has viewed three or fewer pages.

<rule op=lteq>
  <valueof constant="3">
    <rule op=count>
      <valueof bean="Profile.pagesViewed">
    </rule>
</rule>
inSchedule

Represents an operation that determines whether the given time occurs in the given schedule. This attribute is used for such things as targeting to specific dates or days of the week. Rules using the inSchedule operator must have exactly two child tags. The first child tag must represent a value that will eventually evaluate to a Date object. The second child tag must represent a value that will eventually evaluate to a CalendarSchedule object. See the Scheduler Services section in the Core Dynamo Services chapter of the ATG Platform Programming Guide for information about the syntax for CalendarSchedule objects. Rules that use the inSchedule operator cannot include subrules that use the <valueof target="..."> tag.

Example: inSchedule Operator - This example demonstrates the inSchedule operator. This rule assumes you have a /atg/Calendar object of class Date, and evaluates as true if /atg/Calendar.today is a Monday in January, February, or March:

<rule op=inSchedule>
  <valueof bean="/atg/Calendar.today">
  <valueof constant="0-2 * 1 * *">
</rule>
inFolders

Represents a lookup operation (i.e., is the item in any of the folders specified in the child tags. The child tags represent folder IDs. The exact syntax and semantics of a folder ID depend on the type of content repository.

Example: inFolders Operator - This example demonstrates the inFolders operator. This rule evaluates as true for items found in either the someFolder or the anotherFolder folders:

<rule op=inFolders>
  <valueof constant="someFolder">
  <valueof constant="anotherFolder">
</rule>
isBetween, isNotBetween

Represents a range operation on the first child tag (i.e., does the first child tag fall between the second and third child tag?). Rules using the isBetween or isNotBetween operators must have exactly three child tags. The children must be Numbers, Strings or Dates. This is an inclusive operation; in other words, a rule evaluates to true if the first child tag is greater than or equal to the second child tag and less than or equal to the third child tag.

Example: isBetween Operator – This example demonstrates the isBetween operator. This rule evaluates to true if the value of the age property is between 21 and 55, inclusive.

<rule op=isBetween>
  <valueof bean="Profile.age">
  <valueof constant="21">
  <valueof constant="55">
</rule>
isNull, isNotNull

Represents a null check operation on the child tag. Rules using the isNull or isNotNull operator must have exactly one child tag. This tag eventually evaluates to a Boolean object.

Example: isNull Operator – This example demonstrates the isNull operator. This rule evaluates to true if the value of the birthday property is null.

<rule op=isNull>
  <valueof bean="Profile.birthday">
</rule>
textSearch

Takes three or four rule nodes. The first three represent the search pattern, the search string format, and the minimum score for matches. The fourth one (which is optional) is a target rule node that specifies a property to search against. For example:

<rule op="textsearch">
    <valueof constant="denim">
    <valueof constant="ORACLE_CONTEXT">
    <valueof constant="50">
    <valueof target="description">
</rule>