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

Validation error: gml:description not allowed #169

Open
ilkkarinne opened this issue Jun 14, 2023 · 0 comments
Open

Validation error: gml:description not allowed #169

ilkkarinne opened this issue Jun 14, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@ilkkarinne
Copy link
Member

The basic GML object properties like gml:description, gml:name, gml:boundedBy should be allowed in all feature type elements like SpatialPlan, PlanOrder, PlanObject and PlanRecommendation by the used XML Schema, as they are inherited from their supertypes gml:AbstractGMLType and gml:AbstractFeatureType. However, using gml:description for example returns a schema validation error.

The reason for the error is that the code adds the generated elements gml:identifier and lud-core:objectIdentifier as the first child elements of the container element, thus moving the gml:description in the wrong place. As per the GML XML Schema, the gml:identifier element must become after any gml:description element:

       <group name="StandardObjectProperties">
		<sequence>
			<element ref="gml:metaDataProperty" minOccurs="0" maxOccurs="unbounded"/>
			<element ref="gml:description" minOccurs="0"/>
			<element ref="gml:descriptionReference" minOccurs="0"/>
			<element ref="gml:identifier" minOccurs="0"/>
			<element ref="gml:name" minOccurs="0" maxOccurs="unbounded"/>
		</sequence>
	</group>

.. and any gml:boundedBy and gml:location before any lud-core elements:

<complexType name="AbstractFeatureType" abstract="true">
		<annotation>
			<documentation>The basic feature model is given by the gml:AbstractFeatureType.
The content model for gml:AbstractFeatureType adds two specific properties suitable for geographic features to the content model defined in gml:AbstractGMLType. 
The value of the gml:boundedBy property describes an envelope that encloses the entire feature instance, and is primarily useful for supporting rapid searching for features that occur in a particular location. 
The value of the gml:location property describes the extent, position or relative location of the feature.</documentation>
		</annotation>
		<complexContent>
			<extension base="gml:AbstractGMLType">
				<sequence>
					<element ref="gml:boundedBy" minOccurs="0"/>
					<element ref="gml:location" minOccurs="0"/>
				</sequence>
			</extension>
		</complexContent>
	</complexType>

Snippet of the tested document:

 <lud-core:featureMember>
        <splan:PlanObject gml:id="KAAVAKOHDE-AJO-12">
        <gml:description>foobar</gml:description>
            <lud-core:producerSpecificIdentifier>AK_SIPOO_5_lainvoimainen_kaava_sipoo_nevasgard.7</lud-core:producerSpecificIdentifier>
            <splan:geometry>
...

Error:

{
  "detail": [
    {
      "loc": [
        "XML"
      ],
      "msg": "Failed to validate XML against schema! Reason: failed validating <Element {http://tietomallit.ymparisto.fi/kaavatiedot/xml/1.2}PlanObject at 0x7ff6b8116400> with XsdGroup(model='sequence', occurs=[1, 1]):

Reason: Unexpected child with tag 'gml:description' at position 3. Tag 'splan:geometry' expected.

Schema:

<complexType xmlns=\"http://www.w3.org/2001/XMLSchema\" xmlns:default=\"http://www.opengis.net/gml/3.3/exr\" name=\"PlanObjectType\">
<complexContent>
      <extension base=\"splan:AbstractPlanObjectType\">
        <sequence>
          
          <element minOccurs=\"0\" name=\"bindingnessOfLocation\" type=\"gml:ReferenceType\">
            <annotation>
              <appinfo>
                <default:targetCodeList>Sitovuuslaji</default:targetCodeList>
              </appinfo>
            </annotation>
          </element>
          <element maxOccurs=\"unbounded\" minOccurs=\"0\" name=\"relatedInputDataObjectIdentifier\" type=\"anyURI\" />
          <element minOccurs=\"0\" name=\"environmentalChangeType\" type=\"gml:ReferenceType\">
            <annotation>
              <appinfo>
                <default:targetCodeList>AbstraktiYmparistomuutoksenLaji</default:targetCodeList>
              </appinfo>
            </annotation>
          </element>
    ...
    ...
  </complexType>

Instance (line 144):

  <splan:PlanObject xmlns:splan=\"http://tietomallit.ymparisto.fi/kaavatiedot/xml/1.2\" xmlns:gml=\"http://www.opengis.net/gml/3.2\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:gmlexr=\"http://www.opengis.net/gml/3.3/exr\" xmlns:lsp=\"http://tietomallit.ymparisto.fi/ry-yhteiset/kielituki/xml/1.0\" xmlns:lud-core=\"http://tietomallit.ymparisto.fi/mkp-ydin/xml/1.2\" gml:id=\"id-1e592826-f8a8-46fb-ae5d-b76259477b09.1c7c3af8-b707-4be6-a5d7-75140912d239\">
  <gml:identifier codeSpace=\"http://uri.suomi.fi/object/rytj/kaava\">PlanObject/id-1e592826-f8a8-46fb-ae5d-b76259477b09.1c7c3af8-b707-4be6-a5d7-75140912d239</gml:identifier>
<lud-core:objectIdentifier>id-1e592826-f8a8-46fb-ae5d-b76259477b09</lud-core:objectIdentifier
<gml:description>foobar</gml:description>
      <lud-core:producerSpecificIdentifier>AK_SIPOO_5_lainvoimainen_kaava_sipoo_nevasgard.7</lud-core:producerSpecificIdentifier>
      <lud-core:storageTime><gml:TimeInstant><gml:timePosition>2023-06-14T09:07:49+00:00</gml:timePosition></gml:TimeInstant></lud-core:storageTime><splan:geometry>
          <gml:Polygon srsName=\"urn:ogc:def:crs:EPSG::4326\" gml:id=\"AK_SIPOO_5_lainvoimainen_kaava_sipoo_nevasgard.geom.7\">
              <gml:exterior>
                  <gml:LinearRing>
                      <gml:posList>60.2893418 25.430357 60.2894259 25.4304633 60.2894444
                          25.4303376 60.2895416 25.4298993 60.2895686 25.4298493 60.2894865
                          25.4297044 60.2893418 25.430357</gml:posList>
                  </gml:LinearRing>
              </gml:exterior>
          </gml:Polygon>
      </splan:geometry>
      <splan:spatialPlan xlink:href=\"#id-7eae86e2-bbe3-413f-b833-cda1edd7f685.c4deb9e2-ceac-485c-b7df-adb3866fe59a\"/>
      <splan:bindingnessOfLocation xlink:href=\"http://uri.suomi.fi/codelist/rytj/RY_Sitovuuslaji/code/02\" xlink:title=\"Ohjeellinen\"/>
  </splan:PlanObject>

Path: /lud-core:LandUseFeatureCollection/lud-core:featureMember[2]/splan:PlanObject
",
      "type": "verify_error"
    }
  ]
}
@ilkkarinne ilkkarinne added the bug Something isn't working label Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant