[GeoNetwork-devel] Parsing CQL and upgrade geotools version

Hi GeoNetwork community,

I'm currently working on enabling an application to interact with GeoNetwork.

I found that GN was having trouble parsing the CQL expressions in my requests, so I went ahead and took a look.
I'm working on GeoNetwork trunk from svn.

What I found is that AbstractOperation.convertCQL(String):Element is using the GeoTool's old xml tech to encode the org.opengis.filter.Filter to an XML string. That is, org.geotools.filter.FilterTransformer instead of org.geotools.xml.Encoder. The rest of the code base seems to correctly being using org.geotools.xml.Parser (the Encoder counterpart).

Problem is FilterTransformer is old and I guess it works only with Filter 1.0., and it fails with an exception if trying to encode a PropertyIsLike filter.

Changing the code as in the following patch to use Encoder instead solves the problem: <http://pastebin.com/m2daef52f&gt;, but with the catch of having to upgrade the geotools version used by GeoNetwork. Currently GN uses GeoTools 2.5.1, which ignored a PropertyIsLike filter producing an empty Filter xml string. Upgrading to the latest 2.5 release solves it.

Otherwise, I can't use any LIKE filter in a GetRecords request.

Would you please consider applying the above mentioned patch and upgrading to a newer GeoTools?

Cheers,
Gabriel

--
Gabriel Roldan
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Hi Gabriel,

On Tue, Dec 15, 2009 at 9:05 PM, Gabriel Roldan <groldan@anonymised.com> wrote:

Hi GeoNetwork community,

I’m currently working on enabling an application to interact with
GeoNetwork.

I found that GN was having trouble parsing the CQL expressions in my
requests, so I went ahead and took a look.
I’m working on GeoNetwork trunk from svn.

What I found is that AbstractOperation.convertCQL(String):Element is
using the GeoTool’s old xml tech to encode the org.opengis.filter.Filter
to an XML string. That is, org.geotools.filter.FilterTransformer instead
of org.geotools.xml.Encoder. The rest of the code base seems to
correctly being using org.geotools.xml.Parser (the Encoder counterpart).

Problem is FilterTransformer is old and I guess it works only with
Filter 1.0., and it fails with an exception if trying to encode a
PropertyIsLike filter.

Changing the code as in the following patch to use Encoder instead
solves the problem: <http://pastebin.com/m2daef52f>, but with the catch
of having to upgrade the geotools version used by GeoNetwork. Currently
GN uses GeoTools 2.5.1, which ignored a PropertyIsLike filter producing
an empty Filter xml string. Upgrading to the latest 2.5 release solves it.

Otherwise, I can’t use any LIKE filter in a GetRecords request.

Would you please consider applying the above mentioned patch and
upgrading to a newer GeoTools?

+1 from my side.

We choose to start with GeoTools 2.5.1 at this time because it was one of the last GeoTools release.
I do not think there is any side effect upgrading Geotools to the 2.5.8 release.
I will have a look on that tomorrow and I will let you know about that.

Thanks for feedback and contribution,

Cheers,

Mathieu

Cheers,
Gabriel


Gabriel Roldan
OpenGeo - http://opengeo.org
Expert service straight from the developers.


This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon’s best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev


GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork

Hola Gabriel,

I applied your patch to the trunk and upgraded geotools to release 2.5.8.
After tests, sounds good to me to move on.
I also created a ticket for that bug : http://trac.osgeo.org/geonetwork/ticket/178

If any objection among the community I will commit it soon.

Thanks again,
ciao,

Mathieu

On Tue, Dec 15, 2009 at 9:05 PM, Gabriel Roldan <groldan@anonymised.com> wrote:

Hi GeoNetwork community,

I’m currently working on enabling an application to interact with
GeoNetwork.

I found that GN was having trouble parsing the CQL expressions in my
requests, so I went ahead and took a look.
I’m working on GeoNetwork trunk from svn.

What I found is that AbstractOperation.convertCQL(String):Element is
using the GeoTool’s old xml tech to encode the org.opengis.filter.Filter
to an XML string. That is, org.geotools.filter.FilterTransformer instead
of org.geotools.xml.Encoder. The rest of the code base seems to
correctly being using org.geotools.xml.Parser (the Encoder counterpart).

Problem is FilterTransformer is old and I guess it works only with
Filter 1.0., and it fails with an exception if trying to encode a
PropertyIsLike filter.

Changing the code as in the following patch to use Encoder instead
solves the problem: <http://pastebin.com/m2daef52f>, but with the catch
of having to upgrade the geotools version used by GeoNetwork. Currently
GN uses GeoTools 2.5.1, which ignored a PropertyIsLike filter producing
an empty Filter xml string. Upgrading to the latest 2.5 release solves it.

Otherwise, I can’t use any LIKE filter in a GetRecords request.

Would you please consider applying the above mentioned patch and
upgrading to a newer GeoTools?

Cheers,
Gabriel


Gabriel Roldan
OpenGeo - http://opengeo.org
Expert service straight from the developers.


This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon’s best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev


GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork

Hola Mathieu,

that sounds awesome, thanks.

I´ll be trying out more GN stuff these days and will try to report back any issues I find with a patch if I can.

Cheers,
Gabriel

Mathieu Coudert wrote:

Hola Gabriel,

I applied your patch to the trunk and upgraded geotools to release 2.5.8.
After tests, sounds good to me to move on.
I also created a ticket for that bug : http://trac.osgeo.org/geonetwork/ticket/178

If any objection among the community I will commit it soon.

Thanks again,
ciao,

Mathieu