[Geoserver-users] App-schema : problem using inherited attributes/properties

Dear list,

We have an issue having the app-schema work on inherited properties.
The context :

  • Geoserver 2-2 and WFS app-schema that works fine in other simple mappings.
  • xsd generated using Enterprise Architect + ShapeChange
  • the featureType we want to expose inherits from a class that is in another schema (xsd). Actually we specialize Inspire ManagementRestrictionOrRegulationZone class (see attached model pdf + xsd)

Below are the various tests I tried

1° / using the expected ‘am’ prefix → am:inspireId…
=> "java.lang.RuntimeException: Failed to get property: … Error applying mapping with targetAttribute am:inspireId/base:Identifier/base:localId am:inspireId is not a valid location path for type http://xml.uwwtd.oieau.fr/schemas/0.1:UWWTD_AgglomerationType … UWWTD_AgglomerationType properties:…,http://inspire.ec.europa.eu/schemas/am/3.0rc3#inspireId,…

2°/ the error above proposed a list of properties to use
using the namespace as advised in the error (http://inspire.ec.europa.eu/schemas/am/3.0rc3#inspireId) generates “Error occurred getting features
java.lang.StringIndexOutOfBoundsException: String index out of range: 0 String index out of range: 0

3°/ are the slashes of the url used in an xPath processing of some sort ? => tried to escape the slashes in the namespace
=> Error occurred getting features java.lang.IllegalArgumentException: location step http:\ has prefix http for which no namespace was set. (Check the Namespaces section in the config file)

4°/ mapping file states “Imports and includes at the schemas will be followed as long as they’re relative paths” => changed the original xsd to have relative paths => ko

5°/ declared multiple in
=> seems only the first one is used

6°/ no prefix in the : ko

What are we missing ?
I also attached a light version of the configuration file

Should we upgrade to V 2.3.4 or 2.4-beta ?

Many thanks
Sylvain

UWWTD_Agglomeration_Inspire_draft.pdf (20 KB)

UWWTD_Agglomeration.xml (3.37 KB)

UWWTD.xsd (17.9 KB)

ciao,

i wrote a custom ows service that nedds to add new layers (both raster and vector).
In my service bean i declared a contructor that take the Geoserver object as parameter so i can easily create and read workspace, namespace, styles etc...
In order to add new layer i've tried to read the rest and rest_config modules sources, but they are quite complicated.

I hope that somewhere there is a method like addCoverageLayer(File geotiff)... :slight_smile:

how can i do this?

thanks in advance
     Alessandro

Sylvain,

your "am" and "base" namespace prefix uris are both wrong.

You have:

<Namespace>
<prefix>am</prefix>
<uri>http://inspire.ec.europa.eu/schemas/am&lt;/uri&gt;
</Namespace>

However, the imported schema that defines in am:ManagementRestrictionOrRegulationZoneType (the parent type of the target) its targetNamespace:

http://inspire.ec.europa.eu/draft-schemas/am/3.0rc3/AreaManagementRestrictionRegulationZone.xsd

has

targetNamespace="http://inspire.ec.europa.eu/schemas/am/3.0rc3&quot;

You also have:

<Namespace>
<prefix>base</prefix>
<uri>urn:x-inspire:specification:gmlas:BaseTypes:3.2</uri>
</Namespace>

However, the imported schema that defines base:IdentifierType in its targetNamespace:

http://inspire.ec.europa.eu/draft-schemas/base/3.3rc3/BaseTypes.xsd

has

targetNamespace="http://inspire.ec.europa.eu/schemas/base/3.3rc3/&quot;

GeoServer app-schema thus correctly reports that the location path does not exist.

These look like poor choices for namespace URIs. Please check with INSPIRE as they might be an error, possibly caused by a shift to HTTP URI namespaces colliding with automatic search-and-replace for schema management. Note also the inconsistent trailing slash for "base". Namespace URIs should not vary with patch/bugfix (and an rc is like these). See OGC 06-135r11 "Policy Directives for Writing and PublishingOGC Standards: TC Decisions":
http://portal.opengeospatial.org/files/?artifact_id=40077
On p11: "13.3.2 Version designator [...] The bug fix version
designator SHALL NOT appear in the XML namespace."

Always use prefixes in a location path, not URIs; the presence of any colons will break xpath parsing.

Kind regards,
Ben.

On 30/07/13 21:04, Sylvain GRELLET wrote:

Dear list,

We have an issue having the app-schema work on inherited properties.
The context :
- Geoserver 2-2 and WFS app-schema that works fine in other simple mappings.
- xsd generated using Enterprise Architect + ShapeChange
- the featureType we want to expose inherits from a class that is_in
another schema_ (xsd). Actually we specialize Inspire
ManagementRestrictionOrRegulationZone class (see attached model pdf + xsd)

Below are the various tests I tried

1° / using the expected 'am' prefix -> am:inspireId...
=> "java.lang.RuntimeException: /Failed to get property: ... Error
applying mapping with targetAttribute
am:inspireId/base:Identifier/base:localId am:inspireId is not a valid
location path for type
http://xml.uwwtd.oieau.fr/schemas/0.1:UWWTD_AgglomerationType ...
UWWTD_AgglomerationType
properties:...,http://inspire.ec.europa.eu/schemas/am/3.0rc3#inspireId,...//
///
2°/ the error above proposed a list of properties to use
using the namespace as advised in the error
(http://inspire.ec.europa.eu/schemas/am/3.0rc3#inspireId) generates
"/Error occurred getting features //
//java.lang.StringIndexOutOfBoundsException: String index out of range:
0 String index out of range: 0/"

3°/ are the slashes of the url used in an xPath processing of some sort
? => tried to escape the slashes in the namespace
=> /Error occurred getting features java.lang.IllegalArgumentException:
location step http:\ has prefix http for which no namespace was set.
(Check the Namespaces section in the config file)/

4°/ mapping file states "/Imports and includes at the schemas will be
followed as long as they're relative paths/" => changed the original xsd
to have relative paths => ko

5°/ declared multiple <schemaUri> in <targetTypes><FeatureType><schemaUri>
=> seems only the first one is used

6°/ no prefix in the <targetAttribute> : ko

What are we missing ?
I also attached a light version of the configuration file

Should we upgrade to V 2.3.4 or 2.4-beta ?

Many thanks
Sylvain

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk

_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

Ben,

Thank you for your quick answer.
It works.

I forgot to adjust those namespaces the way I did for the xsds.

What surprises me is the way the internal app-schema processes work on that aspect.
Xsds produced are clean and contain all the information required to generate a clean XML.
Redefining the name space apart from the xsd seems a duplication to me thus a maintenance risk (but I don't know the source code).

Sylvain

Le 31/07/2013 04:04, Ben Caradoc-Davies a écrit :

Sylvain,

your "am" and "base" namespace prefix uris are both wrong.

You have:

<Namespace>
<prefix>am</prefix>
<uri>http://inspire.ec.europa.eu/schemas/am&lt;/uri&gt;
</Namespace>

However, the imported schema that defines in am:ManagementRestrictionOrRegulationZoneType (the parent type of the target) its targetNamespace:

http://inspire.ec.europa.eu/draft-schemas/am/3.0rc3/AreaManagementRestrictionRegulationZone.xsd

has

targetNamespace="http://inspire.ec.europa.eu/schemas/am/3.0rc3&quot;

You also have:

<Namespace>
<prefix>base</prefix>
<uri>urn:x-inspire:specification:gmlas:BaseTypes:3.2</uri>
</Namespace>

However, the imported schema that defines base:IdentifierType in its targetNamespace:

http://inspire.ec.europa.eu/draft-schemas/base/3.3rc3/BaseTypes.xsd

has

targetNamespace="http://inspire.ec.europa.eu/schemas/base/3.3rc3/&quot;

GeoServer app-schema thus correctly reports that the location path does not exist.

These look like poor choices for namespace URIs. Please check with INSPIRE as they might be an error, possibly caused by a shift to HTTP URI namespaces colliding with automatic search-and-replace for schema management. Note also the inconsistent trailing slash for "base". Namespace URIs should not vary with patch/bugfix (and an rc is like these). See OGC 06-135r11 "Policy Directives for Writing and PublishingOGC Standards: TC Decisions":
http://portal.opengeospatial.org/files/?artifact_id=40077
On p11: "13.3.2 Version designator [...] The bug fix version
designator SHALL NOT appear in the XML namespace."

Always use prefixes in a location path, not URIs; the presence of any colons will break xpath parsing.

Kind regards,
Ben.

On 30/07/13 21:04, Sylvain GRELLET wrote:

Dear list,

We have an issue having the app-schema work on inherited properties.
The context :
- Geoserver 2-2 and WFS app-schema that works fine in other simple mappings.
- xsd generated using Enterprise Architect + ShapeChange
- the featureType we want to expose inherits from a class that is_in
another schema_ (xsd). Actually we specialize Inspire
ManagementRestrictionOrRegulationZone class (see attached model pdf + xsd)

Below are the various tests I tried

1° / using the expected 'am' prefix -> am:inspireId...
=> "java.lang.RuntimeException: /Failed to get property: ... Error
applying mapping with targetAttribute
am:inspireId/base:Identifier/base:localId am:inspireId is not a valid
location path for type
http://xml.uwwtd.oieau.fr/schemas/0.1:UWWTD_AgglomerationType ...
UWWTD_AgglomerationType
properties:...,http://inspire.ec.europa.eu/schemas/am/3.0rc3#inspireId,...//

///
2°/ the error above proposed a list of properties to use
using the namespace as advised in the error
(http://inspire.ec.europa.eu/schemas/am/3.0rc3#inspireId) generates
"/Error occurred getting features //
//java.lang.StringIndexOutOfBoundsException: String index out of range:
0 String index out of range: 0/"

3°/ are the slashes of the url used in an xPath processing of some sort
? => tried to escape the slashes in the namespace
=> /Error occurred getting features java.lang.IllegalArgumentException:
location step http:\ has prefix http for which no namespace was set.
(Check the Namespaces section in the config file)/

4°/ mapping file states "/Imports and includes at the schemas will be
followed as long as they're relative paths/" => changed the original xsd
to have relative paths => ko

5°/ declared multiple <schemaUri> in <targetTypes><FeatureType><schemaUri>
=> seems only the first one is used

6°/ no prefix in the <targetAttribute> : ko

What are we missing ?
I also attached a light version of the configuration file

Should we upgrade to V 2.3.4 or 2.4-beta ?

Many thanks
Sylvain

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

Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk

_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

On 31/07/13 20:27, Sylvain GRELLET wrote:

Thank you for your quick answer.
It works.

Great!

I forgot to adjust those namespaces the way I did for the xsds.
What surprises me is the way the internal app-schema processes work on
that aspect.
Xsds produced are clean and contain all the information required to
generate a clean XML.
Redefining the name space apart from the xsd seems a duplication to me
thus a maintenance risk (but I don't know the source code).

Namespace prefixes are local to the document in which they are found, so in theory users could set them to be anything in the mapping file. However, you are right: editing XML files is painful. A better app-schema configuration interface would automatically suggest namespaces and prefixes, and even better, allow autocompletion and validation of mapping paths based on loaded schemas. This would make the construction of mapping files easier and less error prone. Unfortunately, this development is not yet funded. But one day!

Kind regards,

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

On Tue, Jul 30, 2013 at 5:29 PM, Alessandro Burastero <alessandro@anonymised.com

wrote:

ciao,

i wrote a custom ows service that nedds to add new layers (both raster
and vector).
In my service bean i declared a contructor that take the Geoserver
object as parameter so i can easily create and read workspace,
namespace, styles etc...
In order to add new layer i've tried to read the rest and rest_config
modules sources, but they are quite complicated.

I hope that somewhere there is a method like addCoverageLayer(File
geotiff)... :slight_smile:

There is no such a thing, you have to mimic what REST and/or the UI are
doing, and have a look at CatalogBuilder to get some of the steps automated.

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it 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

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