Hi Piotr

If you want to chain on GML reference types the best way is to follow what is 
described here



Re: [Geoserver-users] App Schema jdbcMultipleValue without targetValue - null 
error 
(mail-archive.com)<https://www.mail-archive.com/geoserver-users@lists.sourceforge.net/msg33199.html>

GeoServer / Re: [Geoserver-users] Multivalued properties in ClientProperty 
[SOLVED] 
(sourceforge.net)<https://sourceforge.net/p/geoserver/mailman/message/35255410/>

https://pastebin.com/PQVjUDz1

The start of the feature chain:


<AttributeMapping>
    <targetAttribute>er:sourceReference</targetAttribute>
    <encodeIfEmpty>true</encodeIfEmpty>
    <sourceExpression>
        <!--PK in soil table-->
        <OCQL>ENO</OCQL>
        <linkElement>_minocc_sourceref</linkElement>
        <linkField>FEATURE_LINK[11]</linkField>
    </sourceExpression>
    <isMultiple>true</isMultiple>

    <ClientProperty>
        <name>xlink:href</name>

        <value>SOURCEREF_HREF</value>

    </ClientProperty>
    <ClientProperty>
        <name>xlink:title</name>

        <value>SOURCEREF_TITLE</value>

    </ClientProperty>

</AttributeMapping>

And the targeted ‘feature’ to be chained.

<FeatureTypeMapping>
    <mappingName>_minocc_sourceref</mappingName>
    <sourceDataStore>datastore</sourceDataStore>
    <sourceType>OZMIN_ER_MINOCC_SOURCEREFS</sourceType>
    <targetElement>er:MineralOccurrence</targetElement>
    <attributeMappings>
        <encodeIfEmpty>true</encodeIfEmpty>

        <AttributeMapping>
            <targetAttribute>FEATURE_LINK[11]</targetAttribute>

            <sourceExpression><OCQL>ENO</OCQL></sourceExpression>
        </AttributeMapping>

        <AttributeMapping>
            <targetAttribute>er:sourceReference</targetAttribute>
        </AttributeMapping>

    </attributeMappings>
</FeatureTypeMapping>

Thanks

Michael


From: p0c...@o2.pl <p0c...@o2.pl>
Sent: Saturday, 27 November 2021 8:37 PM
To: geoserver-users@lists.sourceforge.net
Subject: [Geoserver-users] No top level element found in schemas: 
{http://www.opengis.net/gml/3.2}ReferenceType

Hi,

I'm trying to use app-schema to create complex feature for INSPIRE Geology 
theme. In most part it's working OK, but in one case I've got an error and I 
can't find any information whats wrong.

Minimal example in which it can be reproduced is having 3 joined tables:

geology_feature:
- id - serial
- shape - geometry
- name - text

geologic_event:
- id - serial
- name- text
- geologic_feature - FK to geologic_feature

event_process:
- event_process - text (uri)
- geologic_event - FK to geologic_event

There are 1:N relations between them.
I've created alignment in HALE Studio to application schema for Geology 4.0 
where I'm joinig this tables and mapping attributes. So far so good, exporting 
transformed data to GML 3.2 works OK.
Now I'm trying to export this configuration to GeoServer using app-schema 
plugin. On feature chaining step I'm setting target type for geology_event to 
GeologicEvent feature type, and event_process to eventProcess property of 
GeologicEvent. Then it's showing two workspaces:
- ge with GeologicEvent and MappedFeature features
- gml with ReferenceType feature

On import I've got error in GeoServer:

27 lis 09:28:14 WARN [feature.type] - No top level element found in schemas: 
{http://www.opengis.net/gml/3.2}ReferenceType<http://www.opengis.net/gml/3.2%7dReferenceType>
27 lis 09:28:14 WARN [complex.config] - Error creating app-schema data store 
for 'gml:ReferenceType', caused by: No top level element found in schemas: 
{http://www.opengis.net/gml/3.2}ReferenceType<http://www.opengis.net/gml/3.2%7dReferenceType>
27 lis 09:28:14 ERROR [geoserver.web] - Error retrieving layers for the 
specified store
java.lang.RuntimeException: Could not list layers for this store, an error 
occurred retrieving them: java.util.NoSuchElementException: No top level 
element found in schemas: 
{http://www.opengis.net/gml/3.2}ReferenceType<http://www.opengis.net/gml/3.2%7dReferenceType>

I'm not sure but I suspects that it's because eventProcess element is 
gml:ReferenceType which is not a feature type. But how can I join this tables 
in appschema mapping to ommit this problem and still got 1:N relation between 
event_process and geologic_event tables? I've tried to manualy edit mapping 
files in GeoServer but without success. I've also search for more information 
about this error (No top level element) but can't find anything helpfull. 
Tutorials are based on older version of geosciml schemas (2.0 I think) where 
eventProcess are CGI_TermValue data types and it's working fine.

I'm struggeling with this for days without success, so mayby someone have any 
idea what is wrong, how this can be fixed or where to find more information 
about this case.

Below are my mapping files:

GeologyCore.appschema

<?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>ge</prefix>
            <uri>http://inspire.ec.europa.eu/schemas/ge-core/4.0</uri>
        </Namespace>
        <Namespace>
            <prefix>gml</prefix>
            <uri>http://www.opengis.net/gml/3.2</uri>
        </Namespace>
        <Namespace>
            <prefix>xlink</prefix>
            <uri>http://www.w3.org/1999/xlink</uri>
        </Namespace>
        <Namespace>
            <prefix>xsi</prefix>
            <uri>http://www.w3.org/2001/XMLSchema-instance</uri>
        </Namespace>
    </namespaces>
    <includedTypes>
        <Include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xsi:type="xs:string">includedTypes.xml</Include>
    </includedTypes>
    <sourceDataStores>
        <DataStore>
            <id>dataStore</id>
            <parameters>
                <Parameter>
                    <name>host</name>
                    <value>localhost</value>
                </Parameter>
                <Parameter>
                    <name>port</name>
                    <value>5432</value>
                </Parameter>
                <Parameter>
                    <name>database</name>
                    <value>szkolenie2</value>
                </Parameter>
                <Parameter>
                    <name>schema</name>
                    <value>public</value>
                </Parameter>
                <Parameter>
                    <name>user</name>
                    <value>postgres</value>
                </Parameter>
                <Parameter>
                    <name>passwd</name>
                    <value>postgis</value>
                </Parameter>
                <Parameter>
                    <name>Expose primary keys</name>
                    <value>true</value>
                </Parameter>
                <Parameter>
                    <name>dbtype</name>
                    <value>postgis</value>
                </Parameter>
            </parameters>
        </DataStore>
    </sourceDataStores>
    <targetTypes>
        <FeatureType>
            <schemaUri>_schemas/GeologyCore.xsd</schemaUri>
        </FeatureType>
    </targetTypes>
    <typeMappings>
        <FeatureTypeMapping>
            <sourceDataStore>dataStore</sourceDataStore>
            <sourceType>geologic_feature</sourceType>
            <targetElement>ge:MappedFeature</targetElement>
            <attributeMappings>
                <AttributeMapping>
                    
<targetAttribute>ge:specification/ge:GeologicUnit/ge:geologicHistory</targetAttribute>
                    <sourceExpression>
                        <OCQL>id</OCQL>
                        <linkElement>ge:GeologicEvent</linkElement>
                        <linkField>FEATURE_LINK[1]</linkField>
                    </sourceExpression>
                    <isMultiple>true</isMultiple>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>ge:MappedFeature</targetAttribute>
                    <idExpression>
                        <OCQL>id</OCQL>
                    </idExpression>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>ge:shape</targetAttribute>
                    <sourceExpression>
                        <OCQL>shape</OCQL>
                    </sourceExpression>
                </AttributeMapping>
                <AttributeMapping>
                    
<targetAttribute>ge:specification/ge:GeologicUnit/ge:name</targetAttribute>
                    <sourceExpression>
                        <OCQL>name</OCQL>
                    </sourceExpression>
                    <ClientProperty>
                        <name>xsi:nil</name>
                        <value>if_then_else(isNull(name), 'true', 
Expression.NIL)</value>
                    </ClientProperty>
                </AttributeMapping>
            </attributeMappings>
        </FeatureTypeMapping>
        <FeatureTypeMapping>
            <sourceDataStore>dataStore</sourceDataStore>
            <sourceType>geologic_event</sourceType>
            <targetElement>ge:GeologicEvent</targetElement>
            <attributeMappings>
                <AttributeMapping>
                    <targetAttribute>FEATURE_LINK[1]</targetAttribute>
                    <sourceExpression>
                        <OCQL>geologic_feature</OCQL>
                    </sourceExpression>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>ge:eventProcess</targetAttribute>
                    <sourceExpression>
                        <OCQL>id</OCQL>
                        <linkElement>gml:ReferenceType</linkElement>
                        <linkField>FEATURE_LINK[1]</linkField>
                    </sourceExpression>
                    <isMultiple>true</isMultiple>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>ge:GeologicEvent</targetAttribute>
                    <idExpression>
                        <OCQL>id</OCQL>
                    </idExpression>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>ge:name</targetAttribute>
                    <sourceExpression>
                        <OCQL>name</OCQL>
                    </sourceExpression>
                    <ClientProperty>
                        <name>xsi:nil</name>
                        <value>if_then_else(isNull(name), 'true', 
Expression.NIL)</value>
                    </ClientProperty>
                </AttributeMapping>
            </attributeMappings>
        </FeatureTypeMapping>
    </typeMappings>
</ns3:AppSchemaDataAccess>


includedTypes.xml

<?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>ge</prefix>
            <uri>http://inspire.ec.europa.eu/schemas/ge-core/4.0</uri>
        </Namespace>
        <Namespace>
            <prefix>gml</prefix>
            <uri>http://www.opengis.net/gml/3.2</uri>
        </Namespace>
        <Namespace>
            <prefix>xlink</prefix>
            <uri>http://www.w3.org/1999/xlink</uri>
        </Namespace>
        <Namespace>
            <prefix>xsi</prefix>
            <uri>http://www.w3.org/2001/XMLSchema-instance</uri>
        </Namespace>
    </namespaces>
    <includedTypes/>
    <sourceDataStores>
        <DataStore>
            <id>dataStore</id>
            <parameters>
                <Parameter>
                    <name>host</name>
                    <value>localhost</value>
                </Parameter>
                <Parameter>
                    <name>port</name>
                    <value>5432</value>
                </Parameter>
                <Parameter>
                    <name>database</name>
                    <value>szkolenie2</value>
                </Parameter>
                <Parameter>
                    <name>schema</name>
                    <value>public</value>
                </Parameter>
                <Parameter>
                    <name>user</name>
                    <value>postgres</value>
                </Parameter>
                <Parameter>
                    <name>passwd</name>
                    <value>postgis</value>
                </Parameter>
                <Parameter>
                    <name>Expose primary keys</name>
                    <value>true</value>
                </Parameter>
                <Parameter>
                    <name>dbtype</name>
                    <value>postgis</value>
                </Parameter>
            </parameters>
        </DataStore>
    </sourceDataStores>
    <targetTypes>
        <FeatureType>
            <schemaUri>_schemas/GeologyCore.xsd</schemaUri>
        </FeatureType>
    </targetTypes>
    <typeMappings>
        <FeatureTypeMapping>
            <sourceDataStore>dataStore</sourceDataStore>
            <sourceType>event_process</sourceType>
            <targetElement>gml:ReferenceType</targetElement>
            <attributeMappings>
                <AttributeMapping>
                    <targetAttribute>FEATURE_LINK[1]</targetAttribute>
                    <sourceExpression>
                        <OCQL>geologic_event</OCQL>
                    </sourceExpression>
                </AttributeMapping>
                <AttributeMapping>
                    
<targetAttribute>ge:specification/ge:GeologicUnit/ge:geologicHistory/ge:GeologicEvent/ge:eventProcess</targetAttribute>
                    <ClientProperty>
                        <name>xlink:href</name>
                        <value>event_process</value>
                    </ClientProperty>
                </AttributeMapping>
            </attributeMappings>
        </FeatureTypeMapping>
    </typeMappings>
</ns3:AppSchemaDataAccess>


Thanks a lot for any clue
Piotr

Geoscience Australia Disclaimer: This e-mail (and files transmitted with it) is 
intended only for the person or entity to which it is addressed. If you are not 
the intended recipient, then you have received this e-mail by mistake and any 
use, dissemination, forwarding, printing or copying of this e-mail and its file 
attachments is prohibited. The security of emails transmitted cannot be 
guaranteed; by forwarding or replying to this email, you acknowledge and accept 
these risks.
_______________________________________________
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