[Geoserver-users] Feature Chaining Query

Hello,

I’ve encountered some difficulty with App-Schema’s feature chaining capability and would be very appreciative if someone could lend me a hand. Apologies for the long email – here is my explanation of the issue in a “nutshell”:

I have two feature types - “Bottom Object” and “Impact Scour”. These features have a one to many association – i.e., one Bottom Object can have any number of Impact Scours.

I have created a bottom_object table ((1)) and an impact_scour table ((2)) in a PostGIS database, and have populated them with some sample data. The impact_scour table has a fk_bottom_object column that is used to implement the one to many association.

Next, I defined a GMLAS ((3)) for my BottomObject and ImpactScour feature types. In particular, the complex type BottomObjectType has a property “impactScour” of type ImpactScourPropertyType, with minOccurs=”0” and maxOccurs=”unbounded” in accordance with the one to many association. The ImpactScourPropertyType’s sequence also has minOccurs=”0”, to allow the WFS to return each of the BottomObjects’ ImpactScours in its response.

Having confirmed that the GMLAS was valid, I then defined the App-Schema mapping for the ImpactScour feature type ((4)). In particular, the idExpression is sourced from the pk_id column in the impact_scour PostGIS table, and the fk_bottom_object is mapped to a gml:name attribute in the GMLAS.

Similarly, I then defined the app-schema mapping for the BottomObject feature type ((5)). Once again, the idExpression corresponds to the pk_id from the bottom_object PostGIS table. But now, feature chaining is used to map to the impactScour complex property type. I have configured this attribute mapping as follows:

· targetAttribute = myPrefix:impactScour (the name of the complex-typed property in the GMLAS)

· OCQL = pk_id (the ID column from the bottom_object PostGIS table)

· linkElement = myPrefix:ImpactScour (the complex property type of the targetAttribute)

· linkField = gml:name (matching the targetAttribute gml:name with the fk_bottom_object column as its source).

· isMultiple = true (since the association is one to many)

With these mappings in place, I then queried my WFS for ImpactScour feature types and got the response I expected (all attributes mapped across successfully from the data in the impact_scour PostGIS table). However, I then queried my WFS for BottomObject feature types and got an unexpected response ((6)). The issues are:

· ImpactScour elements are being referenced instead of being displayed in full, despite minOccurs=”0” being set in the ImpactScourPropertyType.

· The BottomObject with gml:id=“2” only displays 2 of the 3 ImpactScours in full (the first ImpactScour is referenced with hRef)

· The last BottomObject is not mapped across at all

I’m expecting my WFS response to show all of the Bottom Objects and the one or more Impact Scours they are associated with in full.

Unfortunately my colleague and I are stumped as to how to resolve the issue – we’ve tried mimicking the structure of the GMLAS and mapping files used for the gsml:GeologicUnit and gsml:MappedFeature feature types used within the App-Schema tutorial ( http://docs.geoserver.org/stable/en/user/data/app-schema/tutorial.html ), but with no joy.

We’ve seen feature chaining work successfully in the tutorial, but we can’t see any significant difference between our setup and the tutorial’s setup (and therefore can’t determine why our WFS response isn’t what we require it to be!)

If anyone can spot any flaws in our configuration, or offer any suggestions on how we may resolve this issue, it would be really appreciated :slight_smile: Please note that the XML blocks below are snippets from a larger file – if more information is required this can be provided.

Best Regards,

Ryan

((1)) === Begin PostGIS Table “bottom_object” ===

pk_id , bottom_object_data

0 , 0.0

1 , 24.0

2 , 26.0

3 , 30.0

((1)) === End PostGIS Table “bottom_object” ===

((2)) === Begin PostGIS Table “impact_scour” ===

pk_id , impact_scour_data , fk_bottom_object

0 , -5 , 0

1 , 22 , 1

2 , 24 , 2

3 , 26 , 2

4 , 1 , 2

5 , 12 , 3

6 , 4 , 3

7 , 28 , 3

((2)) === End PostGIS Table “impact_scour” ===

((3)) === Begin GML Application Schema ===

<xs:element name=“BottomObject” type=“myPrefix:BottomObjectType” substitutionGroup=“gml:AbstractFeature”/>

<xs:complexType name=“BottomObjectType”>

xs:complexContent

<xs:extension base=“gml:AbstractFeatureType”>

xs:sequence

<xs:element name=“bottomObjectData” type=“xs:integer”/>

<xs:element name=“impactScour” type=“myPrefix:ImpactScourPropertyType” minOccurs=“0” maxOccurs=“unbounded”/>

</xs:sequence>

</xs:extension>

</xs:complexContent>

</xs:complexType>

<xs:complexType name=“BottomObjectPropertyType”>

<xs:sequence minOccurs=“0”>

<xs:element ref=“myPrefix:BottomObject”/>

</xs:sequence>

<xs:attributeGroup ref=“gml:AssociationAttributeGroup”/>

<xs:attributeGroup ref=“gml:OwnershipAttributeGroup”/>

</xs:complexType>

<xs:element name=“ImpactScour” type=“myPrefix:ImpactScourType” substitutionGroup=“gml:AbstractFeature”/>

<xs:complexType name=“ImpactScourType”>

xs:complexContent

<xs:extension base=“gml:AbstractFeatureType”>

xs:sequence

<xs:element name=“impactScourData” type=“xs:integer”/>

<xs:element name=“fkBottomObject” type=“xs:integer”/>

</xs:sequence>

</xs:extension>

</xs:complexContent>

</xs:complexType>

<xs:complexType name=“ImpactScourPropertyType”>

<xs:sequence minOccurs=“0”>

<xs:element ref=“myPrefix:ImpactScour”/>

</xs:sequence>

<xs:attributeGroup ref=“gml:AssociationAttributeGroup”/>

<xs:attributeGroup ref=“gml:OwnershipAttributeGroup”/>

</xs:complexType>

((3)) === End GML Application Schema ===

((4)) === Begin Impact Scour Mapping ===

myDataStore

impact_scour

myPrefix:ImpactScour

myPrefix:ImpactScour

pk_id

myPrefix:impactScourData

impact_scour_data

gml:name

fk_bottom_object

((4)) === End Impact Scour Mapping ===

((5)) === Begin Bottom Object Mapping ===

myDataStore

bottom_object

myPrefix:BottomObject

myPrefix:BottomObject

pk_id

myPrefix:bottomObjectData

bottom_object_data

myPrefix:impactScour

pk_id

myPrefix:ImpactScour

gml:name

true

((5)) === End Bottom Object Mapping ===

((6)) === Begin WFS Response ===

wfs:member

<myPrefix:BottomObject gml:id=“0”>

myPrefix:bottomObjectData0</myPrefix:bottomObjectData>

<myPrefix:impactScour href=“#0”/>

</myPrefix:BottomObject>

</wfs:member>

wfs:member

<myPrefix:BottomObject gml:id=“1”>

myPrefix:bottomObjectData24</myPrefix:bottomObjectData>

<myPrefix:impactScour href=“#1”/>

</myPrefix:BottomObject>

</wfs:member>

wfs:member

<myPrefix:BottomObject gml:id=“2”>

myPrefix:bottomObjectData26</myPrefix:bottomObjectData>

<myPrefix:impactScour href=“#2”/>

myPrefix:impactScour

<myPrefix:ImpactScour gml:id=“3”>

gml:name2</gml:name>

myPrefix:impactScourData26</myPrefix:impactScourData>

</myPrefix:ImpactScour>

</myPrefix:impactScour>

myPrefix:impactScour

<myPrefix:ImpactScour gml:id=“4”>

gml:name2</gml:name>

myPrefix:impactScourData1</myPrefix:impactScourData>

</myPrefix:ImpactScour>

</myPrefix:impactScour>

</myPrefix:BottomObject>

</wfs:member>

<wfs:member href=“#3”>

myPrefix:BottomObject/

</wfs:member>

((6)) === End WFS Response ===