[Geoserver-devel] app-schema WMS sld filtering

Hi Niels,

I have been trying to debug an issue where if a filter imbedded in SLD such as the one below filters on a mapping where a function is used eg

Mapping:

if_then_else(isNull(HASRELATEDACTIVITY),toXLinkHref…

I get the error as show on the stacktrace attached. Would you be able to suggest where I should be looking? The exception is thrown from AttributeExpressionImpl.tryAccessor where the attPath(HASRELATEDACTIVITY) could not be found in the object. Any suggestions, tip or clue at this stage will be helpful thanks J

Filter

ogc:Filter

<ogc:PropertyIsLike escapeChar=“!” wildCard=“*” matchCase=“false” singleChar=“#” >

ogc:PropertyNameer:specification/er:Mine/er:relatedActivity/er:MiningActivity/gml:name</ogc:PropertyName>

ogc:Literal*</ogc:Literal>

</ogc:PropertyIsLike>

</ogc:Filter>

StackTrace:

Caused by: java.lang.RuntimeException: Error applying mapping with targetAttribute er:specification

at org.geotools.data.complex.DataAccessMappingFeatureIterator.computeNext(DataAccessMappingFeatureIterator.java:994)

at org.geotools.data.complex.AbstractMappingFeatureIterator.next(AbstractMappingFeatureIterator.java:280)

at org.geotools.data.complex.PostFilteringMappingFeatureIterator.getFilteredNext(PostFilteringMappingFeatureIterator.java:56)

at org.geotools.data.complex.PostFilteringMappingFeatureIterator.(PostFilteringMappingFeatureIterator.java:47)

at org.geotools.data.complex.MappingFeatureIteratorFactory.getInstance(MappingFeatureIteratorFactory.java:185)

at org.geotools.data.complex.MappingFeatureCollection.features(MappingFeatureCollection.java:174)

at org.geotools.renderer.lite.StreamingRenderer.drawPlain(StreamingRenderer.java:2475)

at org.geotools.renderer.lite.StreamingRenderer.processStylers(StreamingRenderer.java:2045)

at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:829)

at org.geoserver.wms.map.RenderedImageMapOutputFormat.produceMap(RenderedImageMapOutputFormat.java:490)

… 99 more

Caused by: java.lang.RuntimeException: Error applying mapping with targetAttribute er:relatedActivity

at org.geotools.data.complex.DataAccessMappingFeatureIterator.computeNext(DataAccessMappingFeatureIterator.java:994)

at org.geotools.data.complex.AbstractMappingFeatureIterator.next(AbstractMappingFeatureIterator.java:280)

at org.geotools.data.joining.JoiningNestedAttributeMapping.getFeatures(JoiningNestedAttributeMapping.java:375)

at org.geotools.data.complex.DataAccessMappingFeatureIterator.setAttributeValue(DataAccessMappingFeatureIterator.java:543)

at org.geotools.data.complex.DataAccessMappingFeatureIterator.computeNext(DataAccessMappingFeatureIterator.java:981)

… 108 more

Caused by: java.lang.IllegalArgumentException: Filter Function problem for function if_then_else argument #0 - expected type boolean

at org.geotools.filter.function.FilterFunction_if_then_else.evaluate(FilterFunction_if_then_else.java:52)

at org.geotools.data.complex.NestedAttributeMapping.getNestedFeatureType(NestedAttributeMapping.java:435)

at org.geotools.data.complex.DataAccessMappingFeatureIterator.setAttributeValue(DataAccessMappingFeatureIterator.java:484)

at org.geotools.data.complex.DataAccessMappingFeatureIterator.computeNext(DataAccessMappingFeatureIterator.java:981)

… 112 more

Victor Tey

Software Engineer
ASRDC
CSIRO Earth Science and Resource Engineering

Phone: cid:image001.gif@anonymised.com..cid:image002.gif@anonymised.comcid:image003.gif@anonymised.comcid:image003.gif@anonymised.comcid:image004.gif@anonymised.comcid:image003.gif@anonymised.comcid:image003.gif@anonymised.comcid:image003.gif@anonymised.comcid:image003.gif@anonymised.comcid:image003.gif@anonymised.comcid:image003.gif@anonymised.comcid:image003.gif@anonymised.com+61 8 6436 8944
Victor.Tey@anonymised.com | www.csiro.au |
Address: Australian Resources Research Centre, 26 Dick Perry Avenue, Kensington WA 6151

PLEASE NOTE
The information contained in this email may be confidential or privileged. Any unauthorised use or disclosure is prohibited. If you have received this email in error, please delete it immediately and notify the sender by return email. Thank you. To the extent permitted by law, CSIRO does not represent, warrant and/or guarantee that the integrity of this communication has been maintained or that the communication is free of errors, virus, interception or interference.

Please consider the environment before printing this email.

Hi Victor,

Unfortunately, functions throw this kind of exception whenever something goes wrong in the evaluation of an argument, this is kind of misleading but it has nothing to do with the data type. If the field /HASRELATEDACTIVITY/ does not even exist as a property in the object, an exception is thrown when trying to evaluate it. Normally it will return null but with app-schema mappings we did this on purpose by putting setLenient(true): see FilterFactoryImplReportInvalidProperty. The reason this was done is because people wanted an exception thrown if they accidentally misspelled the column name: see InvalidColumnTest.

Hope this helps.

Cheers
Niels

On 01/15/2013 10:32 AM, Victor.Tey@anonymised.com wrote:

Hi Niels,

I have been trying to debug an issue where if a filter imbedded in SLD such as the one below filters on a mapping where a function is used eg

/Mapping:/

/if_then_else(isNull(HASRELATEDACTIVITY),toXLinkHref...../

I get the error as show on the stacktrace attached. Would you be able to suggest where I should be looking? The exception is thrown from AttributeExpressionImpl.tryAccessor where the attPath(/HASRELATEDACTIVITY) could not be found in the object. Any suggestions, tip or clue at this stage will be helpful thanks //J/

/Filter/

/<ogc:Filter>/

/<ogc:PropertyIsLike escapeChar="!" wildCard="*" matchCase="false" singleChar="#" >/

/<ogc:PropertyName>er:specification/er:Mine/er:relatedActivity/er:MiningActivity/gml:name</ogc:PropertyName>/

/<ogc:Literal>*</ogc:Literal>/

/</ogc:PropertyIsLike>/

/</ogc:Filter>/

StackTrace:

Caused by: _java.lang.RuntimeException_: Error applying mapping with targetAttribute er:specification

at org.geotools.data.complex.DataAccessMappingFeatureIterator.computeNext(_DataAccessMappingFeatureIterator.java:994_)

at org.geotools.data.complex.AbstractMappingFeatureIterator.next(_AbstractMappingFeatureIterator.java:280_)

at org.geotools.data.complex.PostFilteringMappingFeatureIterator.getFilteredNext(_PostFilteringMappingFeatureIterator.java:56_)

at org.geotools.data.complex.PostFilteringMappingFeatureIterator.<init>(_PostFilteringMappingFeatureIterator.java:47_)

at org.geotools.data.complex.MappingFeatureIteratorFactory.getInstance(_MappingFeatureIteratorFactory.java:185_)

at org.geotools.data.complex.MappingFeatureCollection.features(_MappingFeatureCollection.java:174_)

at org.geotools.renderer.lite.StreamingRenderer.drawPlain(_StreamingRenderer.java:2475_)

at org.geotools.renderer.lite.StreamingRenderer.processStylers(_StreamingRenderer.java:2045_)

at org.geotools.renderer.lite.StreamingRenderer.paint(_StreamingRenderer.java:829_)

at org.geoserver.wms.map.RenderedImageMapOutputFormat.produceMap(_RenderedImageMapOutputFormat.java:490_)

... 99 more

Caused by: _java.lang.RuntimeException_: Error applying mapping with targetAttribute er:relatedActivity

at org.geotools.data.complex.DataAccessMappingFeatureIterator.computeNext(_DataAccessMappingFeatureIterator.java:994_)

at org.geotools.data.complex.AbstractMappingFeatureIterator.next(_AbstractMappingFeatureIterator.java:280_)

at org.geotools.data.joining.JoiningNestedAttributeMapping.getFeatures(_JoiningNestedAttributeMapping.java:375_)

at org.geotools.data.complex.DataAccessMappingFeatureIterator.setAttributeValue(_DataAccessMappingFeatureIterator.java:543_)

at org.geotools.data.complex.DataAccessMappingFeatureIterator.computeNext(_DataAccessMappingFeatureIterator.java:981_)

... 108 more

Caused by: _java.lang.IllegalArgumentException_: Filter Function problem for function if_then_else argument #0 - expected type boolean

at org.geotools.filter.function.FilterFunction_if_then_else.evaluate(_FilterFunction_if_then_else.java:52_)

at org.geotools.data.complex.NestedAttributeMapping.getNestedFeatureType(_NestedAttributeMapping.java:435_)

at org.geotools.data.complex.DataAccessMappingFeatureIterator.setAttributeValue(_DataAccessMappingFeatureIterator.java:484_)

at org.geotools.data.complex.DataAccessMappingFeatureIterator.computeNext(_DataAccessMappingFeatureIterator.java:981_)

... 112 more

*Victor Tey *

Software Engineer
ASRDC
CSIRO Earth Science and Resource Engineering**

Phone: cid:image001.gif@anonymised.com:image002.gif@anonymised.com:image003.gif@anonymised.com:image003.gif@anonymised.com:image004.gif@anonymised.com:image003.gif@anonymised.com:image003.gif@anonymised.com:image003.gif@anonymised.com:image003.gif@anonymised.com:image003.gif@anonymised.com:image003.gif@anonymised.com:image003.gif@anonymised.com+61 8 6436 8944
Victor.Tey@anonymised.com <mailto:Victor.Tey@anonymised.com> *|* www.csiro.au <http://www.csiro.au/&gt; *|*
Address: Australian Resources Research Centre, 26 Dick Perry Avenue, Kensington WA 6151**

*PLEASE NOTE*
The information contained in this email may be confidential or privileged. Any unauthorised use or disclosure is prohibited. If you have received this email in error, please delete it immediately and notify the sender by return email. Thank you. To the extent permitted by law, CSIRO does not represent, warrant and/or guarantee that the integrity of this communication has been maintained or that the communication is free of errors, virus, interception or interference.

*Please consider the environment before printing this email.*