Package org.geotools.filter.text.ecql
Class ECQL
- Object
-
- ECQL
-
public class ECQL extends Object
Extended Contextual Query Language (ECQL) is an extension of CQL. This class presents the operations available to parse the ECQL language and generates the correspondent filter.Usage
Here are some usage examples. Refer to the BNF of grammar to see what exactly you can do.Filter filter = ECQL.toFilter("POP_RANK > 6"); Filter filter = ECQL.toFilter("POP_RANK > 3 AND POP_RANK < 6"); Filter filter = ECQL.toFilter("area(the_geom) > 3000"); Filter filter = ECQL.toFilter("Name LIKE '%omer%'"); Filter filter = ECQL.toFilter("RELATE( the_geom1,the_geom2) like 'T**F*****'"); Filter filter = ECQL.toFilter("DISJOINT(buffer(the_geom, 10) , POINT(1 2))"); Filter filter = ECQL.toFilter("IN ('river.1', 'river.2')"); Filter filter = ECQL.toFilter("LENGTH IN (4100001,4100002, 4100003 )"); List <Filter> list = ECQL.toFilterList("LENGTH = 100; NAME like '%omer%'"); Expression expression = ECQL.toExpression("LENGTH + 100");
- Since:
- 2.6
- Author:
- Jody Garnett, Mauricio Pazos (Axios Engineering)
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isEwktEncodingEnabled()
Convenience method checking if EWKT encoding should be enabled in ECQL, or notstatic void
main(String[] args)
Command line expression tester used to try out filters and expressions.static String
toCQL(List<Filter> filterList)
static String
toCQL(Expression expression)
Generates the expression text associated to theExpression
object.static String
toCQL(Filter filter)
Generates the ecql predicate associated to theFilter
object.static Expression
toExpression(String ecqlExpression)
Parses the input string in ECQL format into an Expression, using the systems defaultFilterFactory
implementation.static Expression
toExpression(String ecqlExpression, FilterFactory filterFactory)
Parses the input string in ECQL format and makes the correspondent Expression , using the provided FilterFactory.static Filter
toFilter(String ecqlPredicate)
Parses the input string in ECQL format into a Filter, using the systems default FilterFactory implementation.static Filter
toFilter(String ecqlPredicate, FilterFactory filterFactory)
Parses the input string in ECQL format into a Filter, using the provided FilterFactory.static List<Filter>
toFilterList(String ecqlSequencePredicate)
static List<Filter>
toFilterList(String ecqlSequencePredicate, FilterFactory filterFactory)
-
-
-
Method Detail
-
toFilter
public static Filter toFilter(String ecqlPredicate) throws CQLException
Parses the input string in ECQL format into a Filter, using the systems default FilterFactory implementation.- Parameters:
ecqlPredicate
- a string containing a query predicate in ECQL format.- Returns:
- a
Filter
equivalent to the constraint specified inecqlPredicate
. - Throws:
CQLException
-
toFilter
public static Filter toFilter(String ecqlPredicate, FilterFactory filterFactory) throws CQLException
Parses the input string in ECQL format into a Filter, using the provided FilterFactory.- Parameters:
ecqlPredicate
- a string containing a query predicate in ECQL format.filterFactory
- theFilterFactory
to use for the creation of the Filter. If it is null the method finds the default implementation.- Returns:
- a
Filter
equivalent to the constraint specified inPredicate
. - Throws:
CQLException
-
toExpression
public static Expression toExpression(String ecqlExpression) throws CQLException
Parses the input string in ECQL format into an Expression, using the systems defaultFilterFactory
implementation.- Parameters:
ecqlExpression
- a string containing an ECQL expression.- Returns:
- a
Expression
equivalent to the one specified inecqlExpression
. - Throws:
CQLException
-
toExpression
public static Expression toExpression(String ecqlExpression, FilterFactory filterFactory) throws CQLException
Parses the input string in ECQL format and makes the correspondent Expression , using the provided FilterFactory.- Parameters:
ecqlExpression
- a string containing a ECQL expression.filterFactory
- theFilterFactory
to use for the creation of the Expression. If it is null the method finds the default implementation.- Returns:
- a
Filter
equivalent to the constraint specified inecqlExpression
. - Throws:
CQLException
-
toFilterList
public static List<Filter> toFilterList(String ecqlSequencePredicate) throws CQLException
Parses the input string, which has to be a list of ECQL predicates separated by ";
" into aList
ofFilter
, using the provided FilterFactory.- Parameters:
ecqlSequencePredicate
- a list of ECQL predicates separated by ";
"- Returns:
- a List of
Filter
, one for each input ECQL statement - Throws:
CQLException
-
toFilterList
public static List<Filter> toFilterList(String ecqlSequencePredicate, FilterFactory filterFactory) throws CQLException
Parses the input string, which has to be a list of ECQL predicates separated by ";
" into aList
ofFilter
, using the provided FilterFactory.- Parameters:
ecqlSequencePredicate
- a ECQL predicate sequencefilterFactory
- the factory used to make the filters- Returns:
- a List of
Filter
, one for each input ECQL statement - Throws:
CQLException
-
toCQL
public static String toCQL(List<Filter> filterList)
- Returns:
- ecql predicates separated by ";"
-
toCQL
public static String toCQL(Filter filter)
Generates the ecql predicate associated to theFilter
object.- Returns:
- ecql predicate
-
isEwktEncodingEnabled
public static boolean isEwktEncodingEnabled()
Convenience method checking if EWKT encoding should be enabled in ECQL, or not
-
toCQL
public static String toCQL(Expression expression)
Generates the expression text associated to theExpression
object.- Returns:
- expression as text
-
main
public static final void main(String[] args)
Command line expression tester used to try out filters and expressions.
-
-