Query WHERE clause parameter

The oslc.where query parameter specifies a WHERE clause for filtering the result set of a query. For example, you might want to see a collection of OSLC work order resources that were created within a time range where the work orders are approved by management.

The OSLC WHERE clause supports the following comparison operators:
Symbol Description
= Equality
!= Inequality
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
OSLC WHERE clause parameters have the following characteristics:
  • Dates are expressed in ISO 8601 format.
  • The OSLC specification supports and as the boolean operator between boolean expressions. The boolean operator or is not supported.
  • String data type values are surrounded by quotation marks but decimal data type values do not have quotation marks.
  • Decimal data type values are not surrounded by quotation marks. In the following example, the literal value for status is in quotation marks because the status property has a data type of string. The quantity value does not have quotation marks because it is a decimal data type. Integers and boolean values also do not require quotation marks. For example, spi_wm:status="Closed" and m:quantity>10.5 and m:active=true where m:active has a boolean data type.
  • The WHERE clause supports or within a single property by using the in operator. For example, the following query returns all work orders that are in either APPR or WAPPR status:
    spi_wm:status in ["APPR","WAPPR"]

Example: Searching for work orders that were created within a time range and are approved

The following WHERE clause query returns a list of work order resources that were created within a specific time range:
spi_wm:status="APPR" and dcterms:created>"2003-07-07T09:50:00-04:00" 
and dcterms:created<="2004-07-07T09:50:00-04:00"

Example: Searching for all work orders created by a user

The following WHERE clause query returns all work orders that were created by a specific user or person:
dcterms:creator= <http://host:port/oslc/os/oslcperson/
<URI id for person Kelly Reese>
The URI value is delimited by angle brackets and is not surrounded by quotation marks, unlike string literal values. The URI points to the person resource named Kelly Reese. Although the use of a URI in the query syntax works for peer system integrations, interactive or UI-based consumers of the OSLC API would not know any of the relevant URIs. For example, an interactive user would know an asset number but would not know the URI that corresponds to that asset. The following WHERE clause query is expressed without a URI:
dcterms:creator{foaf:givenName=”Kelly” and foaf:familyName=”Reese”}

givenName and familyName are properties of the Person resource that is referred from the creator property. This WHERE clause demonstrates that you can search based on linked resource properties.

Example: Searching for all work orders where the parent property of the work order resource is null

The following WHERE clause query returns all root-level work orders:
spi_wm:parent!=”*”
In this example, * is a wildcard that refers to any resource and the parent!="*" query is the semantic equivalent of a parent="NULL" query.

A derivative of this query checks for work orders where the parent value is not NULL. The syntax of this query is spi_wm:parent=”*”. You can also perform a LIKE search with the OSLC WHERE clause query syntax. To search for all of the work orders that have a shortTitle value such as Inspect, you use the following query: oslc:shortTitle =”%Inspect%”.

To search for work orders that have a shortTitle value that begins with or ends with a word that you specify, you move the %. For example, use oslc:shortTitle =”Inspect%” to search for work orders that start with the word Inspect and use oslc:shortTitle =”%Inspect” to search for work orders that end with the word Inspect.