Common Query Language (CQL)
This package implements the OGC_Common Catalogue Query Language. OGC CQL is the query language to be supported by all OGC Catalogue Interfaces in order to support search interoperability. Catalogue Service Implementation Specification (OGC 04-021r3):
CQL BNF with SQL Extensions
The original BNF was extended thinking in a SQL where expression. The original BNF is reproduced to indicate the extensions highlighted with bold characters.
Extensions in original BNF
<SequenceOfSearchConditions > ::= <search condition> | <SequenceOfSearchConditions> ";" <search condition> <between predicate> ::= <attribute name> [ NOT ] BETWEEN <literal> AND < literal > <routine invocation> ::= <geoop name><georoutine argument list> | <relgeoop name><relgeoop argument list> | <routine name><argument list> | <BBOX> <bbox argument list> <geoop name> ::= EQUAL | DISJOINT | INTERSECT | TOUCH | CROSS | WITHIN | CONTAINS |OVERLAP | RELATE  <bbox argument list>::= "(" <attribute> ","<min X> ","<min Y> ","<max X> ","<max Y>["," <crs>] ")" <min X> ::= <signed numerical literal> <min Y> ::= <signed numerical literal> <max X> ::= <signed numerical literal> <max Y> ::= <signed numerical literal> <crs> ::=   RELATE is not supported (implementation in GeoTools is required)  If not supplied, the BoundingBox CRS is EPSG:4326.
The parser was generated using javacc. In CQLGrammar.jjt file you can see the input grammar for javacc required to parse CQL with extensions.