Hello,
For what I know about App-Schema the only way to achieve your target output
might be to give a try to the *jdbcMultipleValue *directive in case the
underlying store you are using is a JDBC one. In that case the
streetAddress type could be defined as something like this in the xsd,
<element minOccurs="0" name="streetAddress" type="AddressType"
maxOccurs="unbounded"/>
<complexType name="StreetAddressType">
<simpleContent>
<extension base="string"/>
</extension>
</simpleContent>
</complexType>
and in the mappings you would have to replace the currently defined
attribute mapping with:
<AttributeMapping>
<targetAttribute>streetAddress</targetAttribute>
<jdbcMultipleValue>
<sourceColumn>*joining column*</sourceColumn>
<targetTable>*tableName*</targetTable>
<targetColumn>*joined column from the target table*</targetColumn>
<targetValue>*columnName*</targetValue>
</jdbcMultipleValue>
</AttributeMapping>
Documentation about this functionality is available here
<https://docs.geoserver.org/latest/en/user/data/app-schema/mapping-file.html#sql-based-data-stores>
.
Best regards,
Marco Volpini
Il giorno mar 11 mag 2021 alle ore 12:30 abc def <[email protected]> ha
scritto:
> 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
>
>
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
_______________________________________________
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users