Piper Push Cache Documentation Download Samples Contact  

Filters

Filters are prefix notation expressions where the delimiters of the expressions are parenthesis. A simple AND expression looks like:

(and true false)

Expressions can be nested as well.

(and (or true false) true (or false (and true false)))

Of course an expression of all constant values would alway yield the same result and is not much use for filtering. Paths are used to retrieve values from the JSON being checked. A path is simply a set of characters that uses a / or . delimiter to navigate the JSON and return the value at the end of the path. A more useful example of a filter using paths is:

(and (equals class "MyClass ") (<= favorite.number 3))
      

The case insensitive operations available are:

and Logical AND of the arguments.
or Logical OR of the arguments.
not Logical NOT of the first argument.
equals
=
==
Returns true if all the arguments are of the same value.
<
lt
Returns true if the first argument is less than the second otherwise false is returned.
<=
lte
Returns if the first argument is less than or equal to the second argument otherwise false is returned.
>
gt
Returns true is the first argument is greater than the second otherwise false is returned.
>=
gte
Return true if the first argument is greater than or equal to the second argument otherwise false is returned.
size Returns the size of the first argument.
member
include
Returns true if the first argument is a member of the second otherwise false is returned.

Constant value can be used in the expressions. The parsing rules for each type are:

null Represented by the sequence 'null' or 'nil'.
boolean Represented by either 'true' for true or 'false' for false.
number A sequence of digits following the accepted format for integers and floating point numbers.
string A set of characters delimited by double quotes.
path A set of alphanumeric characters plus delimited but either / or . characters. Some special characters such as _ and - are also allowed.
JSON JSON can also be included in the filter. Generally this if for specifying arrays or simple maps. Maps should be surrounded by {} while arrays use the [] markers.