[Geoserver-users] Complex feature chaining.

Hello,

I have a question regarding feature chaining of complex features. I have a
complex feature X which I want to chain with a non feature Z. The error
that I'm getting is the following:

Error creating data store, check the parameters.
Error message: Duplicate mappingName or targetElement across
FeatureTypeMapping instances detected. They have to be unique, or app-schema
doesn't know which one to get. Please check your mapping file(s) with
mappingName or targetElement of:

I tried some possible solutions that I found on the internet but nothing
seems to work, so then I started to wonder if the schema is wrong?
I'm providing examples of mapping files for X and Z, and their schema.
Hopefully someone, who worked a lot more with feature chaining, will be able
to find a solution to my problem.

Regards
*
Schema for mapping files:*
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema&quot;
xmlns:prefix="www.default.com" xmlns:gml="http://www.opengis.net/gml/3.2&quot;
elementFormDefault="qualified" targetNamespace="www.default.com">

  <import namespace="http://www.opengis.net/gml/3.2&quot;
schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd&quot;/&gt;

  <element name="X" type="prefix:XType"/>

  <complexType name="XType">
    <complexContent>
      <extension base="gml:AbstractFeatureType">
        <sequence>
          <element name="id" type="string" minOccurs="0"/>
          <element name="name" type="string" minOccurs="0"/>
          <element name="ZId" type="string" minOccurs="0"/>
          <element name="Y" minOccurs="0">
            <complexType>
              <sequence>
                <element ref="prefix:Z" />
              </sequence>
            </complexType>
          </element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <element name="Z" type="prefix:ZType"/>
  <complexType name="ZType">
    <complexContent>
      <extension base="gml:AbstractFeatureType">
        <sequence>
          <element name="id" type="string" minOccurs="0"/>
          <element name="name" type="string" minOccurs="0"/>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

</schema>

*Mapping file for X:*
<?xml version="1.0" encoding="UTF-8"?>
<as:AppSchemaDataAccess xmlns:as="http://www.geotools.org/app-schema&quot;
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation="http://www.geotools.org/app-schema
AppSchemaDataAccess.xsd">
  <namespaces>
    <Namespace>
      <prefix>prefix</prefix>
      <uri>www.default.com</uri>
    </Namespace>
  </namespaces>
  <includedTypes>
    <Include>Zmapping.xml</Include>
  </includedTypes>
  <sourceDataStores>
    <DataStore>
      <id>datastore</id>
      <parameters>
        <Parameter>
          <name>dbtype</name>
          <value>postgisng</value>
        </Parameter>
        ...
      </parameters>
    </DataStore>
  </sourceDataStores>
  <targetTypes>
    <FeatureType>
      <schemaUri>schema.xsd</schemaUri>
    </FeatureType>
  </targetTypes>
  <typeMappings>
    <FeatureTypeMapping>
      <sourceDataStore>datastore</sourceDataStore>
      <sourceType>Table_X</sourceType>
      <targetElement>prefix:X</targetElement>
      <attributeMappings>
        <AttributeMapping>
          <targetAttribute>
                        prefix:name
          </targetAttribute>
          <sourceExpression>
            <OCQL>name</OCQL>
          </sourceExpression>
        </AttributeMapping>
        <AttributeMapping>
          <targetAttribute>prefix:Y</targetAttribute>
          <sourceExpression>
            <OCQL>zid</OCQL>
            <linkElement>prefix:Z</linkElement>
            <linkField>FEATURE_LINK</linkField>
          </sourceExpression>
        </AttributeMapping>
      </attributeMappings>
    </FeatureTypeMapping>
  </typeMappings>
</as:AppSchemaDataAccess>

*Mapping file for Z:*
<?xml version="1.0" encoding="UTF-8"?>
<as:AppSchemaDataAccess xmlns:as="http://www.geotools.org/app-schema&quot;
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation="http://www.geotools.org/app-schema
AppSchemaDataAccess.xsd">
  <namespaces>
    <Namespace>
      <prefix>prefix</prefix>
      <uri>www.default.com</uri>
    </Namespace>
  </namespaces>
  <sourceDataStores>
    <DataStore>
      <id>datastore</id>
      <parameters>
        <Parameter>
          <name>dbtype</name>
          <value>postgisng</value>
        </Parameter>
        ...
      </parameters>
    </DataStore>
  </sourceDataStores>
  <targetTypes>
    <FeatureType>
      <schemaUri>schema.xsd</schemaUri>
    </FeatureType>
  </targetTypes>
  <typeMappings>
    <FeatureTypeMapping>
      <sourceDataStore>datastore</sourceDataStore>
      <sourceType>Table_Z</sourceType>
      <targetElement>prefix:Z</targetElement>
      <attributeMappings>
        <AttributeMapping>
          <targetAttribute>
                        prefix:name
          </targetAttribute>
          <sourceExpression>
            <OCQL>name</OCQL>
          </sourceExpression>
        </AttributeMapping>
        <AttributeMapping>
          <targetAttribute>FEATURE_LINK</targetAttribute>
          <sourceExpression>
            <OCQL>id</OCQL>
          </sourceExpression>
        </AttributeMapping>
      </attributeMappings>
    </FeatureTypeMapping>
  </typeMappings>
</as:AppSchemaDataAccess>

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Complex-feature-chaining-tp5174246.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Hi Feniks,

Normally that means your trying to add the same feature type more than once to the data store.
I can't see anything wrong with your mappings on a first glance.
You didn't by any chance configure Z as a feature type?

Regards
Niels

On 21-11-14 16:03, Feniks wrote:

Hello,

I have a question regarding feature chaining of complex features. I have a
complex feature X which I want to chain with a non feature Z. The error
that I'm getting is the following:

Error creating data store, check the parameters.
Error message: Duplicate mappingName or targetElement across
FeatureTypeMapping instances detected. They have to be unique, or app-schema
doesn't know which one to get. Please check your mapping file(s) with
mappingName or targetElement of:

I tried some possible solutions that I found on the internet but nothing
seems to work, so then I started to wonder if the schema is wrong?
I'm providing examples of mapping files for X and Z, and their schema.
Hopefully someone, who worked a lot more with feature chaining, will be able
to find a solution to my problem.

Regards
*
Schema for mapping files:*
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema&quot;
xmlns:prefix="www.default.com" xmlns:gml="http://www.opengis.net/gml/3.2&quot;
elementFormDefault="qualified" targetNamespace="www.default.com">

  <import namespace="http://www.opengis.net/gml/3.2&quot;
schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd&quot;/&gt;

  <element name="X" type="prefix:XType"/>

  <complexType name="XType">
    <complexContent>
      <extension base="gml:AbstractFeatureType">
        <sequence>
          <element name="id" type="string" minOccurs="0"/>
          <element name="name" type="string" minOccurs="0"/>
          <element name="ZId" type="string" minOccurs="0"/>
          <element name="Y" minOccurs="0">
            <complexType>
              <sequence>
                <element ref="prefix:Z" />
              </sequence>
            </complexType>
          </element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <element name="Z" type="prefix:ZType"/>
  <complexType name="ZType">
    <complexContent>
      <extension base="gml:AbstractFeatureType">
        <sequence>
          <element name="id" type="string" minOccurs="0"/>
          <element name="name" type="string" minOccurs="0"/>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

</schema>

*Mapping file for X:*
<?xml version="1.0" encoding="UTF-8"?>
<as:AppSchemaDataAccess xmlns:as="http://www.geotools.org/app-schema&quot;
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation="http://www.geotools.org/app-schema
AppSchemaDataAccess.xsd">
  <namespaces>
    <Namespace>
      <prefix>prefix</prefix>
      <uri>www.default.com</uri>
    </Namespace>
  </namespaces>
  <includedTypes>
    <Include>Zmapping.xml</Include>
  </includedTypes>
  <sourceDataStores>
    <DataStore>
      <id>datastore</id>
      <parameters>
        <Parameter>
          <name>dbtype</name>
          <value>postgisng</value>
        </Parameter>
        ...
      </parameters>
    </DataStore>
  </sourceDataStores>
  <targetTypes>
    <FeatureType>
      <schemaUri>schema.xsd</schemaUri>
    </FeatureType>
  </targetTypes>
  <typeMappings>
    <FeatureTypeMapping>
      <sourceDataStore>datastore</sourceDataStore>
      <sourceType>Table_X</sourceType>
      <targetElement>prefix:X</targetElement>
      <attributeMappings>
        <AttributeMapping>
          <targetAttribute>
                         prefix:name
          </targetAttribute>
          <sourceExpression>
            <OCQL>name</OCQL>
          </sourceExpression>
        </AttributeMapping>
        <AttributeMapping>
          <targetAttribute>prefix:Y</targetAttribute>
          <sourceExpression>
            <OCQL>zid</OCQL>
            <linkElement>prefix:Z</linkElement>
            <linkField>FEATURE_LINK</linkField>
          </sourceExpression>
        </AttributeMapping>
      </attributeMappings>
    </FeatureTypeMapping>
  </typeMappings>
</as:AppSchemaDataAccess>

*Mapping file for Z:*
<?xml version="1.0" encoding="UTF-8"?>
<as:AppSchemaDataAccess xmlns:as="http://www.geotools.org/app-schema&quot;
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation="http://www.geotools.org/app-schema
AppSchemaDataAccess.xsd">
  <namespaces>
    <Namespace>
      <prefix>prefix</prefix>
      <uri>www.default.com</uri>
    </Namespace>
  </namespaces>
  <sourceDataStores>
    <DataStore>
      <id>datastore</id>
      <parameters>
        <Parameter>
          <name>dbtype</name>
          <value>postgisng</value>
        </Parameter>
        ...
      </parameters>
    </DataStore>
  </sourceDataStores>
  <targetTypes>
    <FeatureType>
      <schemaUri>schema.xsd</schemaUri>
    </FeatureType>
  </targetTypes>
  <typeMappings>
    <FeatureTypeMapping>
      <sourceDataStore>datastore</sourceDataStore>
      <sourceType>Table_Z</sourceType>
      <targetElement>prefix:Z</targetElement>
      <attributeMappings>
        <AttributeMapping>
          <targetAttribute>
                         prefix:name
          </targetAttribute>
          <sourceExpression>
            <OCQL>name</OCQL>
          </sourceExpression>
        </AttributeMapping>
        <AttributeMapping>
          <targetAttribute>FEATURE_LINK</targetAttribute>
          <sourceExpression>
            <OCQL>id</OCQL>
          </sourceExpression>
        </AttributeMapping>
      </attributeMappings>
    </FeatureTypeMapping>
  </typeMappings>
</as:AppSchemaDataAccess>

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Complex-feature-chaining-tp5174246.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Hey,
no I did not configure Z as a feature type ... as said it is meant as a
non-feature which then X feature type uses
(<includedTypes><Include>Zmapping.xml</Include></includedTypes>).

I get this error also if I try to link both of them as complex features (so
without includTypes).

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Complex-feature-chaining-tp5174246p5174404.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Interesting, if I try to create feature type through REST (firstly create the
datastore from datastore.xml and then featuretype with featuretype.xml) the
feature type works without problems. Could there maybe be a bug in the app
schema GUI (when creating new datastore with app schema)?

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Complex-feature-chaining-tp5174246p5174480.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

On 24-11-14 12:35, Feniks wrote:

Interesting, if I try to create feature type through REST (firstly create the
datastore from datastore.xml and then featuretype with featuretype.xml) the
feature type works without problems. Could there maybe be a bug in the app
schema GUI (when creating new datastore with app schema)?

It's possible. You could check the files created by the GUI and look at the difference. That would be useful information for anyone to fix the issue. Definitely report this.

I didn't see anything wrong in the files you posted, so it's hard to for me to find the issue without more information.

Regards
Niels

I am going to try PostGis instead of Oracle to load my spatial data into Geoserver as I read that its much quicker.

My question is I am best to put PostGis on the Geoserver server or install it on its own separate server and access remotely?

Mark Ismail
Principal IT Officer
This e-mail and any attachments are confidential. It may contain privileged information and is intended for the named recipient(s) only. It must not be distributed without consent. If you are not one of the intended recipients, please notify the sender immediately and do not disclose, distribute, or retain this email or any part of it and do not take any action based on it.

Unless expressly stated, opinions in this email are those of the individual sender, and not of Knowsley MBC. Legally binding obligations can only be created for, or be entered into on behalf of, Knowsley MBC by duly authorised officers or representatives.

Knowsley MBC excludes any liability whatsoever for any offence caused, any direct or consequential loss arising from the use, or reliance on, this e-mail or its contents. We believe but do not warrant that this e-mail and any attachments are virus free. You must therefore take full responsibility for virus checking and no responsibility is accepted for loss or damage arising from viruses or changes made to this message after it was sent. Knowsley MBC reserves the right to monitor and/or record all e-mail communications through its network in accordance with relevant legislation.

On Tue, Nov 25, 2014 at 12:39 PM, Ismail, Mark <mark.ismail@anonymised.com>
wrote:

I am going to try PostGis instead of Oracle to load my spatial data into
Geoserver as I read that its much quicker.

My question is I am best to put PostGis on the Geoserver server or install
it on its own separate server and access remotely?

If the machine can host both (memory wise) having them on the same box
might help increase performance as
you will have no network round-trips.
It's a good solution if all you have, today and in the short term, is a
single GeoServer machine that's powerful enough to
also host postgresql.

When you start scaling up with a cluster of GeoServer instances is normally
better to put the postgis on its own dedicated
machine instead.

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

-------------------------------------------------------

Problem is no files are created trough GUI, since the error occurs when you
have to specify the mapping file so nothing gets created ...

For the REST part, features work created this way ... but if you access the
datastore through GUI after it is created ... well ... you end up with the
same error of duplicates and you need to restart the Geoserver in order for
the features to work again. (kinda not a solution)

What I managed to do now is to link "Z" as a complex feature and not as a
non-feature, in this case everything seems to work fine (tried this before
but Geoserver remembered my attempt as a non-feature so even this way war
reporting duplicates until a restart) ... though the question still remains
why does it report "duplicate mapping..." with <includeType> ...

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Complex-feature-chaining-tp5174246p5174954.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Hi

Just wondering.... "*Duplicate mappingName* or targetElement"

You haven't provided a mappingname at all for your FeatureTypeMappings (this
is optional).
Could it be that the fact you use "includedType" you are actually having 2
FeatureTypeMapping definition both have the same "no-name-provided" mapping
name?

Have you tried to provide a mappingname for the FeatureTypeMappings?
Something like

<FeatureTypeMapping>
                        *<mappingName>mappedfeatureZ</mappingName>*
<sourceDataStore>datastore</sourceDataStore>
                        <sourceType>Table_Z</sourceType>

and

<FeatureTypeMapping>
                        *<mappingName>mappedfeatureX</mappingName>*
<sourceDataStore>datastore</sourceDataStore>
                        <sourceType>Table_X</sourceType>

Just a thought...

Luc Van Linden

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Complex-feature-chaining-tp5174246p5175058.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Tried the <mappingName> though it didn't work ... <targetElement> is still
needed right else it wouldn't know which element to use in the schema?

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Complex-feature-chaining-tp5174246p5175429.html
Sent from the GeoServer - User mailing list archive at Nabble.com.