GraphQL Filter Specifications: QBE
While you can perform equality comparisons using GraphQL arguments, you can perform all other comparisons using the query-by-example (QBE) syntax.
QBE is analogous to where clause in SQL queries and is a slightly modified form of SODA QBE expression. To use this feature, you can specify the list of predicates for a table in the check clause or the where clause, and this clause is specified after the table name and before the list of directives.
For example, driver(check:{points:{_gt: 360}}) or driver(where:{points:{_gt: 360}}).
Note: Starting 23.26.1, Oracle supports using either the check: keyword or the where: keyword to introduce QBE-style predicates in the GraphQL table function. In the context of GRAPHQL() table function, check and where are equivalent and both are used to filter the query results. (For JSON-relational duality view definitions, CHECK can have different semantics, such as enabling WITH CHECK OPTION, while WHERE does not.)
Each predicate has the alias name for the column, followed by a QBE operator and then the comparison value. In the preceding example, points is the alias, _GT is the operator which will perform greater than operation and 360 is the comparison value, this is equivalent to “where points > 360”.
Oracle AI Database supports the following categories of operators for GraphQL developers:
-
Relational Operators : Includes comparison operators such as
_eq(equal to),_ne(not equal to) etc. -
Logical Operators: Includes operators such as
_andand_orto combine the predicates. -
Item Method Operators: Includes operators such as
_lower,_upperetc., which transforms the value and then uses for further filtering. -
Relational Operators in QBE
Relational operators in QBE are comparison operators that allows you to evaluate or check the relationship between two values, returning a Boolean result which allows filtering, searching or sorting the data in your queries. -
Logical Operators in QBE
Logical operators allow for combining, negating, or comparing conditions in a query where results must be based on whether conditions are true or false. -
Item Method Operators in QBE
Item Method Operators act on a JSON field, transform it's value and then compare it to the comparison value.