fid filter may be ambiguous if there's an actual attribute named ID
-------------------------------------------------------------------
Key: GEOT-2574
URL: http://jira.codehaus.org/browse/GEOT-2574
Project: GeoTools
Issue Type: Improvement
Components: core cql
Affects Versions: 2.5.6
Reporter: Gabriel Roldán
Assignee: Mauricio Pazos
The ECQL grammar does not allow to create an IN filter on an attribute called
ID: {{ID IN (1, 2, 3)}} is meant as a fid filter.
Some time ago it was proposed that the fid filter were created through a
special token {...@id}} instead:
[http://www.mail-archive.com/[email protected]/msg07018.html].
The following test case exemplifies it:
{code}
Index: src/test/java/org/geotools/filter/text/ecql/ECQLINPredicateTest.java
===================================================================
--- src/test/java/org/geotools/filter/text/ecql/ECQLINPredicateTest.java
(revision 33330)
+++ src/test/java/org/geotools/filter/text/ecql/ECQLINPredicateTest.java
(working copy)
@@ -17,6 +17,7 @@
package org.geotools.filter.text.ecql;
+import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -46,6 +47,25 @@
/**
+ * Say there's an attribute named "ID" and you want to build an IN filter
on it...
+ * sample: ID IN (1,2,3)
+ * @throws CQLException
+ */
+ @Test
+ public void idAttribtueInList() throws CQLException{
+
+ List<String> intList = Arrays.asList("1", "2", "3");
+ String propName = "ID";
+ final String txtPredicate = makeInPredicate(propName, intList);
+
+ Filter filter = ECQL.toFilter( txtPredicate);
+
+ commonAssertForInPredicate(filter);
+
+ assertFilterHasProperty((Or)filter, propName);
+ }
+
+ /**
* sample: length IN (4100001)
* @throws CQLException
*/
{code}
and produces the parse error:
{panel}
org.geotools.filter.text.cql2.CQLException: Encountered "ID IN ( 1" at line 1,
column 1.
Was expecting one of:
<NOT> ...
"(" ...
"[" ...
<IDENTIFIER> ...
"-" ...
<INTEGER_LITERAL> ...
<FLOATING_LITERAL> ...
<STRING_LITERAL> ...
"true" ...
"false" ...
"point" ...
"linestring" ...
"polygon" ...
"multipoint" ...
"multilinestring" ...
"multipolygon" ...
"geometrycollection" ...
"envelope" ...
"id" ...
"id" <NOT> ...
"id" "in" "(" <STRING_LITERAL> ...
"include" ...
"exclude" ...
. Parsing : ID IN (1,2,3). Current Token : "null"
at
org.geotools.filter.text.ecql.ECQLCompiler.compileFilter(ECQLCompiler.java:96)
...
{panel}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel