Hi

I'm following the example mapping file here to map a simple attribute field 
from another table multiple times:

https://github.com/geoserver/geoserver/blob/master/src/extension/app-schema/app-schema-test/src/test/resources/test-data/SimpleAttributeFeatureChainTest.xml

This is the mapping file:

<typeMappings>
    <FeatureTypeMapping>
        <sourceDataStore>datastore</sourceDataStore>
        <sourceType>MV_ER_MINERALOCCURRENCE</sourceType>
        <targetElement>er:MineralOccurrence</targetElement>

        <attributeMappings>
            <AttributeMapping>
                <targetAttribute>er:MineralOccurrence</targetAttribute>
                <idExpression>
                    <OCQL>GML_ID</OCQL>
                </idExpression>
            </AttributeMapping>
            <AttributeMapping>
                <targetAttribute>gml:identifier</targetAttribute>
                <sourceExpression>
                    <OCQL>IDENTIFIER</OCQL>
                </sourceExpression>
                <ClientProperty>
                    <name>codeSpace</name>
                    <value>IDENTIFIER_CODESPACE</value>
                </ClientProperty>
            </AttributeMapping>
            <AttributeMapping>
                <targetAttribute>gml:name</targetAttribute>
                <sourceExpression>
                    <OCQL>NAME</OCQL>
                </sourceExpression>
            </AttributeMapping>

            <AttributeMapping>
                <targetAttribute>er:sourceReference</targetAttribute>
                <sourceExpression>
                    <OCQL>ENO</OCQL>
                    <linkElement>SOURCEREFERENCE</linkElement>
                    <linkField>FEATURE_LINK[2]</linkField>
                </sourceExpression>
            </AttributeMapping>

</attributeMappings>
</FeatureTypeMapping>
<FeatureTypeMapping>
    <mappingName>SOURCEREFERENCE</mappingName>
    <sourceDataStore>datastore</sourceDataStore>
    <sourceType>MV_ER_SOURCEREFERENCE</sourceType>
    <targetElement>er:sourceReference</targetElement>
    <attributeMappings>

        <AttributeMapping>
            <targetAttribute>er:sourceReference</targetAttribute>
            <ClientProperty>
                <name>xlink:href</name>
                <value>URI</value>
            </ClientProperty>

            <ClientProperty>
                <name>xlink:title</name>
                <value>TITLE</value>
            </ClientProperty>
        </AttributeMapping>
        <AttributeMapping>
            <targetAttribute>FEATURE_LINK[2]</targetAttribute>
            <sourceExpression>
                <OCQL>ENO</OCQL>
            </sourceExpression>
        </AttributeMapping>
    </attributeMappings>
</FeatureTypeMapping>


The sourceReference attribute is defined in 
http://schemas.earthresourceml.org/2.0/mineralOccurrence.xsd as:

<element maxOccurs="unbounded" name="sourceReference" nillable="true">
            <annotation>
              <appinfo>
                <targetElement 
xmlns="http://www.opengis.net/gml/3.2";>gmd2:CI_Citation</targetElement>
              </appinfo>
            </annotation>
            <complexType>
              <complexContent>
                <extension base="gml:AbstractMetadataPropertyType">
                  <sequence/>
                  <attributeGroup ref="gml:AssociationAttributeGroup"/>
                </extension>
              </complexContent>
            </complexType>
</element>

But I get this error:

Error occurred getting featuresjava.util.NoSuchElementException: No top level 
element found in schemas: 
{http://xmlns.earthresourceml.org/EarthResource/2.0}sourceReferenceNo top level 
element found in schemas: 
{http://xmlns.earthresourceml.org/EarthResource/2.0}sourceReference

I've seen this error before, when trying to map gml:metadataProperty, which I 
managed to get around using the targetAttributeNode, eg:


<mappingName>METADATA</mappingName>
<sourceDataStore>datastore</sourceDataStore>
<sourceType>MV_CIT_CI_CITATION</sourceType>
<targetElement>gml:metaDataProperty</targetElement>
<attributeMappings>

    <AttributeMapping>
    <targetAttribute>gml:metaDataProperty/gml:GenericMetaData</targetAttribute>
    <targetAttributeNode>mrl:LI_Source_PropertyType</targetAttributeNode>
    </AttributeMapping>


But in the case of er:soruceReference, there is no node to map to. It's a 
reference intended to have xlink:href and xlink:title attributes. Is there a 
solution here?

Thanks


Michael Sexton


Geoscience Australia Disclaimer: This e-mail (and files transmitted with it) is 
intended only for the person or entity to which it is addressed. If you are not 
the intended recipient, then you have received this e-mail by mistake and any 
use, dissemination, forwarding, printing or copying of this e-mail and its file 
attachments is prohibited. The security of emails transmitted cannot be 
guaranteed; by forwarding or replying to this email, you acknowledge and accept 
these risks.
-------------------------------------------------------------------------------------------------------------------------

_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to