Hi everyone:

First of all, I must apologize for my english.

I've been several days trying to fetch some data (WFS getFeature) from a
database table that references a second table.
The first table is STOP which has some properties (code, name,
description...) and among those properties, there is one (PROVIDER_ID) that
references another table called PROVIDER: a PROVIDER has many STOPs and one
STOP belongs to only one PROVIDER.

What I'm trying to do is to fetch STOP's data and the PROVIDER's data for
each STOP.

These are the files I have created for this sample:

* datastore.xml contains:

<dataStore>
        <id>transitstop_datastore</id>
        <name>transitstop_datastore</name>
        <enabled>true</enabled>
        <workspace>
                <id>WorkspaceInfoImpl-7093984a:13a7476a0f3:-8000</id>
        </workspace>
        <connectionParameters>
                <entry key="namespace">http://telvent.com/cocities</entry>
                <entry key="dbtype">app-schema</entry>
                <entry
key="url">file:workspaces/cocities/transitstop/transitstopMapping.xml</entry>
        </connectionParameters>
</dataStore>

*  TransitStop.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://telvent.com/cocities";
xmlns:cocities="http://telvent.com/cocities";
    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"; />

    <xs:element name="TransitStop" type="cocities:TransitStopType" />
    <xs:complexType name="TransitStopType">
        <xs:complexContent>
            <xs:extension base="gml:AbstractFeatureType">
                <xs:sequence>
                    <xs:element name="code" type="xs:string" />
                    <xs:element name="name" type="xs:string" />
                    <xs:element name="long_name" type="xs:string" />
                    <xs:element name="bus_stop" type="gml:PointPropertyType" />
                    <xs:element ref="cocities:provider" />
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <xs:element name="provider" type="cocities:ProviderType" />
    <xs:complexType name="ProviderType">
       <xs:complexContent>
            <xs:extension base="gml:AbstractFeatureType">
                <xs:sequence>
                                        <xs:element name="name" 
type="xs:string" maxOccurs="unbounded" />
                                        <xs:element name="id" type="xs:string" 
maxOccurs="unbounded" />
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
</xs:schema>

* transitstopMapping.xml contains:

<?xml version="1.0" encoding="UTF-8"?>
<as:AppSchemaDataAccess xmlns:as="http://www.geotools.org/app-schema";
    xmlns:ogc="http://www.opengis.net/ogc";
xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://www.geotools.org/app-schema
AppSchemaDataAccess.xsd">
    <namespaces>
        <Namespace>
                        ...
        </Namespace>
    </namespaces>
        <sourceDataStores>
                <DataStore>
                        <id>cocitiesds</id>
                        ...
                </DataStore>
    </sourceDataStores>
    <targetTypes>
        <FeatureType>
            <schemaUri>TransitStop.xsd</schemaUri>
        </FeatureType>
    </targetTypes>
    <typeMappings>
        <FeatureTypeMapping>
            <sourceDataStore>cocitiesds</sourceDataStore>
            <sourceType>stop</sourceType>
            <targetElement>cocities:TransitStop</targetElement>
            <attributeMappings>
                                <AttributeMapping>
                                        <targetAttribute>
                                                cocities:TransitStop
                                        </targetAttribute>
                                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>cocities:TransitStop</targetAttribute>
                    <idExpression>
                        <OCQL>getId()</OCQL>
                    </idExpression>
                </AttributeMapping>
                                ...
                                ...                        
                                ...
                                <AttributeMapping>
                    <targetAttribute>cocities:provider</targetAttribute>
                    <sourceExpression>
                        <OCQL>provider_id</OCQL>
                    </sourceExpression>
                </AttributeMapping>
            </attributeMappings>
        </FeatureTypeMapping>
                <FeatureTypeMapping>
                        <targetElement>cocities:provider</targetElement>
            <sourceDataStore>cocitiesds</sourceDataStore>
            <sourceType>provider</sourceType>
            <attributeMappings>
                                <AttributeMapping>
                    <targetAttribute>
                        cocities:provider
                    </targetAttribute>
                    <idExpression>
                        <OCQL>getId()</OCQL>
                    </idExpression>
                </AttributeMapping>
                                 <AttributeMapping>
                    <targetAttribute>cocities:name</targetAttribute>
                    <sourceExpression>
                        <OCQL>name</OCQL>
                    </sourceExpression>
                </AttributeMapping>
            </attributeMappings>
        </FeatureTypeMapping>
    </typeMappings>
</as:AppSchemaDataAccess>

I've been testing thousands of different configurations and I'm not capable
of making it work ¿Does anyone know about a working example that makes the
same thing I'm looking for? 

Thank you very much in advance



--
View this message in context: 
http://osgeo-org.1560.n6.nabble.com/GEOServer-app-schema-Feature-Chaining-tp5010210.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to