Hi, I'm trying to create a "app-schema" layer, but have some unclear issues. 

As a data source I'm using Postgre, where I have defined three tables:
"Service" ("Id" uuid, "Code" text);
"ServiceAddress" ("Id" uuid, "ServiceId" uuid, "streetAddress" text,
"Location" geometry(POINT, 4326));
"ServiceDescription" ("Id" uuid, "ServiceId" uuid, "languageCode" text,
"Description" text);

I have a data source "serviceDescription", mapping is defined:

<FeatureTypeMapping>
    <sourceDataStore>datastore</sourceDataStore>
    <sourceType>ServiceDescription</sourceType>
    <targetElement>lge:serviceDescription</targetElement>
    <isDenormalised>true</isDenormalised>
    <attributeMappings>
        <AttributeMapping>
            <targetAttribute>lge:serviceDescription</targetAttribute>
            <idExpression><OCQL>Id</OCQL></idExpression>
        </AttributeMapping>
        <AttributeMapping>
            <targetAttribute>lge:description</targetAttribute>
            <sourceExpression>
                <OCQL>Description</OCQL>
            </sourceExpression>
            <ClientProperty>
                <name>languageCode</name>
                <value>LanguageCode</value>
            </ClientProperty>
            <encodeIfEmpty>true</encodeIfEmpty>
        </AttributeMapping>
        <AttributeMapping>
            <targetAttribute>FEATURE_LINK</targetAttribute>
            <sourceExpression>
                <OCQL>ServiceId</OCQL>
            </sourceExpression>
        </AttributeMapping>
    </attributeMappings>
</FeatureTypeMapping>

Then i have data source "service", where is defined chaining to
"serviceDescription":

<FeatureTypeMapping>
    <sourceDataStore>datastore</sourceDataStore>
    <sourceType>viewService</sourceType>
    <targetElement>lge:service</targetElement>
    <isDenormalised>true</isDenormalised>
    <attributeMappings>
        <AttributeMapping>
            <targetAttribute>lge:service</targetAttribute>
            <idExpression><OCQL>ServiceId</OCQL></idExpression>
        </AttributeMapping>
        <AttributeMapping>
            <targetAttribute>lge:code</targetAttribute>
            <sourceExpression>
                <OCQL>Code</OCQL>
            </sourceExpression>
            <encodeIfEmpty>true</encodeIfEmpty>
        </AttributeMapping>
        <AttributeMapping>
            <targetAttribute>lge:address</targetAttribute>
            <sourceExpression>
                <OCQL>StreetAddress</OCQL>
            </sourceExpression>
            <encodeIfEmpty>true</encodeIfEmpty>
        </AttributeMapping>
        <AttributeMapping>
           
<targetAttribute>lge:descriptions/lge:description</targetAttribute>
            <sourceExpression> 
                <OCQL>ServiceId</OCQL>
                <linkElement>lge:serviceDescription</linkElement>
                <linkField>FEATURE_LINK</linkField>
            </sourceExpression>
            <isMultiple>true</isMultiple>
        </AttributeMapping>
        <AttributeMapping>
            <targetAttribute>lge:location4326</targetAttribute>
            <sourceExpression>
                <OCQL>Location4326</OCQL>
            </sourceExpression>
             <encodeIfEmpty>true</encodeIfEmpty>
        </AttributeMapping>
    </attributeMappings>
</FeatureTypeMapping>

Test call of GetFeature works fine, result is like:

<lge:service gml:id="3c5296ef-60a4-46bc-afcb-c8248ca522ea">
    <lge:code>service2</lge:code>
    <lge:address>s2 - street address</lge:address>
    <lge:descriptions>
        <lge:description>
            <lge:serviceDescription
gml:id="479d6a3d-1e9f-4eaf-bb44-ea08bb770998">
                <lge:description languageCode="cz">service 2 - description
in cz</lge:description>
            </lge:serviceDescription>
        </lge:description>
        <lge:description>
            <lge:serviceDescription
gml:id="dd914bb0-007e-4fea-a337-ff23d078d793">
                <lge:description languageCode="de">service 2 - description
in de</lge:description>
            </lge:serviceDescription>
        </lge:description>
        <lge:description>
            <lge:serviceDescription
gml:id="e6294093-b140-4d42-a800-6eda02b7db8a">
                <lge:description languageCode="en">service 2 - description
in en</lge:description>
            </lge:serviceDescription>
        </lge:description>
    </lge:descriptions>
    <lge:location4326>
        <gml:Point srsDimension="2"
srsName="http://www.opengis.net/gml/srs/epsg.xml#4326";>
            <gml:pos>50.0413 14.4275</gml:pos>
        </gml:Point>
    </lge:location4326>
</lge:service>
...

BUT .. Is it possible to simplify the result somehow, eg. to reduce element
<lge:description>, so nesting of description would be "easier":

<lge:descriptions>
    <lge:serviceDescription gml:id="479d6a3d-1e9f-4eaf-bb44-ea08bb770998">
        <lge:description languageCode="cz">service 2 - description in
cz</lge:description>
    </lge:serviceDescription>
    </lge:description>
    <lge:serviceDescription gml:id="dd914bb0-007e-4fea-a337-ff23d078d793">
        <lge:description languageCode="de">service 2 - description in
de</lge:description>
     </lge:serviceDescription>
...

Or even better (since glm:ids are not important for me, but i do understand
that it will not work without a linking field):

<lge:descriptions>
    <lge:description languageCode="cz">service 2 - description in
cz</lge:description>
    <lge:description languageCode="de">service 2 - description in
de</lge:description>
...

Another question is related to DescribeFeatureType. The request returns
just:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:lge="http://test/lge";
xmlns:ptv="http://palvelutietovaranto.suomi.fi/ptv";
elementFormDefault="qualified" targetNamespace="http://test/lge";>
    <xsd:include
schemaLocation="file:/D:/geoServer/2.15.2/data_dir/workspaces/lge/xsd/schema.xsd"/>
</xsd:schema>

I understand that it is a valid xsd file, but it is possible to include some
better description of elements?

I found some Schema customization approach, but I do not know if it is
possible to use it for app-schema.
When I add the schema.xsd file to layer folder, the DescribeFeatureType
returns better "explanation" of type, but there is used some substitution,
and gml mapping does not work correctly:

DescribeFeatureType header:

<xs:schema 
    xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
    xmlns:Q1="http://www.opengis.net/gml";   <--------------- WHY Q1, not gml
?? 
    xmlns:lge="http://test/lge"; 
    elementFormDefault="qualified" 
    targetNamespace="http://test/lge";>  
    
GetFeature has problem with geometry type, the element is empty:

<lge:service Q1:id="3c5296ef-60a4-46bc-afcb-c8248ca522ea">
<--------------------- Q1 instead of gml namespace ??
    <lge:code>service2</lge:code>
    <lge:address>s2 - street address</lge:address>
    ....
    <lge:location4326/> <--------------------------- this element is empty
</lge:service>


Since I have no real experiences with GeoServer and app-schema I really
appreciate each advice, how to work with it.

I'm trying to upload all needed files, so i hope it will work.
lge.zip <http://osgeo-org.1560.x6.nabble.com/file/t385531/lge.zip>  

Thanks a lot, 
Lange 



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html


_______________________________________________
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

Reply via email to