Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced GmlTool to support multiple namespaces with same prefix in one application schema (3.5) #1674

Merged

Conversation

lgoltz
Copy link
Contributor

@lgoltz lgoltz commented Apr 10, 2024

The updated INSPIRE schemas references schemas in different versions. The namespace urls are bound to the same prefix. E.g: https://inspire.ec.europa.eu/schemas/us-govserv/5.0/GovernmentalServices.xsd

contains

<schema  xmlns:au="http://inspire.ec.europa.eu/schemas/au/5.0" ...>
...
  <import namespace="http://inspire.ec.europa.eu/schemas/ad/4.0" schemaLocation="https://inspire.ec.europa.eu/schemas/ad/4.0/Addresses.xsd"/>
  <import namespace="http://inspire.ec.europa.eu/schemas/au/5.0" schemaLocation="https://inspire.ec.europa.eu/schemas/au/5.0/AdministrativeUnits.xsd"/>

The referenced https://inspire.ec.europa.eu/schemas/ad/4.0/Addresses.xsd uses version 4.0 of AdministrativeUnits:

<schema xmlns:au="http://inspire.ec.europa.eu/schemas/au/4.0" ...>
...
<import namespace="http://inspire.ec.europa.eu/schemas/au/4.0" schemaLocation="https://inspire.ec.europa.eu/schemas/au/4.0/AdministrativeUnits.xsd"/>

Creating the SqlFeatureStore configuration with
SqlFeatureStoreConfigCreator -format=all -srid=25833 -idtype=uuid -mapping=relational -dialect=postgis -schemaUrl=https://inspire.ec.europa.eu/schemas/us-govserv/5.0/GovernmentalServices.xsd
results in multiple namespaces bindings with the same prefix but different namespace urls:

<SQLFeatureStore xmlns="http://www.deegree.org/datasource/feature/sql"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://www.deegree.org/datasource/feature/sql https://schemas.deegree.org/core/3.5/datasource/feature/sql/sql.xsd"
                 xmlns:ad="http://inspire.ec.europa.eu/schemas/ad/4.0"
                 xmlns:au="http://inspire.ec.europa.eu/schemas/au/4.0"
                 xmlns:au="http://inspire.ec.europa.eu/schemas/au/5.0"
                 xmlns:base="http://inspire.ec.europa.eu/schemas/base/3.3"
                 xmlns:base="http://inspire.ec.europa.eu/schemas/base/4.0"
                 xmlns:base2="http://inspire.ec.europa.eu/schemas/base2/2.0"
                 xmlns:cp="http://inspire.ec.europa.eu/schemas/cp/4.0"
                 xmlns:gn="http://inspire.ec.europa.eu/schemas/gn/4.0"
                 xmlns:net="http://inspire.ec.europa.eu/schemas/net/4.0"
                 xmlns:net="http://inspire.ec.europa.eu/schemas/net/5.0"
                 xmlns:tn="http://inspire.ec.europa.eu/schemas/tn/4.0"
                 xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gml="http://www.opengis.net/gml/3.2">

Startup fails with:

deegree-1   | com.ctc.wstx.exc.WstxParsingException: Duplicate declaration for namespace prefix 'au'.
deegree-1   |  at [row,col {unknown-source}]: [1,444]

and the generated SQL cannot be executed without failure because it contains multiple duplicated create table statements.

This PR fixes the problem by the prefixes of namespaces to ensure unique nsUrl/prefix combinations.

@lgoltz lgoltz added bug error issue and bug (fix) tools deegree command line tools (CLI) labels Apr 10, 2024
@lgoltz lgoltz modified the milestone: 3.5.7 Apr 10, 2024
@lgoltz lgoltz changed the title Enhanced GmlTool to support multiple namespaces with same prefix in one application schema Enhanced GmlTool to support multiple namespaces with same prefix in one application schema (3.5) Apr 10, 2024
@tfr42 tfr42 added this to the 3.5.7 milestone Apr 10, 2024
@copierrj copierrj merged commit 01cca9b into deegree:3.5-main Apr 10, 2024
1 check passed
@tfr42 tfr42 deleted the feature/samePrefixDifferent-9655-185 branch April 10, 2024 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug error issue and bug (fix) tools deegree command line tools (CLI)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants