<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns3:AppSchemaDataAccess xmlns:ns2="http://www.opengis.net/ogc" xmlns:ns3="http://www.geotools.org/app-schema">
    <namespaces>
        <Namespace>
            <prefix>st</prefix>
            <uri>http://www.stations.org/1.0</uri>
        </Namespace>
        <Namespace>
            <prefix>gml</prefix>
            <uri>http://www.opengis.net/gml/3.2</uri>
        </Namespace>
    </namespaces>
    <sourceDataStores>
        <DataStore>
            <id>dataStore</id>
            <parameters>
                ***
            </parameters>
        </DataStore>
    </sourceDataStores>
    <targetTypes>
        <FeatureType>
            <schemaUri>meteo.xsd</schemaUri>
        </FeatureType>
    </targetTypes>
    <typeMappings>
        <FeatureTypeMapping>
            <mappingName>multi_stations_postgres</mappingName>
            <sourceDataStore>dataStore</sourceDataStore>
            <sourceType>meteo_stations</sourceType>
            <targetElement>st:Station</targetElement>
            <attributeMappings>
                <AttributeMapping>
                    <targetAttribute>st:Station</targetAttribute>
                    <idExpression>
                        <OCQL>id</OCQL>
                    </idExpression>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>st:stationName</targetAttribute>
                    <sourceExpression>
                        <OCQL>common_name</OCQL>
                    </sourceExpression>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>st:position</targetAttribute>
                    <sourceExpression>
                        <OCQL>position</OCQL>
                    </sourceExpression>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>st:tag</targetAttribute>
                    <jdbcMultipleValue>
                        <sourceColumn>id</sourceColumn>
                        <targetTable>meteo_stations_tags</targetTable>
                        <targetColumn>station_id</targetColumn>
                        <targetValue>tag</targetValue>
                    </jdbcMultipleValue>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>st:comment</targetAttribute>
                    <jdbcMultipleValue>
                        <sourceColumn>id</sourceColumn>
                        <targetTable>meteo_stations_comments</targetTable>
                        <targetColumn>station_id</targetColumn>
                        <targetValue>comment</targetValue>
                    </jdbcMultipleValue>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>st:observation</targetAttribute>
                    <sourceExpression>
                        <OCQL>id</OCQL>
                        <linkElement>multi_observations_postgres</linkElement>
                        <linkField>FEATURE_LINK[1]</linkField>
                    </sourceExpression>
                    <isMultiple>true</isMultiple>
                </AttributeMapping>
            </attributeMappings>
        </FeatureTypeMapping>
        <FeatureTypeMapping>
            <mappingName>multi_observations_postgres</mappingName>
            <sourceDataStore>dataStore</sourceDataStore>
            <sourceType>meteo_observations</sourceType>
            <targetElement>st:Observation</targetElement>
            <attributeMappings>
                <AttributeMapping>
                    <targetAttribute>st:Observation</targetAttribute>
                    <idExpression>
                        <OCQL>id</OCQL>
                    </idExpression>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>st:value</targetAttribute>
                    <sourceExpression>
                        <OCQL>value</OCQL>
                    </sourceExpression>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>st:tag</targetAttribute>
                    <jdbcMultipleValue>
                        <sourceColumn>id</sourceColumn>
                        <targetTable>meteo_observations_tags</targetTable>
                        <targetColumn>observation_id</targetColumn>
                        <targetValue>tag</targetValue>
                    </jdbcMultipleValue>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>st:comment</targetAttribute>
                    <jdbcMultipleValue>
                        <sourceColumn>id</sourceColumn>
                        <targetTable>meteo_observations_comments</targetTable>
                        <targetColumn>observation_id</targetColumn>
                        <targetValue>comment</targetValue>
                    </jdbcMultipleValue>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>FEATURE_LINK[1]</targetAttribute>
                    <sourceExpression>
                        <OCQL>station_id</OCQL>
                    </sourceExpression>
                </AttributeMapping>
            </attributeMappings>
        </FeatureTypeMapping>
    </typeMappings>
</ns3:AppSchemaDataAccess>
