Hi,
I am working on a WFS request where we want results like an outer join, that is, we want to get all features from one table even if they do not have a match in the other.
Doing this with Ben Burns (also of Geocent) for one of our projects.
I can see that outer joins are not supported currently, so I am working to investigate how we can achieve “outer join like” results without an outer join.
Ideas:
a. use an Or filter (credit to Ben for this idea) where the first filter will get the ‘inner join’ tuples and the second filter will get the ‘outer only’ tuples.
Started investigating this, and currently not able to do a WFS join with an Or filter. (details below)
Is it feasible for me to try to add the Or filter to WFS join and see if I can get it to succeed?
Has the Or filter been tried before and it was not able to be implemented?
b. Possibly create a View with an outer join within it and then have GeoServer reference the View instead.
I have not investigated this yet, I think it may have been considered already though and may not be possible in our situation.
c. Are there other existing ideas to get “outer join like” results without an outer join?
Any background info from GeoServer developers would be appreciated.
Thank you for your time!
Jeff
====== begin - details on the Or filter attempt ======
Here is an example i tried that fails with an Or and succeeds when I replace the Or with And:
<wfs:GetFeature xmlns:wfs=“http://www.opengis.net/wfs/2.0”
xmlns:fes=“http://www.opengis.net/fes/2.0”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
service=“WFS” version=“2.0.0”
xsi:schemaLocation=“http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd”>
<wfs:Query typeNames=“geotoolsOnlineTests:ftjoin geotoolsOnlineTests:ft1” aliases=“ftjoin ft1”>
fes:ValueReferenceftjoin/name</fes:ValueReference>
fes:ValueReferenceft1/stringProperty</fes:ValueReference>
</fes:PropertyIsEqualTo>
fes:ValueReferenceft1/id</fes:ValueReference>
fes:ValueReferenceft1/id</fes:ValueReference>
</fes:PropertyIsEqualTo>
</fes:Or>
</fes:Filter>
</wfs:Query>
</wfs:GetFeature>
I see that the wfs/GetFeature.java class disallows the Or filter, and also the Not filter, for joins.
From wfs/GetFeature.java class, line 161:
//we only support simple filters, and any of them And’ed together.
joinFilterCapabilities.addType(And.class);
===== end - details on the Or filter attempt =====
Other tidbits:
I did some looking around on GeoServer and GeoTools mail archives for background info re: joins and I saw this user report of not being able to use the Or filter:
http://osgeo-org.1560.x6.nabble.com/WFS-2-0-join-OR-problem-td5019289.html
The relevant specs that describe only inner joins:
OpenGIS Web Feature Service 2.0 Interface Standard section 7.9.2.5.3.1 Join queries
OpenGIS Filter Encoding 2.0 Encoding Standard, section 6.3.3.1.5 Join queries
Thank you,
Jeffrey Wood
Software Engineer
Geocent
Email: jeffrey.wood@anonymised.com
Ph (BR): 225-214-4346