Hi,

 

The WFS specification clearly specifies that aliases can be used  in the typeName attribute of the GetFeature request. However the OGC Filter specification remains completely silent about how the usage of aliases in the OGC Filter. So I went back to Peter Vretanos to ask clarifications about this. Here an extract from what he sent to me that I want to share with you in order to enhance to alias support (useful for joins in query) in the Geotools.

 

----- Extract begin ----------------------

 

Aliases work exactly are the name implies.  The alias is simply another name that can substitute for the name of some feature type.

 

So here is a GetFeature example without aliases:

 

<GetFeature>

    <Query handle="Q1" typeName="INWATERA_1M">

       <Filter>

          <Not>

             <Disjoint>

                <PropertyName>/INWATERA_1M/GEOMETRY</PropertyName>

                <Box srsName="EPSG:4326">

                   <coordinates>-150,50 -125,60</coordinates>

                </Box>

             </Disjoint>

          </Not>

       </Filter>

    </Query>

</GetFeature>

 

Here is the same example using aliases:

 

<GetFeature>

    <Query handle="Q1" typeName="INWATERA_1M=A">

       <Filter>

          <Not>

             <Disjoint>

                <PropertyName>/A/GEOMETRY</PropertyName>

                <Box srsName="EPSG:4326">

                   <coordinates>-150,50 -125,60</coordinates>

                </Box>

             </Disjoint>

          </Not>

       </Filter>

    </Query>

</GetFeature>

 

In other words, the name 'A' can substitute for the name 'INWATERA_1M'

in any part of the Query.

 

This example is trivial.  A more relevant example is one where you are joining a number of features together or even performing a self-join and you need to distinguish the two identical feature types:

 

<GetFeature>

    <Query typeNames="ns1:Feature=A ns1:Feature=B">

       <ogc:Filter>

          <ogc:And>

             <ogc:PropertyIsEqualTo>

                <ogc:PropertyName>/A/subject</ogc:PropertyName>

                <ogc:PropertyName>/B/subject</ogc:PropertyName>

             </ogc:PropertyIsEqualTo>

             <ogc:BBOX>

                <ogc:PropertyName>/A/spatial</ogc:PropertyName>

                <gml:Box srsName="EPSG:4326">

                   <gml:coordinates>-80,30 -70,40</gml:coordinates>

                </gml:Box>

             </ogc:BBOX>

          </ogc:And>

       </ogc:Filter>

    </Query>

</GetFeature>

 

 

-------  End of Extract ---------------------------

 

Based on the brief look I had on the Filter  Geotools API, it seems you have made progress on the FilterFactory API by allowing the creation of an AttributeExpression from XPath string (and not anymore from FeatureType, attributeName).

However the FilterFactory javadoc remains silent about the usage of the alias in this XPath.

The API is even more ambiguous in the Query and DefaultQuery typename usage. It takes a string but it does not mentioned if this string can contains multiple feature type and aliases.

 

I have the following questions:

 

Does Geotools supports aliases in the typename ?

Does the different plugins such as Oracle Spatial, MYSQL,ArcSDE leverage these capabilities ?

 

If not, the translation would be pretty straightforward to implement by extending the from clause encoding.  I think this issue is a critical one that needs to be addressed before the release of the next version.

 

Your feedback is welcome

 

Best regards

 

Stephane Fellah

Senior Lead Engineer, Product Manager

Image Matters LLC

Leesburg,VA
USA

 

 

 

 

 

 

 

 

 

 

 

_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to