Opened 18 years ago

Last modified 18 years ago

#1694 new defect

FE with Logical OR operator failed with several fields

Reported by: olivier.courtin@… Owned by: mapserverbugs
Priority: high Milestone:
Component: WMS Server Version: 4.8
Severity: normal Keywords:
Cc:

Description

Hi,

I've met following problem with a 4.8.0rc2 Mapserver working as WMS server:

Case 1 (Work fine):

 <Filter>
         <PropertyIsEqualTo>
           <PropertyName>LIBELLE</PropertyName>
           <Literal>foo</Literal>
         </PropertyIsEqualTo>
 </Filter>


Case 2 (Work fine too):

 <Filter>
         <PropertyIsEqualTo>
           <PropertyName>Code</PropertyName>
           <Literal>bar</Literal>
         </PropertyIsEqualTo>
 </Filter>



Case 3 (Not work and that's the matter):

    <Filter>
      <OR>
         <PropertyIsEqualTo>
           <PropertyName>LIBELLE</PropertyName>
           <Literal>foo</Literal>
         </PropertyIsEqualTo>
         <PropertyIsEqualTo>
           <PropertyName>CODE</PropertyName>
           <Literal>bar</Literal>
         </PropertyIsEqualTo>
       </OR>
     </Filter>

(No result at all are retrieved with this FE)
 

Case 4 (Work fine also):

 <Filter>
      <OR>
         <PropertyIsEqualTo>
           <PropertyName>LIBELLE</PropertyName>
           <Literal>foo</Literal>
         </PropertyIsEqualTo>
         <PropertyIsEqualTo>
           <PropertyName>LIBELLE</PropertyName>
           <Literal>bar</Literal>
         </PropertyIsEqualTo>
       </OR>
     </Filter>


==> So it looks like using several fields in FE not work rightly with 
    a logical OR operator.

Change History (3)

comment:1 by assefa, 18 years ago

I have use a test sld which looks like the following with the latest mapserver
and It seems to work ok :

<StyledLayerDescriptor version="1.0.0">
<NamedLayer>
<Name>WorldGen_Outline</Name>
<UserStyle>
<Title>xxx</Title>
<FeatureTypeStyle>
<Rule>
<Filter><OR><PropertyIsEqualTo><PropertyName>NA3DESC</PropertyName><Literal>Antarctic</Literal></PropertyIsEqualTo><PropertyIsEqualTo><PropertyName>COUNT</PropertyName><Literal>2</Literal></PropertyIsEqualTo></OR></Filter>
<LineSymbolizer>
<Geometry>
<PropertyName>center-line</PropertyName>
</Geometry>
<Stroke>
<CssParameter name="stroke">#0000ff</CssParameter>
<CssParameter name="stroke-width">2.0</CssParameter>
</Stroke>
</LineSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>

 I can not reproduce this with the test data I have here. Please provide test
samples

comment:2 by olivier.courtin@…, 18 years ago

Hi, here some sample tests 


1) WMS original layer data:
http://services.sandre.eaufrance.fr/geo/zonage?SERVICE=WMS&REQUEST=GetMap&LAYERS=CIBA&VERSION=1.1.1&SRS=epsg:27582&BBOX=-120000,1600000,1220000,2700000&WIDTH=600&HEIGHT=500

2) IsEqual OR IsEqual Tests

[OK]
http://services.sandre.eaufrance.fr/geo/zonage?SERVICE=WMS&REQUEST=GetMap&LAYERS=CIBA&VERSION=1.1.1&SRS=epsg:27582&BBOX=-120000,1600000,1220000,2700000&WIDTH=600&HEIGHT=500&SLD=http://dev.camptocamp.com/~olivier/sld_1694/sld_code_equal_1

[OK]
http://services.sandre.eaufrance.fr/geo/zonage?SERVICE=WMS&REQUEST=GetMap&LAYERS=CIBA&VERSION=1.1.1&SRS=epsg:27582&BBOX=-120000,1600000,1220000,2700000&WIDTH=600&HEIGHT=500&SLD=http://dev.camptocamp.com/~olivier/sld_1694/sld_code_equal_2

[OK]
http://services.sandre.eaufrance.fr/geo/zonage?SERVICE=WMS&REQUEST=GetMap&LAYERS=CIBA&VERSION=1.1.1&SRS=epsg:27582&BBOX=-120000,1600000,1220000,2700000&WIDTH=600&HEIGHT=500&SLD=http://dev.camptocamp.com/~olivier/sld_1694/sld_libelle_equal_1

[OK]
http://services.sandre.eaufrance.fr/geo/zonage?SERVICE=WMS&REQUEST=GetMap&LAYERS=CIBA&VERSION=1.1.1&SRS=epsg:27582&BBOX=-120000,1600000,1220000,2700000&WIDTH=600&HEIGHT=500&SLD=http://dev.camptocamp.com/~olivier/sld_1694/sld_libelle_equal_2


3) IsLike OR IsLike Tests

[OK]
http://services.sandre.eaufrance.fr/geo/zonage?SERVICE=WMS&REQUEST=GetMap&LAYERS=CIBA&VERSION=1.1.1&SRS=epsg:27582&BBOX=-120000,1600000,1220000,2700000&WIDTH=600&HEIGHT=500&SLD=http://dev.camptocamp.com/~olivier/sld_1694/sld_code_like_1

[ERROR]
http://services.sandre.eaufrance.fr/geo/zonage?SERVICE=WMS&REQUEST=GetMap&LAYERS=CIBA&VERSION=1.1.1&SRS=epsg:27582&BBOX=-120000,1600000,1220000,2700000&WIDTH=600&HEIGHT=500&SLD=http://dev.camptocamp.com/~olivier/sld_1694/sld_code_like_2

[OK]
http://services.sandre.eaufrance.fr/geo/zonage?SERVICE=WMS&REQUEST=GetMap&LAYERS=CIBA&VERSION=1.1.1&SRS=epsg:27582&BBOX=-120000,1600000,1220000,2700000&WIDTH=600&HEIGHT=500&SLD=http://dev.camptocamp.com/~olivier/sld_1694/sld_libelle_like_1

[ERROR]
http://services.sandre.eaufrance.fr/geo/zonage?SERVICE=WMS&REQUEST=GetMap&LAYERS=CIBA&VERSION=1.1.1&SRS=epsg:27582&BBOX=-120000,1600000,1220000,2700000&WIDTH=600&HEIGHT=500&SLD=http://dev.camptocamp.com/~olivier/sld_1694/sld_libelle_like_2

4) IsLike OR IsEqual tests 

[ERROR]
http://services.sandre.eaufrance.fr/geo/zonage?SERVICE=WMS&REQUEST=GetMap&LAYERS=CIBA&VERSION=1.1.1&SRS=epsg:27582&BBOX=-120000,1600000,1220000,2700000&WIDTH=600&HEIGHT=500&SLD=http://dev.camptocamp.com/~olivier/sld_1694/sld_code_mix_1

[ERROR]
http://services.sandre.eaufrance.fr/geo/zonage?SERVICE=WMS&REQUEST=GetMap&LAYERS=CIBA&VERSION=1.1.1&SRS=epsg:27582&BBOX=-120000,1600000,1220000,2700000&WIDTH=600&HEIGHT=500&SLD=http://dev.camptocamp.com/~olivier/sld_1694/sld_code_mix_2

[ERROR]
http://services.sandre.eaufrance.fr/geo/zonage?SERVICE=WMS&REQUEST=GetMap&LAYERS=CIBA&VERSION=1.1.1&SRS=epsg:27582&BBOX=-120000,1600000,1220000,2700000&WIDTH=600&HEIGHT=500&SLD=http://dev.camptocamp.com/~olivier/sld_1694/sld_libelle_mix_1

[ERROR]
http://services.sandre:.eaufrance.fr/geo/zonage?SERVICE=WMS&REQUEST=GetMap&LAYERS=CIBA&VERSION=1.1.1&SRS=epsg:27582&BBOX=-120000,1600000,1220000,2700000&WIDTH=600&HEIGHT=500&SLD=http://dev.camptocamp.com/~olivier/sld_1694/sld_libelle_mix_2


HTH :)

comment:3 by assefa, 18 years ago

Olivier,

 I saw you samples. Thanks. I was initially testing with 2 IsEqual operators.

 It is not unfortunatly a "bug" but a limitation of what is implemented right
now with filter support inside sld. 
 What hapens is that for each rule containing a filter, the code parses the
filter and try to create a mapserver class expression.  You can realize that the
Filter can be so complex that this simple trasformation from Filter to class
expression works only for limited type of filters (ex simple comparison or
simple comparison with a logical node like or/and.  In you case the use of
IsEqual (which is transformed in mapserve expressions) combined with a logical
expression (which is transformed into a regular expression) is 'too complexe' to
handle for the current way of doing things.
 There could be ways to handle this, since the code to parse any type of complex
filters is already available (and used for WFS filters) but the way to handle
drawing with several rules containing filters (both comparison and spatial) and
a possible else filter inside a WMS/SLD needs some work which is not in the
current code.
Note: See TracTickets for help on using tickets.