Kodall
Data Retrieval

Syntax

FETCH is a re-interpretation of a subset of functionalities of the SQL query language.

Here is a Backus–Naur form representation of the full FETCH syntax in abstract form:

FETCH

TEXT
FETCH    ::= 'FETCH' entityName '(' property ( ',' property )* ')' linkedEntities* ( 'FILTER' filter )? orderBy? ( 'LIMIT' int ( ',' int )? )?

property

TEXT
property ::= ( propertyName ( 'AS' alias )? | ( 'SUM' | 'AVG' | 'STD' | 'MIN' | 'MAX' | 'COUNT' | 'CONCAT' ) '(' propertyName ')' ) 'GROUP BY'?

referenced by:

  • FETCH

linkedEntities

TEXT
linkedEntities
         ::= '{' linkEntity ( ',' linkEntity )* '}'

referenced by:

  • FETCH
  • linkEntity

linkEntity

TEXT
linkEntity
         ::= entityName '(' 'property' ( ',' 'property' )* ')' 'FROM' propertyName 'TO' propertyName ( 'LINK TYPE' ( 'LEFT' | 'RIGHT' | 'INNER' ) )? linkedEntities* ( 'FILTER' filter )? orderBy?

referenced by:

  • linkedEntities

filter

TEXT
filter   ::= ( 'AND' | 'OR' ) '(' ( condition | filter ( ',' ( condition | filter )* )? )? ')'

referenced by:

  • FETCH
  • filter
  • linkEntity

condition

TEXT
condition
         ::= propertyName ( operator value | 'IS NULL' | 'IS NOT NULL' | 'IN' '(' value ( ',' value )* ')' | ( 'BEFORE NEXT' | 'AFTER NEXT' | 'IN NEXT' | 'BEFORE LAST' | 'AFTER LAST'
                  | 'IN LAST' ) value 'DAYS' )

referenced by:

  • filter

operator

TEXT
operator ::= '=='
           | 'LIKE'
           | '>'
           | '<'
           | '>='
           | '<='
           | 'MATCH'

referenced by:

  • condition

value

TEXT
value    ::= string
           | int
           | decimal

referenced by:

  • condition

orderBy

TEXT
orderBy  ::= 'ORDER BY' propertyName ( 'ASC' | 'DESC' ) ( ',' propertyName ( 'ASC' | 'DESC' ) )*

referenced by:

  • FETCH
  • linkEntity

alias

TEXT
alias    ::= [A-Za-z_] [A-Za-z_0-9]*

referenced by:

  • property

entityName

TEXT
entityName
         ::= [A-Za-z] [A-Za-z_0-9]*

referenced by:

  • FETCH
  • linkEntity

propertyName

TEXT
propertyName
         ::= [A-Za-z] [A-Za-z_0-9]*

referenced by:

  • condition
  • linkEntity
  • orderBy
  • property

int

TEXT
int      ::= [0-9]*

referenced by:

  • FETCH
  • value

decimal

TEXT
decimal  ::= [0-9]+ '.' [0-9]+

referenced by:

  • value

comment

TEXT
comment  ::= '/*' ( [^*] | '*'+ [^*/] )* '*'* '*/'

string

TEXT
string   ::= '"' [^"]* '"'

referenced by:

  • value