Hi list,

I have a problem trying to filter complex attribute value from a complex 
feature.
Ideally, the filter should be unmapped first to its simple feature form, eg.

Query:
   feature type: CGI_TermValue
   filter: [ gml:name = significant ]
   [properties:  ALL ]

Unmapped to this:

Query:
   feature type: CGITermValue
   filter: [ strTrim([getID()]) = significant ]
   [properties:  ALL ]

Then there's no problem. However, in my case, I don't have the simple features, 
as the complex features are adapted from a web service.
So I have to filter the complex attribute directly.
The value returned is the value collection of the complex attribute, which when 
compared to the string value, would return false.

In FilterAbstract, there's this hack:

protected Object eval(org.opengis.filter.expression.Expression expression, 
Object object) {
                if( expression == null ) return null;
                Object value = expression.evaluate( object );
        //HACK as this method is used internally for filter 
        //evaluation comparisons, etc, they work over the
        //contents (i.e. comparing an attexpresion with a literal)
        //so, lacking a better way of doing so, I'm putting this
        //check here
        if(value instanceof org.opengis.feature.Attribute){
            value = ((org.opengis.feature.Attribute)value).getValue();
        }
        return value;
        }

I was tempted to modify this hack to get the complex attribute value, but it 
felt wrong.
Instead, I added a new converter to retrieve the complex attribute value (only 
if the type has no attributes, ie. Simple content). 
I'm not sure if this is a good solution, but I can't think of anything else. 
Opinions?

Cheers

Rini   
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to