Defect #1153

Catalog CSW filter can be wrong depending on configuration

Added by Blatti Yves almost 3 years ago.

Status:NewStart date:10/01/2015
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:CATALOG
Target version:-
Affected version:4.0.0

Description

Catalog CSW filter can be wrong (xsd validation fails) depending on configuration:

Example 1:

If the configured catalog has one (and only one) resource type specified, the output filter will contain:

                [...]
                <ogc:PropertyIsEqualTo>
                  <ogc:PropertyName>harvested</ogc:PropertyName>
                  <ogc:Literal>false</ogc:Literal>
                </ogc:PropertyIsEqualTo>
                <ogc:Or>
                  <ogc:PropertyIsEqualTo>
                    <ogc:PropertyName>resourcetype</ogc:PropertyName>
                    <ogc:Literal>geoproduit</ogc:Literal>
                  </ogc:PropertyIsEqualTo>
                </ogc:Or>
                <ogc:PropertyIsEqualTo>
                  <ogc:PropertyName>metadatastate</ogc:PropertyName>
                  <ogc:Literal>published</ogc:Literal>
                </ogc:PropertyIsEqualTo>
                [...]

You can see an ogc:Or element containing only one element.

Example 2:

The filter contains a 'top level' ogc:And for any catalog level filter. If it is empy, the ogc:And contains only one element ogc:And.

Reason :

http://schemas.opengis.net/filter/1.1.0/filter.xsd

   [...]
   <xsd:element name="logicOps" type="ogc:LogicOpsType" abstract="true"/>
   <xsd:element name="And" 
                type="ogc:BinaryLogicOpType" 
                substitutionGroup="ogc:logicOps"/>
   <xsd:element name="Or" 
                type="ogc:BinaryLogicOpType" 
                substitutionGroup="ogc:logicOps"/>
   [...]
   <xsd:complexType name="BinaryLogicOpType">
      <xsd:complexContent>
         <xsd:extension base="ogc:LogicOpsType">
            <xsd:choice minOccurs="2" maxOccurs="unbounded">
               <xsd:element ref="ogc:comparisonOps"/>
               <xsd:element ref="ogc:spatialOps"/>
               <xsd:element ref="ogc:logicOps"/>
            </xsd:choice>
         </xsd:extension>
      </xsd:complexContent>
   </xsd:complexType>
   [...]

ogc:And and ocg:or are BinaryLogicOpType and have ton contain at least 2 elements of type : ogc:comparisonOps, ogc:spatialOps or ogc:logicOps

Solution :

Any BinaryLogicOp element (or/and) should be dropped if it only contains one element, and its content should be placed in the direct parent.

Also available in: Atom PDF