Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

BNF

The BNF is reproduced for indicate the extensions are highlighted with bold characters. The original BNF was extended thinking in SQL where expression.
<!-- @page

Unknown macro: { size}

P

Unknown macro: { margin-bottom}

-->Moreover, we found some errors in the specification and we have done corrections, that will help to use and analyse the CQL language.

<search condition> ::= <boolean value expression>

<boolean value expression> ::=
    <boolean term>
    | <boolean value expression> OR <boolean term>

<boolean term> ::=
    <boolean factor>
    | <boolean term> AND <boolean factor>

<boolean factor> ::= [ NOT ] <boolean primary>

<boolean primary> ::=
    <predicate>
    |<routine invocation>
    | <routine invocation>
    | <left paren> <search condition> <right paren>

<predicate> ::=
    <comparison predicate>
    | <text predicate>
    | <null predicate>
    | <temporal predicate>
    | <classification predicate>
    | <existence_predicate>

<temporal predicate> ::=
    <attribute_name> BEFORE <date-time expression>
    | <attribute_name> BEFORE OR DURING <period>
    | <attribute_name> DURING <period>
    | <attribute_name> DURING OR AFTER <period>
    | <attribute_name> AFTER <date-time expression>

<date-time expression ::= <date-time> | <period>

<existence_predicate> :=
    <attribute_name> EXISTS
    | <attribute_name> DOES-NOT-EXIST

<comparison predicate> ::= <attribute name> <comp op> <literal>

<text predicate> ::= <attribute name> [ NOT ] LIKE <character pattern>

<null predicate> ::= <attribute name> IS [ NOT ] NULL

<between predicate> ::= <attribute name> [ NOT ] BETWEEN <literal> AND < literal > [1]

<character pattern> ::= <character string literal>

(* 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' *)

<comp op> ::= <equals operator>
    | <not equals operator>
    | <less than operator>
    | <greater than operator>
    | <less than or equals operator>
    | <greater than or equals operator>

<literal> ::= <signed numeric literal>| <general literal>

<signed numeric literal> ::=    [<sign> ] <unsigned numeric literal>

<general literal> ::=
    <character string literal>
    | <datetime literal>
    | <boolean literal>
    | <geography literal

<boolean literal> ::= TRUE | FALSE | UNKNOWN

<routine invocation> ::=
     <geoop name><georoutine argument list>
    | <relgeoop name><relgeoop argument list>
    | <routine name><argument list>

<routine name> ::= < attribute name>

<geoop name> ::=   EQUAL | DISJOINT | INTERSECT | TOUCH | CROSS | WITHIN | CONTAINS |OVERLAP | RELATE [2]

<bbox argument list>::= "(" <attribute> ","<min X> ","<min Y> ","<max X> ","<max Y>["," <crs>] ")" [3]
<min X> ::= <signed numerical literal>
<min Y> ::= <signed numerical literal>
<max X> ::= <signed numerical literal>
<max Y> ::= <signed numerical literal>
<crs> ::=  ... (** default: EPSG:4326. **)

<relgeoop name> ::= DWITHIN | BEYOND
<argument list> ::= <left paren> [ <positional arguments> ] <right paren>

<positional arguments> ::= <argument> [ { <comma> <argument> } ...]
<argument> ::= <literal> | <attribute name>

<georoutine argument list> ::=  <left paren><attribute name><comma><geometry literal><right paren>

<relgeoop argument list> ::= <left paren><attribute name><comma><geometry literal><comma><tolerance><right paren>

<tolerance> ::=<unsigned numeric literal><comma><distance units>

<distance units> ::= = "feet" | "meters" | "statute miles" | "nautical miles" | "kilometers"

<geometry literal> :=
    <Point Tagged Text>
    | <LineString Tagged Text>
    | <Polygon Tagged Text>
    | <MultiPoint Tagged Text>
    | <MultiLineString Tagged Text>
    | <MultiPolygon Tagged Text>
    | <GeometryCollection Tagged Text>
    | <Envelope Tagged Text>

<Point Tagged Text> ::= POINT <Point Text>

<LineString Tagged Text> ::= LINESTRING <LineString Text>

<Polygon Tagged Text> ::= POLYGON <Polygon Text>

<MultiPoint Tagged Text> ::= MULTIPOINT <Multipoint Text>

<MultiLineString Tagged Text> ::= MULTILINESTRING <MultiLineString Text>

<MultiPolygon Tagged Text> ::= MULTIPOLYGON <MultiPolygon Text>

<GeometryCollection Tagged Text> ::=GEOMETRYCOLLECTION <GeometryCollection Text>

<Point Text> := EMPTY | <left paren> <Point> <right paren>

<Point> := <x><space><y>
<x> := numeric literal
<y> := numeric literal

<LineString Text> := EMPTY | <left paren> <Point> {<comma><Point >}...<right paren>

<Polygon Text> := EMPTY | <left paren><LineString Text>{<comma><LineString Text> }...<right paren>

<Multipoint Text> := EMPTY | <left paren><Point Text>{<comma><Point Text >}...<right paren>

<MultiLineString Text> := EMPTY | <left paren><LineString Text>{<comma><LineString Text>}...<right paren>

<MultiPolygon Text> := EMPTY | <left paren><Polygon Text>{<comma><Polygon Text>}...<right paren>

<GeometryCollection Text> := EMPTY | <left paren><Geometry Tagged Text>{<comma><Geometry Tagged Text>}...<right paren>

<Envelope Tagged Text> ::= ENVELOPE <Envelope Text>

<Envelope Text> ::= EMPTY |
    <left paren><WestBoundLongitude><comma>
        <EastBoundLongitude><comma>
        <NorthBoundLatitude><comma>
        <SouthBoundLatitude>< <right paren>

<WestBoundLongitude> ::= numeric literal
<EastBoundLongitude> ::= numeric literal
<NorthBoundLatitude> ::= numeric literal
<SouthBoundLatitude> ::= numeric literal

<date-time> ::= <full-date> T <UTC-time>
<full_date> ::= <date-year> <date-month> <date-day>

<date-year> ::= <digit><digit><digit><digit>
<date-month> ::= <digit><digit>
<date-day> ::= <digit><digit>

<UTC-time> ::= <time-hour> : <time-minute> : <time-second> Z
<time-hour> ::= <digit><digit>
<time-minute> ::= <digit><digit>
<time-second> ::= <digit><digit>[.<digit>...]

<duration> ::= P <dur-date> | T<dur-time>
<dur-date> ::= <dur-day> | <dur-month> | <dur-year> [<dur-time>]
<dur-day> ::= <digit>... D
<dur-month> ::= <digit>... M [<dur-day>]
<dur-year> ::= <didit>... Y [<dur-month>]

<dur-time> ::= <dir-hour> | <dur-minute> | <dur-second>
<dur-hour> ::= <digit>... H [<dur-minute>]
<dur-minute> ::= <digit>... M [<dur-second>]
<dur-second> ::= <digit>... S

<period> ::=
    <date-time> / <date-time>
    | <date-time> / <duration>
    | <duration> / <date-time>

[1] between predicate is extension *)
[2] TODO RELATE this require a new filter.
[2] bbox is an extension *)  

Design

Module Interface

This diagram presents the interface of module. In its protocolo parser method does the parsing of CQL and build the the filter.

Unable to render embedded object: File (org.geotools.text.filter-Interface.jpg) not found.

Module Implementation

The figura 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 using the SimpleNode class. Each time CQLParser build a node call to CQLCompiler, that implements the semantic actions relates and builds the product or subproduct required to make the Filter at final of parsing process

Unable to render embedded object: File (org.geotools.text.filter-compiler-class.diagram.jpg) not found.

  • No labels