[Java programming language only]

ObjectGrid query Backus-Naur Form

A summary of the ObjectGrid Query Backus-Naur Form (BNF) Notation follows.

Table 1. Key to BNF summary
Representation Description
{...}
Grouping
[...]
Optional constructs
bold
Keywords
*
Zero or more
|
Alternates
ObjectGrid QL ::=select_clause from_clause [where_clause] [group_by_clause]
		[having_clause] [order_by_clause]
from_clause ::=FROM identification_variable_declaration
		[,identification_variable_declaration]*
identification_variable_declaration ::=collection_member_declaration |
		range_variable_declaration
collection_member_declaration ::=IN ( collection_valued_path_expression |
		single_valued_navigation) [AS] identifier | [LEFT [OUTER]
		| INNER] JOIN collection_valued_path_expression |
		single_valued_navigation [AS] identifier
range_variable_declaration ::=abstract_schema_name [AS] identifier
single_valued_path_expression ::={single_valued_navigation | identification_variable}.
		{ state_field | state_field.value_object_attribute } | single_valued_navigation
single_valued_navigation ::=identification_variable.[ single_valued_association_field. ]*
		single_valued_association_field
collection_valued_path_expression ::=identification_variable.[
		single_valued_association_field. ]* collection_valued_association_field
select_clause ::= SELECT [DISTINCT] [ selection , ]* selection
selection ::= {single_valued_path_expression |identification_variable | OBJECT
		( identification_variable) |aggregate_functions } [[ AS ] id ]
order_by_clause ::= ORDER BY [ {identification_variable.[ single_valued_association_field.
		]*state_field} [ASC|DESC],]* {identification_variable.[
		single_valued_association_field. ]*state_field}[ASC|DESC]
where_clause ::= WHERE conditional_expression
conditional_expression ::= conditional_term | conditional_expression OR conditional_term
conditional_term ::= conditional_factor | conditional_term AND conditional_factor
conditional_factor ::= [NOT] conditional_primary
conditional_primary ::= simple_cond_expression | (conditional_expression)
simple_cond_expression ::= comparison_expression | between_expression | like_expression |
		in_expression | null_comparison_expression | empty_collection_comparison_expression |
		exists_expression | collection_member_expression

between_expression ::= numeric_expression [NOT] BETWEEN numeric_expression
		AND numeric_expression | string_expression [NOT] BETWEEN
		string_expression AND string_expression | datetime_expression [NOT]
		BETWEEN datetime_expression AND datetime_expression
in_expression ::= identification_variable.[ single_valued_association_field. ]state_field
		[*NOT] IN { (subselect) | ( atom ,]* atom) }
atom ::= { string_literal | numeric_literal | input_parameter }
like_expression ::=string_expression [NOT] LIKE {string_literal | input_parameter}
		[ESCAPE {string_literal | input_parameter}]
null_comparison_expression ::= {single_valued_path_expression | input_parameter} IS
		[ NOT ] NULL
empty_collection_comparison_expression ::= collection_valued_path_expression IS
		[NOT] EMPTY
collection_member_expression ::={ ssingle_valued_path_expression | input_parameter }[
		NOT ] MEMBER	[ OF ]collection_valued_path_expression

exists_expression ::= EXISTS {(subselect)}
subselect ::= SELECT [{ ALL | DISTINCT }] subselection from_clause
		[where_clause] [group_by_clause] [having_clause]
subselection ::= {single_valued_path_expression |identification_variable |
		aggregate_functions }
group_by_clause ::= GROUP BY[single_valued_path_expression,]*
		single_valued_path_expression
having_clause ::= HAVING conditional_expression
comparison_expression ::= numeric_ expression comparison_operator { numeric_expression
		| {SOME | ANY | ALL} (subselect) } | string_expression
		comparison_operator {
string_expression | {SOME | ANY | ALL}(subselect) } |
datetime_expression comparison_operator {
datetime_expression {SOME | ANY | ALL}(subselect) } |
boolean_expression {=|<>} {
boolean_expression {SOME | ANY | ALL}(subselect) } |
entity_expression {=|<>} {
entity_expression {SOME| ANY | ALL}(subselect) }
comparison_operator ::= = | > | >= | < | <= | <>
string_expression ::= string_primary | (subselect)
string_primary ::=state_field_path_expression |string_literal | input_parameter |
		functions_returning_strings
datetime_expression ::= datetime_primary |(subselect)
datetime_primary ::=state_field_path_expression | string_literal | long_literal
		| input_parameter | functions_returning_datetime
boolean_expression ::= boolean_primary |(subselect)
boolean_primary ::=state_field_path_expression | boolean_literal | input_parameter
entity_expression ::=single_valued_association_path_expression |
		identification_variable | input_parameter
numeric_expression ::= simple_numeric_expression |(subselect)
simple_numeric_expression ::= numeric_term | numeric_expression {+|-} numeric_term
numeric_term ::= numeric_factor | numeric_term {*|/} numeric_factor
numeric_factor ::= {+|-} numeric_primary
numeric_primary ::= single_valued_path_expression | numeric_literal |
		( numeric_expression ) | input_parameter | functions
aggregate_functions :=
AVG([ALL|DISTINCT] identification_variable.
		[ single_valued_association_field. ]*state_field) |
COUNT([ALL|DISTINCT] {single_valued_path_expression |
		identification_variable}) |
MAX([ALL|DISTINCT] identification_variable.[
		single_valued_association_field. ]*state_field) |
MIN([ALL|DISTINCT] identification_variable.[
		single_valued_association_field. ]*state_field) |
SUM([ALL|DISTINCT] identification_variable.[
		single_valued_association_field. ]*state_field)

functions ::=
ABS (simple_numeric_expression) |
CONCAT (string_primary , string_primary) |
LOWER (string_primary) |
LENGTH(string_primary) |
LOCATE(string_primary, string_primary [, simple_numeric_expression]) |
MOD (simple_numeric_expression, simple_numeric_expression) |
SIZE (collection_valued_path_expression) |
SQRT (simple_numeric_expression) |
SUBSTRING (string_primary, simple_numeric_expression[, simple_numeric_expression]) |
UPPER (string_primary) |
TRIM ([[LEADING | TRAILING | BOTH] [trim_character]
		FROM] string_primary)