public class CQL extends Object
Filters and Expressions, respectively.
CQL is an acronym for Contextual Query Language, a query predicate language whose syntax is similar to a SQL WHERE clause, defined as OGC Common Query Language in clause 6.2.2 of the OGC Catalog Service for Web, version 2.0.1 implementation specification.
This class provides three methods, toFilter(String), toExpression(String)
and toFilterList(String); and an overloaded version of each one for the user to provide
a FilterFactory implementation to use.
Filter f = CQL.toFilter("ATTR1 < 10 AND ATTR2 < 2 OR ATTR3 > 10");
Filter f = CQL.toFilter("NAME = 'New York' ");
Filter f = CQL.toFilter("NAME LIKE 'New%' ");
Filter f = CQL.toFilter("NAME IS NULL");
Filter f = CQL.toFilter("DATE BEFORE 2006-11-30T01:30:00Z");
Filter f = CQL.toFilter("NAME DOES-NOT-EXIST");
Filter f = CQL.toFilter("QUANTITY BETWEEN 10 AND 20");
Filter f = CQL.toFilter("CROSSES(SHAPE, LINESTRING(1 2, 10 15))");
Filter f = CQL.toFilter("BBOX(SHAPE, 10,20,30,40)");
Expression e = CQL.toExpression("NAME");
Expression e = CQL.toExpression("QUANTITY * 2");
Expression e = CQL.toExpression("strConcat(NAME, 'suffix')");
List filters = CQL.toFilterList("NAME IS NULL;BBOX(SHAPE, 10,20,30,40);INCLUDE");
Implementation specification 1.0| Modifier and Type | Method and Description |
|---|---|
static void |
main(String[] args)
Command line expression tester used to try out filters and expressions.
|
static String |
toCQL(Expression expression)
Generates the expression text associated to the
Expression object. |
static String |
toCQL(Filter filter)
Generates the cql predicate associated to the
Filter object. |
static String |
toCQL(List<Filter> filterList)
|
static Expression |
toExpression(String cqlExpression)
Parses the input string in OGC CQL format into an Expression, using the systems default
FilterFactory implementation. |
static Expression |
toExpression(String cqlExpression,
FilterFactory filterFactory)
Parses the input string in OGC CQL format into an
Expression, using the provided
FilterFactory. |
static Filter |
toFilter(String cqlPredicate)
Parses the input string in OGC CQL format into a Filter, using the systems default
FilterFactory implementation.
|
static Filter |
toFilter(String cqlPredicate,
FilterFactory filterFactory)
Parses the input string in OGC CQL format into a Filter, using the provided FilterFactory.
|
static List<Filter> |
toFilterList(String cqlFilterList)
Parses the input string, which has to be a list of OGC CQL predicates separated by
;
into a List of Filters, using the provided FilterFactory. |
static List<Filter> |
toFilterList(String cqlSequencePredicate,
FilterFactory filterFactory)
Parses the input string which has to be a list of OGC CQL predicates separated by "
;
" into a List of Filters, using the provided FilterFactory. |
public static Filter toFilter(String cqlPredicate) throws CQLException
cqlPredicate - a string containing a query predicate in OGC CQL format.Filter equivalent to the constraint specified in cqlPredicate.CQLExceptionpublic static Filter toFilter(String cqlPredicate, FilterFactory filterFactory) throws CQLException
cqlPredicate - a string containing a query predicate in OGC CQL format.filterFactory - the FilterFactory to use for the creation of the Filter. If it
is null the method finds the default implementation.Filter equivalent to the constraint specified in Predicate.CQLExceptionpublic static Expression toExpression(String cqlExpression) throws CQLException
FilterFactory implementation.cqlExpression - a string containing an OGC CQL expression.Expression equivalent to the one specified in cqlExpression.CQLExceptionpublic static Expression toExpression(String cqlExpression, FilterFactory filterFactory) throws CQLException
Expression, using the provided
FilterFactory.cqlExpression - a string containing a OGC CQL expression.filterFactory - the FilterFactory to use for the creation of the Expression. If
it is null the method finds the default implementation.Filter equivalent to the constraint specified in cqlExpression
.CQLExceptionpublic static List<Filter> toFilterList(String cqlFilterList) throws CQLException
;
into a List of Filters, using the provided FilterFactory.cqlFilterList - a list of OGC CQL predicates separated by ";"List of Filter, one for each input CQL statementCQLExceptionpublic static String toCQL(Filter filter)
Filter object.public static String toCQL(Expression expression)
Expression object.public static List<Filter> toFilterList(String cqlSequencePredicate, FilterFactory filterFactory) throws CQLException
;
" into a List of Filters, using the provided FilterFactory.cqlSequencePredicate - a list of OGC CQL predicates separated by ";"filterFactory - the FilterFactory to use for the creation of the Expression. If
it is null the method finds the default implementation.Filter, one for each input CQL statementCQLExceptionpublic static final void main(String[] args)
Copyright © 1996–2021 Geotools. All rights reserved.