Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WFS GetFeature POST request with filter fails to evaluate xlink:href attribute #573

Closed
nmtoken opened this issue Jun 11, 2015 · 18 comments · Fixed by #879
Closed

WFS GetFeature POST request with filter fails to evaluate xlink:href attribute #573

nmtoken opened this issue Jun 11, 2015 · 18 comments · Fixed by #879
Labels
bug error issue and bug (fix) medium ready WFS deegree Web Feature Service
Milestone

Comments

@nmtoken
Copy link

nmtoken commented Jun 11, 2015

Originally tested against deegree 3.3.13, but can confirm the issue remains in 3.3.14 and 3.4-pre17 releases.

When using a WFS 2 GetFeature POST request where the ValueReference attempts to evaluate an attribute value (tested specifically with xlink:href, may apply to other attributes), deegree fails to return any results. deegree therefore fails the Filter Encoding Minimum Standard Filter conformance class.

For example using the following service end point:

http://194.66.252.155/m4eu/services?

Looking at ge:MappedFeature (ref: http://194.66.252.155/m4eu/services?service=WFS&request=GetFeature&version=2.0.0&typenames=ge:MappedFeature&count=3&)

If we use a PropertyIsNull operator (tests the specified property to see if it exists in the resource being evaluated. ref: OpenGIS Filter Encoding 2.0 Encoding Standard, section 7.7.3.5) as below we get no results, but we can see that ge:mappingFrame/@xLink:href should evaluate.

<?xml version="1.0" encoding="UTF-8"?>
<GetFeature version="2.0.0" service="WFS" handle="Filter on attribute test with PropertyIsNull deegree" count="100"
    xmlns="http://www.opengis.net/wfs/2.0" 
    xmlns:ge="http://inspire.ec.europa.eu/schemas/ge-core/3.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:wfs="http://www.opengis.net/wfs/2.0"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd">
    <Query typeNames="ge:MappedFeature">
        <Filter xmlns="http://www.opengis.net/fes/2.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ge="http://inspire.ec.europa.eu/schemas/ge-core/3.0">
            <PropertyIsNull>
                <ValueReference>ge:mappingFrame/@xlink:href</ValueReference>
            </PropertyIsNull>
        </Filter>
    </Query>
</GetFeature>

As a sanity check we can see that a similar filter query using the PropertyIsNull operator but without the xlink:href attribute returns results:

<?xml version="1.0" encoding="UTF-8"?>
<GetFeature version="2.0.0" service="WFS" handle="Filter on element test with PropertyIsNull deegree" count="100"
    xmlns="http://www.opengis.net/wfs/2.0" 
    xmlns:ge="http://inspire.ec.europa.eu/schemas/ge-core/3.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:wfs="http://www.opengis.net/wfs/2.0"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd">
    <Query typeNames="ge:MappedFeature">
        <Filter xmlns="http://www.opengis.net/fes/2.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ge="http://inspire.ec.europa.eu/schemas/ge-core/3.0">
            <PropertyIsNull>
                <ValueReference>ge:mappingFrame</ValueReference>
            </PropertyIsNull>
        </Filter>
    </Query>`
</GetFeature>

It follows too that using a PropertyIsEqualTo operator to evaluate the value of the attribute also fails:

<?xml version="1.0" encoding="UTF-8"?>
<GetFeature version="2.0.0" service="WFS" handle="Filter on attribute test with PropertyIsEqualTo deegree" count="100"
    xmlns="http://www.opengis.net/wfs/2.0" 
    xmlns:ge="http://inspire.ec.europa.eu/schemas/ge-core/3.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:wfs="http://www.opengis.net/wfs/2.0"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd">
    <Query typeNames="ge:MappedFeature">
        <Filter xmlns="http://www.opengis.net/fes/2.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ge="http://inspire.ec.europa.eu/schemas/ge-core/3.0">
            <PropertyIsEqualTo>
                <ValueReference>ge:mappingFrame/@xlink:href</ValueReference>
                <Literal>http://inspire.ec.europa.eu/codeList/MappingFrameTerm/topographicSurface</Literal>
            </PropertyIsEqualTo>
        </Filter>
    </Query>
</GetFeature>

Just checking that such a query should be possible, here it is working as expected in a GeoServer service.

end point: http://ogc.bgs.ac.uk/digmap625k_gsml32_insp_gs/wfs?

Looking at gsml:MappedFeature (ref: http://ogc.bgs.ac.uk/digmap625k_gsml32_insp_gs/wfs?service=WFS&request=GetFeature&version=2.0.0&typenames=gsml:MappedFeature&count=3&)

The null test returns no results

<GetFeature
    version="2.0.2"
    service="WFS"
    handle="Filter on attribute test with PropertyIsNull GeoServer"
    count="10"
    xmlns="http://www.opengis.net/wfs/2.0"
    xmlns:fes="http://www.opengis.net/fes/2.0"
    xmlns:gsml="http://xmlns.geosciml.org/GeoSciML-Core/3.2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd">
    <Query typeNames="gsml:MappedFeature">
        <Filter  
            xmlns="http://www.opengis.net/fes/2.0" 
            xmlns:xlink="http://www.w3.org/1999/xlink" 
            xmlns:gsml="http://xmlns.geosciml.org/GeoSciML-Core/3.2" >
            <PropertyIsNull>
                <ValueReference>gsml:samplingFrame/@xlink:href</ValueReference>
            </PropertyIsNull>
        </Filter>
    </Query>
</GetFeature>

Whilst the PropertyIsEqualTo request for an xlink:href attribute gives us results

<GetFeature
    version="2.0.2"
    service="WFS"
    handle="Filter on attribute test with PropertyIsEqualTo GeoServer"
    count="10"
    xmlns="http://www.opengis.net/wfs/2.0"
    xmlns:fes="http://www.opengis.net/fes/2.0"
    xmlns:gsml="http://xmlns.geosciml.org/GeoSciML-Core/3.2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd">
    <Query typeNames="gsml:MappedFeature">
        <Filter  
            xmlns="http://www.opengis.net/fes/2.0" 
            xmlns:xlink="http://www.w3.org/1999/xlink" 
            xmlns:gsml="http://xmlns.geosciml.org/GeoSciML-Core/3.2" >
            <PropertyIsEqualTo>
                <ValueReference>gsml:samplingFrame/@xlink:href</ValueReference>
                <Literal>http://inspire.ec.europa.eu/codelist/MappingFrameValue/topOfBedrock</Literal>
            </PropertyIsEqualTo>
        </Filter>
    </Query>
</GetFeature>
@tfr42 tfr42 added the bug error issue and bug (fix) label Aug 21, 2015
@tfr42 tfr42 added this to the 3.4 milestone Nov 17, 2015
@tfr42
Copy link
Member

tfr42 commented Aug 30, 2016

@dstenger can you check this against OGC ETS for FE with TEAM engine please?

@tfr42
Copy link
Member

tfr42 commented Nov 8, 2016

@tfr42 tfr42 added contributions welcome asking for contribution (time and money sponsor) funding welcome financial sponsoring wanted (money) easy medium and removed easy labels Nov 8, 2016
@tfr42
Copy link
Member

tfr42 commented Apr 5, 2017

May apply to SE and deegree layer configuration as well, see #587.

@tfr42 tfr42 added in progress and removed contributions welcome asking for contribution (time and money sponsor) funding welcome financial sponsoring wanted (money) labels May 24, 2017
@tfr42
Copy link
Member

tfr42 commented May 24, 2017

PR is currently under preparation.

@tfr42
Copy link
Member

tfr42 commented Jun 14, 2017

@DirkThalheim
Copy link

Hi,

I'm having troubles applying filters on xlink:href attributes too. I'm using following workspace: https://github.com/de-bkg/deegree-workspace-dlm250-inspire and the fixed deegree version 3.4-RC3-bayldbvdeegree-1.0.0.

Within the workspace all INSPIRE categories are implemented with a Feature mapping. When I understand this issue right, it should be mapped as Primitive to be able to apply filters for xlink:href attributes. Unfortunately this leads to a totally removal of the xlink:href attribute within the GML output.

For example requesting the hy-n:HydroNode FeatureTypeMapping with following hydroNodeCategory configuration:

    <Complex path="hy-n:hydroNodeCategory">
      <Primitive path="@nilReason" mapping="hydronodecategory_nilreason"/>
      <Primitive path="@xsi:nil" mapping="hydronodecategory_nil"/>
      <Feature path=".">
        <Href mapping="hydronodecategory_href"/>
      </Feature>
    </Complex>

Produces:
<hy-n:hydroNodeCategory xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://inspire.ec.europa.eu/codelist/HydroNodeCategoryValue/flowRegulation"/>

Requesting the same FeatureType with following hydroNodeCategory configuration:

    <Complex path="hy-n:hydroNodeCategory">
      <Primitive path="@xlink:href" mapping="hydronodecategory_href"/>
      <Primitive path="@nilReason" mapping="hydronodecategory_nilreason"/>
      <Primitive path="@xsi:nil" mapping="hydronodecategory_nil"/>
    </Complex>

Produces:
<hy-n:hydroNodeCategory/>

Actually I can't determine the cause for that behaviour.

@tfr42
Copy link
Member

tfr42 commented Nov 6, 2017

Please verify expected behavior against recent release candidate 3.4-RC5 and report your results here.

@DirkThalheim
Copy link

Just upgraded to deegree 3.4-RC5. Still have the issue: When mapping as primitive, I get an empty hy-n:hydroNodeCategory node.

I just looked into the schema. hy-n:hydroNodeCategory is a gml:ReferencedType. Maybe it's connected to this type. But I'm pretty sure for other FeatureTypes it worked.

@tfr42
Copy link
Member

tfr42 commented Nov 13, 2017

OK, thank you for the feedback. Can you provide or point me to sample test data for the linked workspace?

@DirkThalheim
Copy link

The complete workspace configuration can be found here: https://github.com/de-bkg/deegree-workspace-dlm250-inspire. From the SQLFeatureStore configuration dlm250 just take the hy-n:HydroNode FeatureTypeMapping. Here you can alter the hy-n:hydroNodeCategory mapping from Feature to Primitive.

Sample data can be imported from this GetFeature Request: http://sg.geodatenzentrum.de/wfs_dlm250_inspire?service=WFS&request=GetFeature&VERSION=2.0.0&TYPENAMES=hy-n:HydroNode&COUNT=10

Let me know if you need more information.

@marcusmohr
Copy link

I have to confirm Dirk's problem with version 3.4-RC5. Furthermore it seems that it's not possible to use a filter with xlink:href in case of wms layerstyling. Neither a xlink:href filter in a sld nor in a feature layer seems to work. Thematically, this Problem is related to #587

@nmtoken
Copy link
Author

nmtoken commented Dec 7, 2017

I can confirm that PropertyIsEqualTo as below fails to return results on a service running 3.4-RC6

<?xml version="1.0" encoding="UTF-8"?>
<GetFeature version="2.0.0" service="WFS" handle="Filter on attribute test with PropertyIsEqualTo deegree" count="5"
    xmlns="http://www.opengis.net/wfs/2.0" 
    xmlns:ge="http://inspire.ec.europa.eu/schemas/ge-core/3.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:wfs="http://www.opengis.net/wfs/2.0"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd">
    <Query typeNames="ge:MappedFeature">
        <Filter xmlns="http://www.opengis.net/fes/2.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ge="http://inspire.ec.europa.eu/schemas/ge-core/3.0">
            <PropertyIsEqualTo>
                <ValueReference>ge:mappingFrame/@xlink:href</ValueReference>
                <Literal>http://inspire.ec.europa.eu/codeList/MappingFrameTerm/topographicSurface</Literal>
            </PropertyIsEqualTo>
        </Filter>
    </Query>
</GetFeature>

When a GetFeature request shows that the attribute value exists:

http://ogcdev.bgs.ac.uk/test/services?service=WFS&request=GetFeature&version=2.0.0&typenames=ge:MappedFeature&count=3&

@lgoltz
Copy link
Contributor

lgoltz commented Dec 8, 2017

Summary of the problems described in this issue

@lgoltz
Copy link
Contributor

lgoltz commented Dec 8, 2017

@nmtoken I assume you are using a SQLFeatureStore with relational mapping? Can you check the configuration of ge:mappingFrame? It is configured as primitive or feature mapping? Differences (concering @xlink:href) are described in https://github.com/deegree/deegree3/blob/master/deegree-services/deegree-webservices-handbook/src/main/sphinx/featurestores.rst#mapping-strategies-for-xlinkhref-attributes

@nmtoken
Copy link
Author

nmtoken commented Dec 8, 2017

Yes, the backed is a PostgreSQL/PostGIS relational database, and mappings are done using a SQLFeatureStore.

ge:mappingFrame is part of ge:MappedFeature which has the following mapping:

<!--
=============
MappedFeature
=============
-->
<FeatureTypeMapping name="ge:MappedFeature" table="MineralOccurrence_vw">
	<FIDMapping prefix="M4EU.MAF_">
		<Column name="mineralOccurrenceDbk" type="integer"/>
	</FIDMapping>
	<Complex path="ge:shape">
		<Geometry path="." mapping="geometry"/>
	</Complex>
	<Complex path="ge:mappingFrame">
		<Feature path=".">
			<Href mapping="mappingFrame"/>
		</Feature>
	</Complex>
	<Complex path="ge:specification">
		<Feature path=".">
			<Href mapping="mineralOccurrenceId"/>
		</Feature>
	</Complex>
</FeatureTypeMapping>

The complete mapping for the service and the XML schema is:
m4eu v1.1.2.zip

@lgoltz
Copy link
Contributor

lgoltz commented Dec 11, 2017

@nmtoken Please change your configuration as follows to support filtering on ge: mappingFrame/@xlink:href:

<Complex path="ge:mappingFrame">
  <Primitive path="@xlink:href" mapping="mappingFrame"/>
</Complex>

This is described in the section Mapping strategies for xlink:href attributes in the deegree-webservices Handbook.

@nmtoken
Copy link
Author

nmtoken commented Dec 11, 2017

@lgoltz thanks for the feedback.

I didn't create the mapping, just implementing it, so I will pass on this advice; I assume the strategy applies to any attributes I want to query, not just xlink:href?

@lgoltz
Copy link
Contributor

lgoltz commented Dec 13, 2017

I assume the strategy applies to any attributes I want to query, not just xlink:href?

Yes, but usually other attributes than @xlink:href are not configured as feature mapping.

@lgoltz lgoltz added the WFS deegree Web Feature Service label Jan 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug error issue and bug (fix) medium ready WFS deegree Web Feature Service
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants