Combining Expressions

All expressions in RQL return the set of resources that correspond to that expression. You can combine expressions to produce more sophisticated queries using the following set operators:

  • union. Returns resources that are in either expression. For example:

    orgunit(name="Drivers").position(name="Developer") union orgunit(name="OsakaDev").position(name="JavaDeveloper")

    returns any resource who is either a Developer in the Drivers organization unit or a Java Developer in the OsakaDev organization unit.

  • intersect. Returns resources that are in both expressions. For example:

    orgunit(name="Drivers").position(name="Developer") intersect group(name="JavaDevelopers")

    returns any resource who is both a Developer in the Drivers organization unit and a member of the Java Developers Group.

    Use an intersect to specify multiple qualifier values for a capability or a privilege. (If the data type of the qualifier is EnumSet it is possible for the capability or privilege to have multiple qualifier values.) For example:

    capability(name='Language' qualifier='French') intersect capability(name='Language' qualifier='Spanish')

  • subtract. Returns resources that are in the first expression but not the second. For example

    orgunit(name="Drivers").position(name="Developer") subtract group(name="Managers")

    returns any resource who is a Developer in the Drivers organization unit but is not a member of the Managers Group.

  • not. Returns resources that are in the first expression but not the second. For example

    orgunit(name="Drivers").position(name="Developer") intersect not group(name="Managers")

    returns any resource who is a Developer in the Drivers organization unit but is not a member of the Managers Group.

Note: While similar in the resources they return, subtract will return the relative complement and should be used when performance is a consideration.

Another example might be:

(

orgunit(type="Support").position(type="SupportEngineer")

intersect

not group(name="Backdesk")

)

union

orgunit(name="Support).position(name="Manager")

This selects support engineers in the Support department who are not part of the back desk group, together with the support department's managers.

Combining expressions in this way can sometimes mean that a resource is included in the results for more than one reason. If this happens, the resource will only be included in the result set once; that is, there is no duplication of results.