Error substituting restricted type for base

Having trouble installing Oxygen? Got a bug to report? Post it all here.
jmclaug
Posts: 3
Joined: Thu Apr 30, 2009 1:58 am

Error substituting restricted type for base

Post by jmclaug »

Hello,
I am trying to build an xml document that includes multiple entries in the xsi:schemaLocation attribute. The second schema provides an override for an element type declared in the first schema, but oxygen doesn't pick it up and fails to validate. Thanks for any help. Below is the document.

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<RegisterSensor service="SOS" version="1.0.0" xmlns="http://www.opengis.net/sos/1.0" xmlns:swe="http://www.opengis.net/swe/1.0.1" xmlns:ows="http://www.opengeospatial.net/ows" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:om="http://www.opengis.net/om/1.0" xmlns:sml="http://www.opengis.net/sensorML/1.0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/sos/1.0
http://schemas.opengis.net/sos/1.0.0/sosRegisterSensor.xsd http://www.opengis.net/om/1.0 http://schemas.opengis.net/om/1.0.0/extensions/observationSpecialization_override.xsd" >

<!-- Sensor Description parameter; Currently, this has to be a sml:System -->
<SensorDescription>
<sml:SensorML version="1.0.1">
<sml:member>
<sml:System xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >

<!--sml:identification element must contain the ID of the sensor-->
<sml:identification>
<sml:IdentifierList>
<sml:identifier>
<sml:Term definition="urn:ogc:def:identifier:OGC:uniqueID">
<sml:value>urn:ogc:object:feature:Sensor:IFGI:ifgi-sensor-10</sml:value>
</sml:Term>
</sml:identifier>
</sml:IdentifierList>
</sml:identification>

<!-- sml:capabilities element has to contain status and mobility information -->
<sml:capabilities>
<swe:SimpleDataRecord>
<!-- status indicates, whether sensor is collecting data at the moment (true) or not (false) -->
<swe:field name="status">
<swe:Boolean>
<swe:value>true</swe:value>
</swe:Boolean>
</swe:field>
<!-- status indicates, whether sensor is mobile (true) or fixed (false) -->
<swe:field name="mobile">
<swe:Boolean>
<swe:value>false</swe:value>
</swe:Boolean>
</swe:field>
</swe:SimpleDataRecord>
</sml:capabilities>

<!-- last measured position of sensor -->
<sml:position name="sensorPosition">
<swe:Position referenceFrame="urn:ogc:def:crs:EPSG:4326">
<swe:location>
<swe:Vector gml:id="STATION_LOCATION">
<swe:coordinate name="easting">
<swe:Quantity axisID="x">
<swe:uom code="degree"/>
<swe:value>7.52</swe:value>
</swe:Quantity>
</swe:coordinate>
<swe:coordinate name="northing">
<swe:Quantity axisID="y">
<swe:uom code="degree"/>
<swe:value>52.90</swe:value>
</swe:Quantity>
</swe:coordinate>
<swe:coordinate name="altitude">
<swe:Quantity axisID="z">
<swe:uom code="m"/>
<swe:value>52.0</swe:value>
</swe:Quantity>
</swe:coordinate>
</swe:Vector>
</swe:location>
</swe:Position>
</sml:position>

<!-- list containing the input phenomena for this sensor system -->
<sml:inputs>
<sml:InputList>
<sml:input name="waterlevel">
<swe:ObservableProperty definition="urn:ogc:def:phenomenon:OGC:1.0.30:waterlevel"/>
</sml:input>
</sml:InputList>
</sml:inputs>

<!-- list containing the output phenomena of this sensor system; ATTENTION: these phenomena are parsed and inserted into the database; they have to contain offering elements to determine the correct offering for the sensors and measured phenomena -->
<sml:outputs>
<sml:OutputList>
<sml:output name="waterlevel">
<swe:Quantity definition="urn:ogc:def:phenomenon:OGC:1.0.30:waterlevel">
<gml:metaDataProperty>
<offering>
<id>GAUGE_HEIGHT</id>
<name>gauge height in Muenster</name>
</offering>
</gml:metaDataProperty>
<swe:uom code="cm"/>
</swe:Quantity>
</sml:output>
</sml:OutputList>
</sml:outputs>

<!-- description of components of this sensor system; these are currently not used by the 52N SOS -->
<sml:components>
<sml:ComponentList>
<sml:component name="gaugeSensor">
<sml:Component>
<sml:identification>
<sml:IdentifierList>
<sml:identifier>
<sml:Term definition="urn:ogc:def:identifier:OGC:uniqueID">
<sml:value>urn:ogc:object:feature:Sensor:water_level_sensor</sml:value>
</sml:Term>
</sml:identifier>
</sml:IdentifierList>
</sml:identification>
<sml:inputs>
<sml:InputList>
<sml:input name="gaugeHeight">
<swe:ObservableProperty definition="urn:ogc:def:phenomenon:OGC:1.0.30:waterlevel"/>
</sml:input>
</sml:InputList>
</sml:inputs>
<sml:outputs>
<sml:OutputList>
<sml:output name="gaugeHeight">
<swe:Quantity definition="urn:ogc:def:phenomenon:OGC:1.0.30:waterlevel">
<swe:uom code="cm"/>
</swe:Quantity>
</sml:output>
</sml:OutputList>
</sml:outputs>
</sml:Component>
</sml:component>
</sml:ComponentList>
</sml:components>
</sml:System>
</sml:member>
</sml:SensorML>
</SensorDescription>

<!-- ObservationTemplate parameter; this has to be an empty measurement at the moment, as the 52N SOS only supports Measurements to be inserted -->
<ObservationTemplate>
<om:Measurement>
<om:samplingTime/>
<om:procedure/>
<om:observedProperty/>
<om:featureOfInterest></om:featureOfInterest>
<om:result uom=""></om:result>
</om:Measurement>
</ObservationTemplate>
</RegisterSensor>
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Error substituting restricted type for base

Post by sorin_ristache »

Hello,

Oxygen picks it up and this is why the validation fails. If you try to validate observationSpecialization_override.xsd you see that the type om:MeasurementType is not a valid restriction of om:ObservationType because om:MeasurementType is not derived by restriction correctly from om:ObservationType. The type om:ObservationType extends gml:AbstractFeatureType so it is a sequence of: gml:metaDataProperty, gml:description, gml:name, gml:boundedBy, gml:location, etc but om:MeasurementType is a sequence of: gml:metaDataProperty, gml:description, gml:name, gml:boundedBy, gml:metadata, etc. What should follow after gml:boundedBy: gml:location as in om:ObservationType or gml:metadata as in om:MeasurementType?


Regards,
Sorin
jmclaug
Posts: 3
Joined: Thu Apr 30, 2009 1:58 am

Re: Error substituting restricted type for base

Post by jmclaug »

Thanks for your reply, sorin.

Oxygen does say that observationSpecialization_override.xsd is valid if I paste it into my workspace. I did have to xsi:schemaLocation="http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema.xsd" in the schema element and change the import and include elements to use full urls instead of relative. I've included it below. Could you take a second look and make sure the problem isn't somewhere else?

thanks,
jim

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema.xsd"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:om="http://www.opengis.net/om/1.0"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:gml="http://www.opengis.net/gml"
xmlns:swe="http://www.opengis.net/swe/1.0.1"
targetNamespace="http://www.opengis.net/om/1.0"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
version="1.0.0">
<annotation>
<documentation>observationSpecialization_override.xsd

An implementation of the OandM model for SWE
This document contains various specializations of the basic observation pattern, by fixing the type of the result.
In this version, the specialization is achieved by restricting om:ObservationType to have a result of the correct type

Copyright (c) 2007 Open Geospatial Consortium - see http://www.opengeospatial.org/ogc/software</documentation>
</annotation>
<!-- ====================================================================== -->
<!-- bring in other schemas -->
<import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd"/>
<import namespace="http://www.opengis.net/swe/1.0.1" schemaLocation="http://schemas.opengis.net/sweCommon/1.0.1/swe.xsd"/>
<include schemaLocation="http://schemas.opengis.net/om/1.0.0/observation.xsd"/>
<!-- ====================================================================== -->
<!-- ====================================================================== -->
<!-- ===== Scalar Observations ====== -->
<!-- ====================================================================== -->
<complexType name="MeasurementType">
<annotation>
<documentation>Specialized Observation in which the result is a Measure</documentation>
</annotation>
<complexContent>
<restriction base="om:ObservationType">
<sequence>
<element ref="gml:metaDataProperty" minOccurs="0" maxOccurs="unbounded"/>
<element ref="gml:description" minOccurs="0"/>
<element ref="gml:name" minOccurs="0" maxOccurs="unbounded"/>
<element ref="gml:boundedBy" minOccurs="0"/>
<element name="metadata" type="om:AnyOrReferenceType" minOccurs="0"/>
<element name="samplingTime" type="swe:TimeObjectPropertyType"/>
<element name="resultTime" type="swe:TimeObjectPropertyType" minOccurs="0"/>
<element name="procedure" type="om:ProcessPropertyType"/>
<element name="resultQuality" type="om:AnyOrReferenceType" minOccurs="0"/>
<element name="observedProperty" type="swe:PhenomenonPropertyType"/>
<element name="featureOfInterest" type="gml:FeaturePropertyType"/>
<element name="parameter" type="swe:AnyDataPropertyType" minOccurs="0" maxOccurs="unbounded"/>
<element name="result" type="gml:MeasureType"/>
</sequence>
</restriction>
</complexContent>
</complexType>
<!-- ...................... -->
<element name="Measurement" type="om:MeasurementType" substitutionGroup="om:Observation">
<annotation>
<documentation>Specialized Observation in which the result is a Measure</documentation>
</annotation>
</element>
<!-- ====================================================================== -->
<complexType name="CategoryObservationType">
<annotation>
<documentation>Specialized Observation, in which the result is a textual value from a controlled vocabulary</documentation>
</annotation>
<complexContent>
<restriction base="om:ObservationType">
<sequence>
<element ref="gml:metaDataProperty" minOccurs="0" maxOccurs="unbounded"/>
<element ref="gml:description" minOccurs="0"/>
<element ref="gml:name" minOccurs="0" maxOccurs="unbounded"/>
<element ref="gml:boundedBy" minOccurs="0"/>
<element name="metadata" type="om:AnyOrReferenceType" minOccurs="0"/>
<element name="samplingTime" type="swe:TimeObjectPropertyType"/>
<element name="resultTime" type="swe:TimeObjectPropertyType" minOccurs="0"/>
<element name="procedure" type="om:ProcessPropertyType"/>
<element name="resultQuality" type="om:AnyOrReferenceType" minOccurs="0"/>
<element name="observedProperty" type="swe:PhenomenonPropertyType"/>
<element name="featureOfInterest" type="gml:FeaturePropertyType"/>
<element name="parameter" type="swe:AnyDataPropertyType" minOccurs="0" maxOccurs="unbounded"/>
<element name="result" type="swe:ScopedNameType">
<annotation>
<documentation>A Scoped Name is a term with a mandatory codeSpace attribute</documentation>
</annotation>
</element>
</sequence>
</restriction>
</complexContent>
</complexType>
<!-- ...................... -->
<element name="CategoryObservation" type="om:CategoryObservationType" substitutionGroup="om:Observation">
<annotation>
<documentation>Specialized Observation, in which the result is a textual value from a controlled vocabulary</documentation>
</annotation>
</element>
<!-- ====================================================================== -->
<complexType name="CountObservationType">
<annotation>
<documentation>Specialized Observation, in which the result is an integer representing the count of the observed property</documentation>
</annotation>
<complexContent>
<restriction base="om:ObservationType">
<sequence>
<element ref="gml:metaDataProperty" minOccurs="0" maxOccurs="unbounded"/>
<element ref="gml:description" minOccurs="0"/>
<element ref="gml:name" minOccurs="0" maxOccurs="unbounded"/>
<element ref="gml:boundedBy" minOccurs="0"/>
<element name="metadata" type="om:AnyOrReferenceType" minOccurs="0"/>
<element name="samplingTime" type="swe:TimeObjectPropertyType"/>
<element name="resultTime" type="swe:TimeObjectPropertyType" minOccurs="0"/>
<element name="procedure" type="om:ProcessPropertyType"/>
<element name="resultQuality" type="om:AnyOrReferenceType" minOccurs="0"/>
<element name="observedProperty" type="swe:PhenomenonPropertyType"/>
<element name="featureOfInterest" type="gml:FeaturePropertyType"/>
<element name="parameter" type="swe:AnyDataPropertyType" minOccurs="0" maxOccurs="unbounded"/>
<element name="result" type="integer">
<annotation>
<documentation>count of the observed property</documentation>
</annotation>
</element>
</sequence>
</restriction>
</complexContent>
</complexType>
<!-- ...................... -->
<element name="CountObservation" type="om:CountObservationType" substitutionGroup="om:Observation">
<annotation>
<documentation>Specialized Observation, in which the result is an integer representing the count of the observed property</documentation>
</annotation>
</element>
<!-- ====================================================================== -->
<complexType name="TruthObservationType">
<annotation>
<documentation>Specialized Observation, in which the result is a boolean value representing the truth value (e.g. existence) of the observed property</documentation>
</annotation>
<complexContent>
<restriction base="om:ObservationType">
<sequence>
<element ref="gml:metaDataProperty" minOccurs="0" maxOccurs="unbounded"/>
<element ref="gml:description" minOccurs="0"/>
<element ref="gml:name" minOccurs="0" maxOccurs="unbounded"/>
<element ref="gml:boundedBy" minOccurs="0"/>
<element name="metadata" type="om:AnyOrReferenceType" minOccurs="0"/>
<element name="samplingTime" type="swe:TimeObjectPropertyType"/>
<element name="resultTime" type="swe:TimeObjectPropertyType" minOccurs="0"/>
<element name="procedure" type="om:ProcessPropertyType"/>
<element name="resultQuality" type="om:AnyOrReferenceType" minOccurs="0"/>
<element name="observedProperty" type="swe:PhenomenonPropertyType"/>
<element name="featureOfInterest" type="gml:FeaturePropertyType"/>
<element name="parameter" type="swe:AnyDataPropertyType" minOccurs="0" maxOccurs="unbounded"/>
<element name="result" type="boolean">
<annotation>
<documentation>truth value (e.g. existence) of the observed property</documentation>
</annotation>
</element>
</sequence>
</restriction>
</complexContent>
</complexType>
<!-- ...................... -->
<element name="TruthObservation" type="om:TruthObservationType" substitutionGroup="om:Observation">
<annotation>
<documentation>Specialized Observation, in which the result is a boolean value representing the truth value (usually existence) of the observed property</documentation>
</annotation>
</element>
<!-- ====================================================================== -->
<complexType name="GeometryObservationType">
<annotation>
<documentation>Specialized Observation, in which the result is a Geometry </documentation>
</annotation>
<complexContent>
<restriction base="om:ObservationType">
<sequence>
<element ref="gml:metaDataProperty" minOccurs="0" maxOccurs="unbounded"/>
<element ref="gml:description" minOccurs="0"/>
<element ref="gml:name" minOccurs="0" maxOccurs="unbounded"/>
<element ref="gml:boundedBy" minOccurs="0"/>
<element name="metadata" type="om:AnyOrReferenceType" minOccurs="0"/>
<element name="samplingTime" type="swe:TimeObjectPropertyType"/>
<element name="resultTime" type="swe:TimeObjectPropertyType" minOccurs="0"/>
<element name="procedure" type="om:ProcessPropertyType"/>
<element name="resultQuality" type="om:AnyOrReferenceType" minOccurs="0"/>
<element name="observedProperty" type="swe:PhenomenonPropertyType"/>
<element name="featureOfInterest" type="gml:FeaturePropertyType"/>
<element name="parameter" type="swe:AnyDataPropertyType" minOccurs="0" maxOccurs="unbounded"/>
<element name="result" type="gml:GeometryPropertyType">
<annotation>
<documentation>Geometry of the observed property</documentation>
</annotation>
</element>
</sequence>
</restriction>
</complexContent>
</complexType>
<!-- ...................... -->
<element name="GeometryObservation" type="om:GeometryObservationType" substitutionGroup="om:Observation">
<annotation>
<documentation>Specialized Observation, in which the result is a Geometry</documentation>
</annotation>
</element>
<!-- ====================================================================== -->
<complexType name="TemporalObservationType">
<annotation>
<documentation>Specialized Observation, in which the result is a Temporal object</documentation>
</annotation>
<complexContent>
<restriction base="om:ObservationType">
<sequence>
<element ref="gml:metaDataProperty" minOccurs="0" maxOccurs="unbounded"/>
<element ref="gml:description" minOccurs="0"/>
<element ref="gml:name" minOccurs="0" maxOccurs="unbounded"/>
<element ref="gml:boundedBy" minOccurs="0"/>
<element name="metadata" type="om:AnyOrReferenceType" minOccurs="0"/>
<element name="samplingTime" type="swe:TimeObjectPropertyType"/>
<element name="resultTime" type="swe:TimeObjectPropertyType" minOccurs="0"/>
<element name="procedure" type="om:ProcessPropertyType"/>
<element name="resultQuality" type="om:AnyOrReferenceType" minOccurs="0"/>
<element name="observedProperty" type="swe:PhenomenonPropertyType"/>
<element name="featureOfInterest" type="gml:FeaturePropertyType"/>
<element name="parameter" type="swe:AnyDataPropertyType" minOccurs="0" maxOccurs="unbounded"/>
<element name="result" type="swe:TimeObjectPropertyType">
<annotation>
<documentation>Temporal value of the observed property</documentation>
</annotation>
</element>
</sequence>
</restriction>
</complexContent>
</complexType>
<!-- ...................... -->
<element name="TemporalObservation" type="om:TemporalObservationType" substitutionGroup="om:Observation">
<annotation>
<documentation>Specialized Observation, in which the result is a Temporal object</documentation>
</annotation>
</element>
<!-- ====================================================================== -->
<!-- ===== Observation with constant complex result ====== -->
<!-- ====================================================================== -->
<complexType name="ComplexObservationType">
<annotation>
<documentation>Specialized Observation, in which the result is a record representing a description of a multi-component phenomenon.</documentation>
</annotation>
<complexContent>
<restriction base="om:ObservationType">
<sequence>
<element ref="gml:metaDataProperty" minOccurs="0" maxOccurs="unbounded"/>
<element ref="gml:description" minOccurs="0"/>
<element ref="gml:name" minOccurs="0" maxOccurs="unbounded"/>
<element ref="gml:boundedBy" minOccurs="0"/>
<element name="metadata" type="om:AnyOrReferenceType" minOccurs="0"/>
<element name="samplingTime" type="swe:TimeObjectPropertyType"/>
<element name="resultTime" type="swe:TimeObjectPropertyType" minOccurs="0"/>
<element name="procedure" type="om:ProcessPropertyType"/>
<element name="resultQuality" type="om:AnyOrReferenceType" minOccurs="0"/>
<element name="observedProperty" type="swe:PhenomenonPropertyType"/>
<element name="featureOfInterest" type="gml:FeaturePropertyType"/>
<element name="parameter" type="swe:AnyDataPropertyType" minOccurs="0" maxOccurs="unbounded"/>
<element name="result" type="swe:DataRecordPropertyType">
<annotation>
<documentation>result is a Record - i.e. a heterogeneous list of fields (ISO/IEC 11404) - describing a multi-component phenomenon</documentation>
</annotation>
</element>
</sequence>
</restriction>
</complexContent>
</complexType>
<!-- ...................... -->
<element name="ComplexObservation" type="om:ComplexObservationType" substitutionGroup="om:Observation">
<annotation>
<documentation>Specialized Observation, in which the result is a record representing a multi-component phenomenon</documentation>
</annotation>
</element>
<!-- ====================================================================== -->
</schema>
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Error substituting restricted type for base

Post by sorin_ristache »

jmclaug wrote:Oxygen does say that observationSpecialization_override.xsd is valid if I paste it into my workspace.
In what Oxygen version did you try? I tried in versions 10.2 and 9.3 and observationSpecialization_override.xsd is not valid:

Code: Select all

derivation-ok-restriction.5.4.2: Error for type 'MeasurementType'.  The particle of the type is not a valid restriction of the particle of the base.

Regards,
Sorin
jmclaug
Posts: 3
Joined: Thu Apr 30, 2009 1:58 am

Re: Error substituting restricted type for base

Post by jmclaug »

Hi Sorin,
Sorry I turned off validation/schema-full-checking when I was experimenting with various fixes and forgot to turn it back on. Now I see the same error as you. I will refer it to the standards committee.

thanks,
jim
Post Reply