I am still having some issues mapping feature types.  Now I have the parent
feature (with geometry) working fine, and I can get my child table to
produce a number of xml elements according to the correct number of
attributes in the child table, however the child (attribute) elements are
not being populated with data, nor ID's.

I have two objects:  Locality and Attribute, where Locality is the parent
and can contain 1:many Attributes.  These are represented in PostGIS tables
and linked on ID fields.  This works fine - and I can retrieve WFS features
from the Locality table.

I have declared the following Schema as complex.xsd (I have some other
elements also, but they are working fine...):

<xs:schema
        targetNamespace="http://sidelab";
        xmlns:sidelab="http://sidelab";
        xmlns:gml="http://www.opengis.net/gml";
        xmlns:xs="http://www.w3.org/2001/XMLSchema";
        elementFormDefault="qualified"
        attributeFormDefault="unqualified"
        version="1.0">

  <xs:import namespace="http://www.opengis.net/gml";
        schemaLocation="
http://schemas.opengis.net/gml/3.1.1/base/feature.xsd"; />

  <attribute name="id" type="ID" />

  <xs:element name="Attribute" type="sidelab:AttributeType" />
  <xs:complexType name="AttributeType">
    <xs:attribute ref="sidelab:id" />
    <xs:sequence>
      <xs:element name="type" type="xs:string" />
      <xs:element name="value" type="xs:string" />
      <xs:element name="description" type="xs:string" />
    </xs:sequence>
  </xs:complexType>

  <xs:element name="Locality" type="sidelab:LocalityType" />
  <xs:complexType name="LocalityType">
    <xs:complexContent>
      <xs:extension base="gml:AbstractFeatureType">
        <xs:sequence>
          <xs:element name="name" type="xs:string" />
          <xs:element name="state" type="xs:string" />
          <xs:element name="postcode" type="xs:string" />
          <xs:element name="referenceName" type="xs:string" />
          <xs:element name="the_geom" type="gml:PointPropertyType" />
          <xs:element ref="sidelab:Attribute" maxOccurs="unbounded" />
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>


In my Locality xml mapping I have the following:

    <AttributeMapping>
            <targetAttribute>Locality/sidelab:Attribute</targetAttribute>
            <sourceExpression>
              <OCQL>LocalityID</OCQL>
              <linkElement>sidelab:Attribute</linkElement>
              <linkField>FEATURE_LINK</linkField>
            </sourceExpression>
            <isMultiple>true</isMultiple>
          </AttributeMapping>


In my Attribute xml mapping I have the following:

    <FeatureTypeMapping>
        <sourceDataStore>datastore</sourceDataStore>
        <sourceType>attribute</sourceType>
        <targetElement>sidelab:Attribute</targetElement>
        <attributeMappings>
          <AttributeMapping>
            <targetAttribute>sidelab:Attribute</targetAttribute>
            <idExpression>
              <OCQL>getID()</OCQL>
            </idExpression>
          </AttributeMapping>
<!--
          <AttributeMapping>
            <targetAttribute>Attribute/sidelab:type</targetAttribute>
            <sourceExpression>
              <OCQL>'Type'</OCQL>
            </sourceExpression>
          </AttributeMapping>
-->
          ...

          <AttributeMapping>
            <targetAttribute>FEATURE_LINK</targetAttribute>
            <sourceExpression>
              <OCQL>LocalityID</OCQL>
            </sourceExpression>
          </AttributeMapping>



In the log I am getting the following entry, which would lead me to believe
I should be getting my ID populated at least.

08 Mar 15:09:23 TRACE [complex.filter] - ENTRY
FeatureImpl:Locality<LocalityType id=1>=[AttributeImpl:name<string>=Axedale,
AttributeImpl:state<string>=VIC,
AttributeImpl:referenceName<string>=MELBOURNE,
GeometryAttributeImpl:the_geom<PointPropertyType>=POINT (144.504133
-36.787917)] sidelab:Attribute [FeatureImpl:Attribute<AttributeType
id=161>=[AttributeImpl:FEATURE_LINK<string>=1]] null null


Furthermore - if I try to set the type element - I get the following:

<ows:ExceptionText>java.lang.RuntimeException: Error applying mapping with
targetAttribute sidelab:Attribute Error applying mapping with
targetAttribute sidelab:Attribute Error applying mapping with
targetAttribute sidelab:type sidelab:type is not a valid location path for
type http://sidelab:AttributeType. sidelab:type ns: http://sidelab,
AttributeType properties: null#FEATURE_LINK</ows:ExceptionText>


I feel like I'm so close now - and it's probably a factor of namespaces or
something very simple.

thanks for the ongoing (and rapid) support.
------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to