Syntax Conventions

The following sections of this document describe the different operations that can be executed using VQL. The notation and syntax conventions used for this description are provided below.

  • The language is case-insensitive. I.e. “CREATE VIEW” is equivalent to “create view”.

  • <rule> Name of a grammar rule. It indicates an element whose syntax will be specified later. If the separator : appears (e.g. <name:element-definition>), this indicates a name of a representative element followed by the name of the element that defines it.

  • ::= The element to the left of the symbol is defined by the constructs on the right.

  • [...] In the definition of a rule, elements within brackets are optional.

  • The asterisk (*) indicates that an element can be specified zero or more times. Example: [ <search_method_clause> ]* indicates that the element <search_method_clause> can appear zero, one or more times.

  • The plus sign (+) indicates that an element can be specified one or more times. Example: [<field>]+ indicates that the element <field> should appear at least once and can be repeated as many times as required.

  • Elements separated by the character | and possibly grouped between braces ({}) indicate alternative elements. For example: { BASIC | <authentication> } indicates that the token BASIC or the grammar rule authentication have to occur in this position.

  • The commas (,) are used in syntax constructions to separate the elements of a list.

  • The brackets (( )) normally serve to group expressions and increase priority. In some cases, they are required as part of the specific syntax of a statement.

  • A whitespace character can be a space, a horizontal tab, or a line-feed.

  • Identifiers (<identifier>) are the names of the elements of the catalog. If at least one of the characters of the identifier is not a number or in is not in the range of “a” to “z”, it is a <quoted identifier>. Therefore, it has to be surrounded with double quotes (e.g. "identifier with space"). Certain words cannot be used as identifiers. See the definition of <reserved VQL words> below, in Basic primitives for specifying VQL statements.

  • Numbers (<number>). A number is a combination of digits that can be preceded by the - symbol and can include a full stop as a decimal separator point and optionally an exponent (if they are real numbers).

  • Logical values (<boolean>). Representation of the true and false logical values.

  • Literals (<literal>). A literal is a sequence of characters surrounded by single quotes. A single quote has to be escaped with another single quote ('').

  • Operators (<operator>). Represent operators in the system.

Basic primitives for specifying VQL statements
<identifier> ::=
    <basic identifier>
  | <quoted identifier>

<basic identifier> ::=
  [A-Za-z][A-Za-z_0-9]*

  ; The first character of a basic identifier has to be in the ranges from "a" to "z" or from "A" to "Z".
  ; The following characters have to be in the ranges from "a" to "z", from "A" to "Z", a digit or the underscore ("_").


<quoted identifier> ::=
  ".*"

  ; Identifiers surrounded with double quotes can contain any character.
  ; A double quote within an identifier has to be escaped with another double quote. E.g. "identifier""with quote".

<view identifier> :: =
  <identifier with database>

<identifier with database> ::=
    <element:identifier> (assumes that the element exists in the current database)
  | <database:identifier>.<view:identifier>

<integer> ::=
  [-][0-9]+

<number>  ::=
    <integer>
  | (([0-9]*\.[0-9]+)|([0-9]+\.[0-9]*)) ((([0-9]*\.[0-9]+)|([0-9]+\.[0-9]*)|([0-9]+))([Ee][-+][0-9]+))

<boolean> ::=
    TRUE
  | FALSE

<literal> ::= '.*' (a single quote in a literal has to be escaped with another single quote. E.g. 'literal''with a quote')

<operator> ::=
    <unary operator>
  | <binary operator>

<operator symbol> ::=
  [~!@#^&|?<>=]+

<unary operator> ::=
    is null
  | is not null
  | is true
  | is false

<binary operator> ::=
    =
  | <identifier>
  | <operator symbol>
  | IN

<reserved VQL words> ::=
    ADD | ALL | ALTER | AND | ANY | AS | ASC | BASE | BOTH | CALL
  | CASE | CONNECT | CONTEXT | CREATE | CROSS | CURRENT_DATE | CURRENT_TIMESTAMP
  | CUSTOM | DATABASE | DEFAULT | DESC | DF | DISTINCT | DROP | EXISTS | FALSE
  | FETCH | FLATTEN | FROM | FULL | GRANT | GROUP BY | HASH | HAVING
  | HTML | IF | INNER | INTERSECT,INTO | IS | JDBC | JOIN | LDAP | LEADING
  | LEFT | LIMIT | MERGE | MINUS | MY | NATURAL | NESTED | NOS | NOT | NULL
  | OBL | ODBC | OF | OFF | OFFSET | ON | ONE | OPT | OR | ORDER BY | ORDERED
  | PRIVILEGES | READ | REVERSEORDER | REVOKE | RIGHT | ROW | SELECT | SWAP
  | TABLE | TO | TRACE | TRAILING | TRUE | UNION | USER | USING | VIEW | WHEN
  | WHERE | WITH | WRITE | WS | ZERO