Internal -------- This package is dedicated to support the OGC Common Query Language, version 2.0.1, as a query predicate language inside GeoTools. The rest of this document describe the syntax rules and the parser design. CQL Interface ^^^^^^^^^^^^^ This diagram presents the package interface. In parser's protocol methods performs the parsing of CQL and builds the filter. .. image:: /images/cql.PNG CQL Implementation ^^^^^^^^^^^^^^^^^^ The figure shows the principal class in the parser and build process. CQLParser does a top down analysis of the input string and makes the parsing tree. Each time CQLParser builds a node, it makes a call to CQLCompiler, that implements the semantic actions related and builds the product or sub product required to make the Filter at the end of the parsing process .. image:: /images/cqlParser.PNG BNF ^^^ The BNF is reproduced bellow to indicate the extensions made, which are highlighted in bold characters. The original BNF was extended thinking in SQL where expression. Moreover, we found some errors in the specification and made some corrections, that will help to use and analysis the CQL language. Syntax Rules:: ::= [1] | ::= ::= | OR ::= | AND ::= [ NOT ] ::= | | | "(" ")" ::= | | | | [1] | | | Existence Predicate:: := EXISTS | DOES-NOT-EXIST Comparison Predicate:: ::= | ::= | | | | | Text Predicate (or Like Predicate):: ::= [ NOT ] LIKE ::= (* pattern examples : attribute like '%contains_this%' attribute like 'begins_with_this%' attribute like '%ends_with_this' attribute like 'd_ve' will match 'dave' or 'dove' attribute not like '%will_not_contain_this%' attribute not like 'will_not_begin_with_this%' attribute not like '%will_not_end_with_this' *) NULL Predicate:: ::= IS [ NOT ] NULL Between Predicate:: ::= [ NOT ] BETWEEN AND < literal > [1] Temporal Predicate:: ::= "BEFORE" | "BEFORE OR DURING" | "DURING" | "DURING OR AFTER" | "AFTER" | ::= "T" ::= "-" "-" ::= ::= ::= ::=":"":" [] ::= "Z" | ":" ::= ::= ::= [....] ::= "P" | "T" ::= | | [] ::= ... "D" ::= ... "M" [] ::= ... "Y" [] ::= | | ::= ... "H" [] ::= ... "M" [] ::= ... "S" ::= / | / | / INCLUDE/EXCLUDE Predicate:: ::= "INCLUDE" | "EXCLUDE" Expression:: ::= { } ::= | ::= { } ::= | ::= | | | ( ) | [ ] ::= "(" ( ("," )* )? ")" ::= | | ::= | ::= [ ] ::= | | ::= "TRUE" | "FALSE" | "UNKNOWN" Geo-Routine and Relational Geo-Operations:: ::= | | | ::= < attribute name> ::= "EQUALS" | "DISJOINT" | "INTERSECTS" | "TOUCHES" | "CROSSES" | "WITHIN" | "CONTAINS" | "OVERLAPS" ::= "BBOX" "(" "," "," "," ","["," ] ")" [1] ::= ::= ::= ::= ::= ... (* default: EPSG:4326. *) ::= "RELATE" "(" "," "," ")" ::= ::= "*"| "T" | "F" | "0" | "1" | "2"> | ::= "DWITHIN" | "BEYOND" ::= "(" [ ] ")" ::= [ { "," } ...] ::= | ::= "("","")" ::= "("","","")" ::="," ::= = "feet" | "meters" | "statute miles" | "nautical miles" | "kilometers" Geometry Literal:: := | | | | | | | ::= POINT ::= LINESTRING ::= POLYGON ::= MULTIPOINT ::= MULTILINESTRING ::= MULTIPOLYGON ::=GEOMETRYCOLLECTION := EMPTY | "(" ")" := := numeric literal := numeric literal := EMPTY | "(" \{","\}...")" := EMPTY | "("\{"," \}...")" := EMPTY | "("\{","\}...")" := EMPTY | "("\{","\}...")" := EMPTY | "("\{","\}...")" := EMPTY | "("\{","\}...")" ::= ENVELOPE ::= EMPTY | "(""," "," "," < ")" ::= numeric literal ::= numeric literal ::= numeric literal ::= numeric literal Lexical Rules:: ::= ::= | | ::= | ::= A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z ::= a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | w | x | y | z ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 ::= | | | | | | | | | | | | | | | | | | | | | | | | | ::= /*space character in character set in use In ASCII it would be 40*/ ::= " ::= % ::= & ::= ' ::= ( ::= ) ::= * ::= + ::= , ::= - ::= . ::= / ::= : ::= ; ::= < ::= = ::= > ::= ? ::= [ ::= ] ::= ^ ::= _ ::= | ::={ ::=} ::= { | | }... ::= | ::= | | ::= ::= NOT | AND | OR | LIKE | IS | NULL | EXISTS | DOES-NOT-EXIST | DURING | AFTER | BEFORE INCLUDE | EXCLUDE | TRUE | FALSE | EQUALS | DISJOINT | INTERSECTS | TOUCHES | CROSSES | WITHIN | CONTAINS| OVERLAPS | RELATE | DWITHIN | BEYOND | POINT | LINESTRING | POLYGON | MULTIPOINT | MULTILINESTRING | MULTIPOLYGON | GEOMETRYCOLLECTION Numeric:: ::= | ::= [[ ] ] | ::= ... ::= E ::= ::= ::= [ ] ::= | Delimiter:: ::= | | | | | | | | | ::= [ ... ] ::= | ::= ::= <> ::= >= ::= <= Character String Literal:: ::= [ ... ] ::= | ::= Identifier The following section is intended to give context for identifier and namespaces. It assumes that the default namespace is specified in the query request and does not allow any overrides of the namespace:: ::= ::= [ { | }... ] ::= ::= | ::= [ { | }... ] ::= ::= | ::= | ::= ::= [{}...]