CARIS HIPS and SIPS : Support Files : Filters : Comparison Operators : Not-Equal-To Tags
 

Not-Equal-To Tags

The use of the AttributeValueIsEqualTo and ObjectAcronymIsNotEqualTo tags can be confusing.

This example shows the correct filter to find a feature whose geometry is equal to the feature being tested and whose CATLMK is not equal to 1, 2 or 3:

</Filter>

  <GeometryEquals>

    <Not>

      <Or>

        <AttributeValueIsEqualTo Acronym="CATLMK" Value="1" />

        <AttributeValueIsEqualTo Acronym="CATLMK" Value="2" />

        <AttributeValueIsEqualTo Acronym="CATLMK" Value="3" />

      </Or>

    </Not>

  </GeometryEquals>

</Filter>

Note that the <Or> operator has to be included within a <Not> operator. Without the <Not>, AttributeValueIsNotEqualTo Acronym="CATLMK" Value="1" will only return false if CATLMK = 1. If the feature does not contain a CATLMK as an attribute, it will return true.

Another issue involves using <Or>.

For example, if CATLMK = 2, the first filter line (<AttributeValueIsNotEqualTo Acronym="CATLMK" Value="1") will evaluate to true. Since this is an <Or>, only one of them has to be true, so the filter will return true. But the user would expect false in this case.

Similarly, you cannot use ObjectAcronymIsNotEqualTo inside of an <Or> unless you also use <Not>.

For example, if the object you are testing is a CGUSTA, this code will return true when it runs the first filter because a CGUSTA is not a BUISGL.

<Filter>

  <Or>

    <ObjectAcronymIsNotEqualTo Acronym="BUISGL" />

    <ObjectAcronymIsNotEqualTo Acronym="CGUSTA" />

    <ObjectAcronymIsNotEqualTo Acronym="LITVES" />

  </Or>

</Filter>

However, the user is expecting that this would return true only if the feature is not a BUISGL, CGUSTA or LITVES. The following example will work because the <Or> will return true if any of the three acronyms match. If they do, the <not> will be applied and the filter will return false, which is what is wanted.

<Filter>

  <Not>

    <Or>

      <ObjectAcronymIsEqualTo Acronym="BUISGL" />

      <ObjectAcronymIsEqualTo Acronym="CGUSTA" />

      <ObjectAcronymIsEqualTo Acronym="LITVES" />

    </Or>

  </Not>

</Filter>