OGDI uses a subset of the
WCF Data Services query syntax. The basic format
of a filter expression is
property comparison expression,
where
property is the name of a property,
comparison is a comparison
operator, and
expression is the expression with which the property's
value should be compared.
Some examples of filter expressions using the CrimeIncidents data set from the DC
container are:
|
method eq 2
|
Crime incidents where the method code is equal to 2. Other comparison operators
include "gt" for greater than, "lt" for less than, "ge"
for greater than or equal to, and "le" for less than or equal to.
|
|
shift eq 'EVN'
|
Crime incidents where the "shift" property is equal to "EVN".
String literals must be enclosed in single quotes. Boolean literals are represented
as "true" or "false" (without the double quotes).
|
|
reportdatetime ge datetime'2008-06-01T00:00:00Z'
|
Crime incidents where the report date/time is on or after midnight, June 1, 2008,
UTC. Date/time literals are expressed in ISO 8601
format, yyyy-mm-ddTHH:MM:SS, where yyyy
is the four-digit year, mm is the two-digit month number, dd is the
two-digit day of the month, HH is the two-digit hour (in 24-hour format),
MM is the two-digit minute, and SS is the two-digit second.
|
|
(shift eq 'EVN') or (shift eq 'MID')
|
Crime incidents where the shift is equal to "EVN;" or "MID".
The filter syntax supports the "and", "or", and "not"
logical operators. Expressions can grouped with parentheses, as in many popular
programming languages.
|