Backus-Naur Form (BNF) definition of AQL

Here is the Backus-Naur Form (BNF) definition of the AQL language syntax so that you can see how the query language is constructed.

<aql> ::= <version> {<quick_terms>} | {<type> | <groupby> | <filter>}
<version> ::= any numeric number. Currently, we support only 1.
<quick_terms> ::= <word> | <and_words> | <or_words> | <exact_combined_words>
<and_words> ::= <word> (" " <word>)+
<or_words> ::= <word> ("OR" <word>)+
<exact_combined_words> ::= """ <and_words> """
<word> ::= any printable string except white spaces
<type> ::= "type" ("=" | ":") <typename> {"," <typename>}
<groupby> ::= "groupby" ("=" | ":") <groupname> {"," <groupname>}
<orderby> ::= “orderby” (“=”|”:”) <columnname> {“ASC”|”DESC”}
<filter> ::= <normal_filter> | <negative_filter>
<normal_filter> ::= <string_filter> | <time_filter> | <number_filter> | <enum_filter> |
<boolean_filter> | <ip_filter>
<negative_filter> :: = "not(" <normal_filter> ")"
<string_filter> :: = <string_field> <string_op> """ <string_val> """ {"," """ <string_val> """}
<string_op> ::= "=" | "!="
<time_filter> ::= <single_time_filter> | <between_time_filter> | <in_predefined_time_filter> |
<in_past_filter>
<single_time_filter> ::= <time_field> <single_time_op> <single_time_val> <!-- single_time_val is in
format of "yyyy-mm-dd hh:mm:ss" -->
<time_op> :: = "is before" | "is after" | "is not before" | "is not after"
<between_time_filter> ::= <time_field> <between_time_op> <between_time_val>
<between_time_op> ::= "is between" | "is not between"
<between_time_val> ::= <single_time_val> " and " <single_time_val>
<in_predefined_time_filter> ::= <time_field> <in_predefined_time_op> <predefined_time_val>
<in_predefined_time_op> ::= "is in" | "is not in"
<predefined_time_val> ::= "today" | "yesterday" | "this week" | "last week" | "this month" | "last month" |
"this year" | "last year"
<in_past_filter> ::= <time_field> <in_past_op> <digit>+ <unit_of_time>
<in_past_op> ::= "is in_past" | "is not in_past"
<unit_of_time> ::= "day" | "hour" | "minute"

Note:   Currently, AQL has filters only for strings and time.