Thanks a lot Jody for that clear explanation.  For now I am currently just 
creating a SimpleFeature from my own property map and using the 
ECQL.toFilter(myECQLstring) and Filter.evaluate(feature) functions which are 
working beautifully.  But you’ve shown me the road to making what I’ve got more 
flexible and I will definitely look at those as the need arises.

--Steve

From: Jody Garnett [mailto:jody.garn...@gmail.com]
Sent: Monday, March 16, 2015 3:59 PM
To: Stephen Brooke
Cc: geotools-gt2-users@lists.sourceforge.net
Subject: Re: [Geotools-gt2-users] CQL Parsing and Filtering with GeoTools

A couple things Steve:

The CQL code is pretty generic - it just parses out a GeoTools Filter object. 
ECQL is our custom extension of CQL that offers a better reflection of what our 
Filter object can do. As an example CQL can compare a property name to an 
expression, while ECQL can compare two expressions.

There is no difference to the data structure if you create it with a 
FilterFactory or an ECQL expression.

The Filter data structure has two places you can extend it:
- Function - create your own function following the tutorial in the user guide
- PropertyAccessor - teach filter how to extract values out of your objects 
(GeoTools does Features, other applications do java beans, or java.util.Map, or 
whatever ....).

FilterVisitor is used to process your expression once it is written. A very 
simple process is to evaluate to a value. A more complicated one would be to 
simplify or refactor an expression ... or to generate SQL.

Jody

--
Jody Garnett

On 15 March 2015 at 09:54, Stephen Brooke 
<sbro...@mdacorporation.com<mailto:sbro...@mdacorporation.com>> wrote:
Hi list,

I am thinking of using CQL as a filter language in my own application and I’ve 
been looking at “gt-cql.jar” in the GeoTools suite of tools as a library to do 
the heavy lifting.  However, I’m having trouble knowing where to start.

The scenario I am trying to implement is as follows:
A user creates a rule for how they want to receive notifications about new data 
available and the rule can contain a filter which I send to my application as a 
CQL filter.  The application stores the rule and when “new data available” 
event occurs the application needs to go through all user rules and determine 
whether notifications need to be sent to which users.  So the application needs 
to go through each rule and see which ones are a match for the “new data 
available” event.

Does anyone have any pointers as to where to start if I want to use GeoTools to 
help with this?

The classes I’ve studied so far are:
org.geoserver.wfs.GetFeature
org.geoserver.wfs.JoinExtractingVisitor
org.geoserver.monitor.FilterVisitorSupport
org.geotools.filter.FilterFactoryImpl
org.opengis.filter.Filter
org.geoserver.ows.KvpParser
org.geotools.filter.text.cql2.CQLTest
org.geotools.filter.text.cql2.CQL

--Steve


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net<mailto:GeoTools-GT2-Users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to