[mapserver-users] Interpretation of OGC filter encoding

Eichner, Andreas - SID-NLKM Andreas.Eichner at sid.sachsen.de
Mon Jan 25 09:04:37 EST 2010


Hey guys,

while reading the OGC filter encoding specification I was wondering how
the part about properties should be interpreted. I thought it would be a
good idea to ask other users about their thoughts and may be one or the
other hacker has an eye on the list too...

The specs states in part 6 Properties that "The <PropertyName> element
is used to encode the name of any property of an object." and that "a
filter expression processor must use the subset of XPath [10]
expressions defined in this document" Those expressions are basically
relative location paths using abbreviated sytnax and "5. Each step in
the path may optionally contain a predicate composed of the predicate
delimiters '[' and ']' and a number indicating which child of the
context node is to be selected."

The example with the Person feature type shows two <phone> elements:
  <?xml version="1.0"?>
    <myns:Person
          SIN="111222333"
          xmlns:myns="http://www.someserver.com/myns"
          xmlns:gml="http://www.opengis.net/gml"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.opengis.net/myns Person.xsd">
          <myns:lastName>Smith</myns:lastName>
    <myns:firstName>Fred</myns:firstName>
    <myns:age>35</myns:age>
    <myns:sex>Male</myns:sex>
    <myns:spouse SIN="444555666" />
    <myns:location>
      <gml:Point><gml:pos>15 15</gml:pos></gml:Point>
    </myns:location>
    <myns:mailAddress>
      <myns:Address>
        <myns:streetName>Main St.</myns:streetName>
        <myns:streetNumber>5</myns:streetNumber>
        <myns:city>SomeCity</myns:city>
        <myns:province>SomeProvince</myns:province>
        <myns:postalCode>X1X 1X1</myns:postalCode>
        <myns:country>Canada</myns:country>
      </myns:Address>
    </myns:mailAddress>
    <myns:phone>416-123-4567</myns:phone>
    <myns:phone>416-890-1234</myns:phone>
  </myns:Person>

What would happen if I use a filter like:

<Filter>
  <PropertyIsLike escapeChar="!" singleChar="?" wildCard="*"
matchCase="false" >
    <PropertyName>Person/phone</PropertyName>
    <Literal>416-890-*</Literal>
  </PropertyIsLike>
</Filter>

Since the XPath given in the PropertyName addresses more than one
element, how should the filter work? Does it select any feature
containing at least one phone element with content matching the pattern
and therefore being a SQLish filter? Or does it work like the
string/number/boolean functions from the XPath spec and convert the
first node in document order which would be the concatenation of every
descendant text node of the first phone element (in the example exactly
one but the mailAddress element's value would be "\n  \n      Main St.\n
5\n      SomeCity\n      SomeProvince\n      X1X 1X1\n      Canada\n
\n"). Or should a predicate of "[1]" be implied?

I believe the SQLish behaviour is better usable but the XPath one does
more conform to the XML-based standards. I checked the specs again and
again but couldn't find any hint how that should be handled neither
within the "6. Properties" section nor within the sections dealing with
the operators.

This fuzzy definition of a "Property" becomes a big problem when dealing
with SQL data mapped to XML especially if you try to build SQL filters
out of the OGC filters...
 
If there are any thoughts, please let me know.
 

Kind regards,
Andreas Eichner



More information about the mapserver-users mailing list