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.
Symbol | Description |
---|---|
= | Equality |
!= | Inequality |
< | Less than |
> | Greater than |
<= | Less than or equal to |
>= | Greater than or equal to |
- 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
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
dcterms:creator= <http://host:port/oslc/os/oslcperson/
<URI id for person Kelly Reese>
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
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.