Hello Mauricio, I wish you an happy new year and all the best for you.
I don't know if you got time left to report my modification in the code of gt-cql. For all puposes, I send to you the modified file with all the needed modifications. Hoping you can get the time to report this in the trunk. Many thanks. Nicolas -----Message d'origine----- De : LECARTNicolas - MSY Envoyé : lundi 20 décembre 2010 18:02 À : [email protected]; [email protected] Objet : RE: [Geotools-gt2-users] DURING predicate and BEFORE predicate parsing Dear Mauricio, Now that you fixed the BEFORE CQL statement, I found a workaround to the use of DURING. Instead of using a DURING CQL like : "dateAttr DURING 2006-10-10T01:30:00Z/2010-12-31T01:30:00Z" Now I use this equivalent one : "(dateAttr AFTER 2006-10-10T01:30:00Z AND dateAttr BEFORE 2010-12-31T01:30:00Z)" But, in this extract of code: Filter filter5Expected = CQL.toFilter("(dateAttr AFTER 2006-10-10T01:30:00Z AND dateAttr BEFORE 2010-12-31T01:30:00Z)"); String ecqlEncoding5 = CQL.toCQL(filter5Expected); Filter ecqlDecoding5 = CQL.toFilter(ecqlEncoding5); The "CQL.toCQL(filter5Expected);" statement raises a new exception due to The FIXME exception added in the method " public Object visit(And filter, Object extraData) " This exception should not be there because even if it prevents the use of DURING CQL statement, it forbids the use of this kind of valid CQL filter too : "(dateAttr AFTER 2006-10-10T01:30:00Z AND dateAttr BEFORE 2010-12-31T01:30:00Z)" Could you remove or simply move this code somewhere else?: if(comparisonHasDate(child) ){ // FIXME during should be built throw new UnsupportedOperationException("work in progress: DURING requires implementation!"); Thank you in advance Cheers Nicolas -----Message d'origine----- De : [email protected] [mailto:[email protected]] Envoyé : lundi 20 décembre 2010 17:40 À : [email protected]; [email protected] Objet : Re: [Geotools-gt2-users] DURING predicate and BEFORE predicate pa rsing Hi Mauricio, Sorry I forgot two minor remarks: 1. I think that we should add the same patch in the methods public Object visit(PropertyIsGreaterThan filter, Object extraData) and public Object visit(PropertyIsLessrThan filter, Object extraData) In order to avoid the classCast exception problem. 2. In the method public Object visit(PropertyIsGreaterThanOrEqualTo filter, Object extraData) the log is wrong: LOGGER.finer("exporting PropertyIsLessThanOrEqualTo"); Should be: LOGGER.finer("exporting PropertyIsGreaterThanOrEqualTo "); Cheers Nicolas -----Message d'origine----- De : LECARTNicolas - MSY Envoyé : lundi 20 décembre 2010 17:23 À : LECARTNicolas - MSY; 'Mauricio Pazos'; '[email protected]' Objet : RE: [Geotools-gt2-users] DURING predicate and BEFORE predicate parsing Hello Mauricio, I checked the patch in FilterToCQL class, and I noticed an issue in the code. In the method public Object visit(PropertyIsGreaterThanOrEqualTo filter, Object extraData) { LOGGER.finer("exporting PropertyIsLessThanOrEqualTo"); StringBuffer output = asStringBuffer(extraData); Object expr1 = filter.getExpression1(); if( expr1 instanceof PropertyName){ PropertyName propertyName = (PropertyName) filter.getExpression1(); propertyName.accept(this, output); output.append(" >= "); filter.getExpression2().accept(this, output); } else { PropertyName propertyName = (PropertyName) filter.getExpression2(); propertyName.accept(this, output); output.append(" >= "); filter.getExpression1().accept(this, output); } return output; } In the else statement the comparison operator is not ">=" but "<=". The " output.append(" >= ");" has to be repalced with "output.append(" <= ");" I can demonstrate this with an example: let say the method is called with this filter : [ Tue Oct 10 01:30:00 CEST 2006 <= dateAttr ] With your code, the output variable will contain dateAttr <= 2006-10-10T01:30:00Z which is wrong. There is the same issue in the method: public Object visit(PropertyIsLessThanOrEqualTo filter, Object extraData) { LOGGER.finer("exporting PropertyIsLessThanOrEqualTo"); StringBuffer output = asStringBuffer(extraData); Object expr1 = filter.getExpression1(); if( expr1 instanceof PropertyName){ PropertyName propertyName = (PropertyName) filter.getExpression1(); propertyName.accept(this, output); output.append(" <= "); filter.getExpression2().accept(this, output); } else { PropertyName propertyName = (PropertyName) filter.getExpression2(); propertyName.accept(this, output); output.append(" <= "); filter.getExpression1().accept(this, output); } return output; } In this method, in the else statement, the "output.append(" <= ");" has to be replaced with "output.append(" >= ");" Best regards Nicolas ________________________________________ De : LECARTNicolas - MSY Envoyé : lundi 20 décembre 2010 13:18 À : 'Mauricio Pazos'; [email protected] Objet : RE: [Geotools-gt2-users] DURING predicate and BEFORE predicate parsing Thank you Mauricio, I will check the method ang get back to you. Best regards Nicolas ________________________________________ De : Mauricio Pazos [mailto:[email protected]] Envoyé : lundi 20 décembre 2010 12:56 À : [email protected] Objet : Re: [Geotools-gt2-users] DURING predicate and BEFORE predicate parsing On Friday 17 December 2010 09:43:20 pm Mauricio Pazos wrote: > Good!, I am going to add this patch in trunk. Your collaboration is > welcome. > > > all the best I have added the unit test for FilterToCQL. FilterToCQL was fixed for "after" and "before" sentences. The "during" sentence require more work. I have added a FIXME where I think is required to extend the code Have look in the method public Object visit(And filter, Object extraData) in the class http://svn.osgeo.org/geotools/trunk/modules/library/cql/src/main/java/org/ge otools/filter/text/cql2/FilterToCQL.java cheers -- Mauricio Pazos www.axios.es ---------------------------------------------------------------------------- -- Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
FilterToCQL.java
Description: Binary data
------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
