Query language syntax

This information describes the syntax of the query language.

WQL queries can have AND or OR operators between two conditions. The AND operator has a higher precedence than the OR operator. This means the AND logical operation is evaluated before an OR operation.

Grouping of search predicate using parenthesis is not currently supported in the search user interface. Given this limitation and the fact that AND operator has a higher precedence than OR operator to define a search of the form (A or B) and C, you first need to do some transformations so parenthesis are not needed. Using this example, the search specification is transformed to A and C or B and C. In this form parenthesis is not needed and therefore can be defined using the search user interface.

Query term Query elements
compound_query
::= query 'intersect' compound_query
 | query 'union' compound_query
query
::= basic_query | range_query
basic_query
::= 'select' selectables 
 'from' container 
 ['inner join on' predicate ]
 ['where' predicate ]
 ['order by' orderables ] 
 ['group by' selectables ]
container
::= ‘catalog' ‘(‘ catalog_name ‘)'
 | ‘hierarchy' ‘(‘ hierarchy_name ‘)'
 | ‘collaboration_area' ‘(‘ collaboration_area_name ‘)'
range_query
::= 'select range' start_index 'to' 
 end_index selectables_list
 | 'select first' count selectables_list 
 | 'select last' count selectables_list
 'from' container
 ['where' predicate]
selectables
::= selectable
 | selectable ‘,'selectables
selectable
::= attribute
 | ‘inner_join' ‘(‘ attribute ‘)'
 | ‘max' ‘(‘ attribute ‘)'
 | ‘min' ‘(‘ attribute ‘)'
 | ‘sum' ‘(‘ attribute ‘)'
 | ‘count' ‘(‘ attribute ‘)'
 | ‘avg' ‘(‘ attribute ‘)'
orderables
::= orderable
 | orderable ‘,' orderable
orderable
::=  attribute ['asc'|'desc']
attribute
::=  leading_attr
 | attribute ‘.' named_attr
 | attribute spec_driven_attr
leading_attr
::=, 'item'|'category', 
named_attr
::= ‘item'|'category'|'pk'|'name'|'path'
spec_driven_attr
::= ‘[‘ attribute_path ‘]'
attribute_path
::= spec name ‘/' attribute name
predicate
::=  expr
| expr logic_op predicate
expr
::= attribute binary_op const_attr
| ‘upper' ‘(‘attribute‘)' binary_op const_attr
| [‘not'] ‘exists' attribute
| attribute ‘is' [‘not'] ‘null'
| search attribute op const attribute
| named or indexed search attribute op named or 
indexed search attribute
| search attribute [‘not']‘in' '('WQL subquery ')'
| search attribute ‘in' ‘SQL' '('SQL subquery ')'
| search attribute op WQL subquery
| search attribute op 'SQL' '(' ' "SQL subquery" ' ')'
| '[not] exists' WQL subquery
| '[not] exists' 'SQL' '('SQL subquery ')'


binary_op
::= '>'|'<' | ‘!=' | ‘<=' | ‘>=' | ‘like' |'='
logic_op
::= 'and'|'or',
constant_attr
::=  single quoted string
| number
|'path' ‘(‘ path_string ‘,' path_separator ')'
|'date' ‘(‘ date_string ‘,' date_format ‘)'