RQL is a textual query syntax that is similar to SQL. It describes the set of conditions that must be matched by items of a particular item descriptor. The following is a simple RQL query that matches all items whose age property is greater than 30.

age > 30

Note: This RQL query omits the name of the item descriptor, which is usually implied by the context of the query’s use.

RQL supports all standard comparison operators and logical operators such as AND, OR, and NOT. For example:

age > 30 AND (lastName = "jones" OR paymentOverdue = true)

RQL keywords are case-insensitive—for example, keywords NOT and not are equivalent.

Constants such as 30, true, or jones can represent numbers, boolean, or String values. String values are represented with Java syntax. They must be enclosed by quotes, and escape sequences for special characters or UNICODE characters must use Java escape syntax.

Properties such as age or lastName must be property names as they are defined in the repository. For example, a database might have a column named phone that is mapped to the repository property primaryPhoneNumber. An RQL query must use the repository’s property name primaryPhoneNumber.

age > 30 and (lastName = "jones" or paymentOverdue = true)

RQL statements specify the conditions that an item must meet in order to be included in the result set. An RQL statement can also specify other directives to apply to the result set, such as ordering results and returning a portion of the result set.