OpO FAST Web Server and Database
TQL
OpO

The FILTER clause can be used in all operations. It is used to filter the results from a WHERE clause. For example in a SELECT operation providing an expression that indicates the address.state must equal CA narrows the scope to those JSON documents with a state of California. A filter could then be used to only allow cities that were not Los Angeles. If the expression evaluates to true then the node remains in the result set.

All the WHERE clause functions can be used in addition to some functions only available in the FILTER clause. The additional FILTER functions can be one of the functions described on this page.

HAS(path)

Filters out all nodes that do not have a node at the end of the provided path.

Friendly Example

FILTER HAS(age)

JSON Example

{ "filter": ["has", "age"] }
NOT(expression)

Negates the expression.

Friendly Example

FILTER NOT(EQ(age, 63))

JSON Example

{ "filter": ["not", ["eq", "age", 63]] }
REGEX(path, regex)

Filters out all nodes that do not match the provided regular expression. If the node at the end of the path is not a string, UUID, or IRI.

Friendly Example

FILTER REGEX(name, "^P.*")

JSON Example

{ "filter": ["regex", "name", "^P.*"] }