deegree / deegree3

Official deegree repository providing geospatial core libraries, data access and advanced OGC web service implementations
https://www.deegree.org
GNU Lesser General Public License v2.1
150 stars 100 forks source link

Unable to resolve reference to subtype #626

Closed Aster123 closed 2 years ago

Aster123 commented 9 years ago

We have configured Deegree (3.3.17) and it seemed to be working. When querying http://localhost:8080/wfswms/services?SERVICE=WFS&VERSION=1.1.0&request=GetFeature&TypeName=Ftm&BBOX=106278.201485,445470.3877,109684.259251,450565.950765,EPSG:28992&srsName=EPSG:28992 we received nice results. Then we added queryparameter traversexlinkdepth=* to our request, because we want to see the data of the subfeatures. Then the request crashes with the following error: WebFeatureService:649 - OWS-Exception: Unable to resolve reference to '#Communication_10359663'

With some debugging I found out that what is happening is the following: The query to find all my "Ftm" items is performed. With the data in this query a xlink to the communication query type is created. When this link is followed the exception occurs, because for this id communication does not exist in the database.

I would expect that minOccurs=0 in the element communication specifies that the communication item is optional. Therefore I would expect deegree to do one of the following things:

  1. Don't create the xlink for this item, because it is not available in the communications table
  2. While resolving the xlink, recognise that this element was marked as optional and therefore it doesn't matter that we can't resolve the xlink.

Relevant part of schema file:

<element name="Ftm" substitutionGroup="gml:AbstractFeature" type="app:FtmType"/>
<complexType name="FtmType">
    <complexContent>
        <extension base="gml:AbstractFeatureType">
            <sequence>
                <element minOccurs="1" name="message_number" type="int"/>
                <element minOccurs="0" name="validity_period_end" type="date"/>
                <element minOccurs="1" name="validity_period_start" type="date"/>
                <element minOccurs="1" name="serial_number" type="int"/>
                <element minOccurs="1" name="year" type="int"/>
                <element minOccurs="1" name="Geometry" type="gml:GeometryPropertyType"/>
                <element minOccurs="1" name="subject_code" type="string"/>
                <element minOccurs="0" name="contents" type="string"/>
                <element minOccurs="0" name="reason_code" type="string"/>
                <element maxOccurs="unbounded" minOccurs="0" name="communication" type="app:CommunicationPropertyType"/>
            </sequence>
        </extension>
    </complexContent>
</complexType>
<element name="Communication" substitutionGroup="gml:AbstractFeature" type="app:CommunicationType"/>
<complexType name="CommunicationType">
    <complexContent>
        <extension base="gml:AbstractFeatureType">
            <sequence>
                <element minOccurs="1" name="reporting_code" type="string"/>
                <element minOccurs="1" name="communication_code" type="string"/>
                <element minOccurs="0" name="number" type="string"/>
            </sequence>
        </extension>
    </complexContent>
</complexType>
<complexType name="CommunicationPropertyType">
    <sequence minOccurs="0">
        <element ref="app:Communication"/>
    </sequence>
    <attributeGroup ref="gml:AssociationAttributeGroup"/>
</complexType>

Relevant part of feature type mapping

<FeatureTypeMapping name="app:Ftm" table="ftm_view">
    <FIDMapping prefix="Ftm_">
        <Column name="bericht_id" type="integer"/>
    </FIDMapping>
    <Primitive mapping="message_number" path="app:message_number"/>
    <Primitive mapping="validity_period_end" path="app:validity_period_end"/>
    <Primitive mapping="validity_period_start" path="app:validity_period_start"/>
    <Primitive mapping="serial_number" path="app:serial_number"/>
    <Primitive mapping="year" path="app:year"/>
    <Geometry mapping="geometry" path="app:Geometry"/>
    <Complex path="app:subject_code">
        <Join fromColumns="bericht_id" table="pub_ftm" toColumns="bericht_id"/>
        <Primitive mapping="subject" path="."/>
    </Complex>
    <Complex path="app:contents">
        <Join fromColumns="bericht_id" table="pub_ftm" toColumns="bericht_id"/>
        <Primitive mapping="text_content" path="."/>
    </Complex>
    <Complex path="app:reason_code">
        <Join fromColumns="bericht_id" table="pub_ftm" toColumns="bericht_id"/>
        <Primitive mapping="reason" path="."/>
    </Complex>
    <Complex path="app:communication">
        <Feature path=".">
            <Join fromColumns="bericht_id" table="pub_communication" toColumns="bericht_id"/>
        </Feature>
    </Complex>
</FeatureTypeMapping>
lgoltz commented 6 years ago

I think this is expected behaviour. If a feature has a reference to the subfeature this must be resolvable.

How did you insert the features? Why the referenced feature is missing?

tfr42 commented 2 years ago

In the future please ask questions on the mailing list or GIS stackexchange. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements. Please read further in our community support guideline.