Hi, 
 
is it possible to define mapping file for app-schema so that the result is "flat" xml? 
 
like:
<store gml:id = 1>
    <storeName>ABC</storeName>
    <streetAddress>First address of store</streetAddress>
    <location>First location of store</location>
    <streetAddress>Second address of store</streetAddress>
    <location>Second location of store</location>
    ...
</store>
 
Let say that I have two tables:
 
Store: StoreId - StoreName
Address: StoreId - StreetAddress - Location
 
and i define schemas:
 
<xsd:element name="store" type="StoreType" substitutionGroup="gml:AbstractFeature" />
<xsd:complexType name="StoreType">
<xsd:complexContent>
<xsd:extension base="gml:AbstractFeatureType">
<xsd:sequence>
    <xsd:element name="storeName" type="xsd:string"/>
    <xsd:element name="streetAddress" type="xsd:string"/>
    <xsd:element name="location" type="gml:GeometryPropertyType"/>
    
    
<xsd:element name="address" type="AddressType" />
<xsd:complexType name="AddressType">
<xsd:complexContent>
<xsd:extension base="gml:AbstractFeatureType">
<xsd:sequence>
    <xsd:element name="streetAddress" type="xsd:string"/>
    <xsd:element name="location" type="gml:GeometryPropertyType"/>    
    
    
Mapping file for address:
    
<FeatureTypeMapping>
<sourceDataStore>datastore</sourceDataStore>
<sourceType>mv_dataStore_Address</sourceType>
<targetElement>address</targetElement>
<attributeMappings>
            
    <AttributeMapping>
        <targetAttribute>streetAddress</targetAttribute>
        <sourceExpression>
            <OCQL>StreetAddress</OCQL>
        </sourceExpression>
        <encodeIfEmpty>true</encodeIfEmpty>
    </AttributeMapping>
    
    <AttributeMapping>
        <targetAttribute>location</targetAttribute>
        <sourceExpression>
            <OCQL>Location</OCQL>
        </sourceExpression>
         <encodeIfEmpty>true</encodeIfEmpty>
    </AttributeMapping>
    
    <!-- FEATURE_LINK mapping -->
    <AttributeMapping>
        <targetAttribute>FEATURE_LINK</targetAttribute>
        <sourceExpression>
            <OCQL>StoreId</OCQL>
        </sourceExpression>
    </AttributeMapping>
    
    
But i have no idea how to define mapping file for store:
 
<FeatureTypeMapping>
<sourceDataStore>datastore</sourceDataStore>
<sourceType>mv_dataStore_Store</sourceType>
<targetElement>store</targetElement>
<isDenormalised>false</isDenormalised>
<attributeMappings>
    <!-- id -->
    <AttributeMapping>
        <targetAttribute>ptv:store</targetAttribute>
        <idExpression><OCQL>StoreId</OCQL></idExpression>
    </AttributeMapping>
    
    <AttributeMapping>
    <targetAttribute>storeName</targetAttribute>
    <sourceExpression>
        <OCQL>StoreName</OCQL>
    </sourceExpression>
    <encodeIfEmpty>true</encodeIfEmpty>
    </AttributeMapping>
        
    -------> but how to map this? is it either possible to do it in this way?

    <AttributeMapping>
    <targetAttribute>streetAddress</targetAttribute>
    <sourceExpression>
        <OCQL>StoreId</OCQL>
        <linkElement>address/streetAddress</linkElement>
        <linkField>FEATURE_LINK</linkField>
    </sourceExpression>
    <encodeIfEmpty>true</encodeIfEmpty>
    <isMultiple>true</isMultiple>
    </AttributeMapping>
    
    
Thanks a lot for any advice, 
Tom
_______________________________________________
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