<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://www.opengis.net/gml" xmlns:gml="http://www.opengis.net/gml" xmlns:sch="http://www.ascc.net/xml/schematron" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" version="3.2.0">
	<annotation>
		<appinfo source="urn:ogc:specification:gml:schema-xsd:valueObjects:3.2.0">valueObjects.xsd</appinfo>
		<documentation>See ISO/DIS 19136 17.5.
The elements declared in this Clause build on other GML schema components, in particular gml:AbstractTimeObject, gml:AbstractGeometry, and the following types:  gml:MeasureType, gml:MeasureListType, gml:CodeType, gml:CodeOrNilReasonListType, gml:BooleanOrNilReasonListType, gml:IntegerOrNilReasonList.  
Of particular interest are elements that are the heads of substitution groups, and one named choice group. These are the primary reasons for the value objects schema, since they may act as variables in the definition of content models, such as Observations, when it is desired to permit alternative value types to occur some of which may have complex content such as arrays, geometry and time objects, and where it is useful not to prescribe the actual value type in advance. The members of the groups include quantities, category classifications, boolean, count, temporal and spatial values, and aggregates of these.  
The value objects are defined in a hierarchy. The following relationships are defined:
-	Concrete elements gml:Quantity, gml:Category, gml:Count and gml:Boolean are substitutable for the abstract element gml:AbstractScalarValue.  
-	Concrete elements gml:QuantityList, gml:CategoryList, gml:CountList and gml:BooleanList are substitutable for the abstract element gml:AbstractScalarValueList.  
-	Concrete element gml:ValueArray is substitutable for the concrete element gml:CompositeValue.  
-	Abstract elements gml:AbstractScalarValue and gml:AbstractScalarValueList, and concrete elements gml:CompositeValue, gml:ValueExtent, gml:CategoryExtent, gml:CountExtent and gml:QuantityExtent are substitutable for abstract element gml:AbstractValue.  
-	Abstract elements gml:AbstractValue, gml:AbstractTimeObject and gml:AbstractGeometry are all in a choice group named gml:Value, which is used for compositing in gml:CompositeValue and gml:ValueExtent.  
-	Schemas which need values may use the abstract element gml:AbstractValue in a content model in order to permit any of the gml:AbstractScalarValues, gml:AbstractScalarValueLists, gml:CompositeValue or gml:ValueExtent to occur in an instance, or the named group gml:Value to also permit gml:AbstractTimeObjects, gml:AbstractGeometrys.  </documentation>
	</annotation>
	<include schemaLocation="geometryBasic0d1d.xsd"/>
	<include schemaLocation="temporal.xsd"/>
	<element name="Boolean" substitutionGroup="gml:AbstractScalarValue" nillable="true">
		<complexType>
			<simpleContent>
				<extension base="boolean">
					<attribute name="nilReason" type="gml:NilReasonType"/>
				</extension>
			</simpleContent>
		</complexType>
	</element>
	<element name="BooleanList" type="gml:booleanOrNilReasonList" substitutionGroup="gml:AbstractScalarValueList"/>
	<element name="Category" substitutionGroup="gml:AbstractScalarValue" nillable="true">
		<annotation>
			<documentation>A gml:Category has an optional XML attribute codeSpace, whose value is a URI which identifies a dictionary, codelist or authority for the term.</documentation>
		</annotation>
		<complexType>
			<simpleContent>
				<extension base="gml:CodeType">
					<attribute name="nilReason" type="gml:NilReasonType"/>
				</extension>
			</simpleContent>
		</complexType>
	</element>
	<element name="CategoryList" type="gml:CodeOrNilReasonListType" substitutionGroup="gml:AbstractScalarValueList"/>
	<element name="Count" substitutionGroup="gml:AbstractScalarValue" nillable="true">
		<complexType>
			<simpleContent>
				<extension base="integer">
					<attribute name="nilReason" type="gml:NilReasonType"/>
				</extension>
			</simpleContent>
		</complexType>
	</element>
	<element name="CountList" type="gml:integerOrNilReasonList" substitutionGroup="gml:AbstractScalarValueList"/>
	<element name="Quantity" substitutionGroup="gml:AbstractScalarValue" nillable="true">
		<annotation>
			<documentation>An XML attribute uom (“unit of measure”) is required, whose value is a URI which identifies the definition of a ratio scale or units by which the numeric value shall be multiplied, or an interval or position scale on which the value occurs.</documentation>
		</annotation>
		<complexType>
			<simpleContent>
				<extension base="gml:MeasureType">
					<attribute name="nilReason" type="gml:NilReasonType"/>
				</extension>
			</simpleContent>
		</complexType>
	</element>
	<element name="QuantityList" type="gml:MeasureOrNilReasonListType" substitutionGroup="gml:AbstractScalarValueList"/>
	<element name="AbstractValue" type="anyType" abstract="true" substitutionGroup="gml:AbstractObject">
		<annotation>
			<documentation>gml:AbstractValue is an abstract element which acts as the head of a substitution group which contains gml:AbstractScalarValue, gml:AbstractScalarValueList, gml:CompositeValue and gml:ValueExtent, and (transitively) the elements in their substitution groups.
These elements may be used in an application schema as variables, so that in an XML instance document any member of its substitution group may occur.</documentation>
		</annotation>
	</element>
	<element name="AbstractScalarValue" type="anyType" abstract="true" substitutionGroup="gml:AbstractValue">
		<annotation>
			<documentation>gml:AbstractScalarValue is an abstract element which acts as the head of a substitution group which contains gml:Boolean, gml:Category, gml:Count and gml:Quantity, and (transitively) the elements in their substitution groups.</documentation>
		</annotation>
	</element>
	<element name="AbstractScalarValueList" type="anyType" abstract="true" substitutionGroup="gml:AbstractValue">
		<annotation>
			<documentation>gml:AbstractScalarValueList is an abstract element which acts as the head of a substitution group which contains gml:BooleanList, gml:CategoryList, gml:CountList and gml:QuantityList, and (transitively) the elements in their substitution groups.</documentation>
		</annotation>
	</element>
	<group name="Value">
		<annotation>
			<documentation>This is a convenience choice group which unifies generic values defined in this Clause with spatial and temporal objects and the measures described above, so that any of these may be used within aggregate values.</documentation>
		</annotation>
		<choice>
			<element ref="gml:AbstractValue"/>
			<element ref="gml:AbstractGeometry"/>
			<element ref="gml:AbstractTimeObject"/>
			<element ref="gml:Null"/>
		</choice>
	</group>
	<element name="valueProperty" type="gml:ValuePropertyType">
		<annotation>
			<documentation>Property that refers to, or contains, a Value. Convenience element for general use.</documentation>
		</annotation>
	</element>
	<element name="valueComponent" type="gml:ValuePropertyType">
		<annotation>
			<documentation>Property that refers to, or contains, a Value.</documentation>
		</annotation>
	</element>
	<complexType name="ValuePropertyType">
		<sequence minOccurs="0">
			<group ref="gml:Value"/>
		</sequence>
		<attributeGroup ref="gml:AssociationAttributeGroup"/>
		<attributeGroup ref="gml:OwnershipAttributeGroup"/>
	</complexType>
	<element name="valueComponents" type="gml:ValueArrayPropertyType">
		<annotation>
			<documentation>Property that contains Values.</documentation>
		</annotation>
	</element>
	<complexType name="ValueArrayPropertyType">
		<sequence maxOccurs="unbounded">
			<group ref="gml:Value"/>
		</sequence>
		<attributeGroup ref="gml:OwnershipAttributeGroup"/>
	</complexType>
	<element name="CompositeValue" type="gml:CompositeValueType" substitutionGroup="gml:AbstractValue">
		<annotation>
			<documentation>gml:CompositeValue is an aggregate value built from other values . It contains zero or an arbitrary number of gml:valueComponent elements, and zero or one gml:valueComponents property elements.  It may be used for strongly coupled aggregates (vectors, tensors) or for arbitrary collections of values.</documentation>
		</annotation>
	</element>
	<complexType name="CompositeValueType">
		<complexContent>
			<extension base="gml:AbstractGMLType">
				<sequence>
					<element ref="gml:valueComponent" minOccurs="0" maxOccurs="unbounded"/>
					<element ref="gml:valueComponents" minOccurs="0"/>
				</sequence>
				<attributeGroup ref="gml:AggregationAttributeGroup"/>
			</extension>
		</complexContent>
	</complexType>
	<element name="ValueArray" type="gml:ValueArrayType" substitutionGroup="gml:CompositeValue">
		<annotation>
			<documentation>A Value Array is used for homogeneous arrays of primitive and aggregate values.  
The member values may be scalars, composites, arrays or lists.
ValueArray has the same content model as CompositeValue, but the member values shall be homogeneous.  The element declaration contains a Schematron constraint which expresses this restriction precisely.  Since the members are homogeneous, the gml:referenceSystem (uom, codeSpace) may be specified on the gml:ValueArray itself and inherited by all the members if desired.</documentation>
			<appinfo>
				<sch:pattern name="Check either codeSpace or uom not both">
					<sch:rule context="gml:ValueArray">
						<sch:report test="@codeSpace and @uom">ValueArray may not carry both a reference to a codeSpace and a uom</sch:report>
					</sch:rule>
				</sch:pattern>
				<sch:pattern name="Check components are homogeneous">
					<sch:rule context="gml:ValueArray">
						<sch:assert test="count(gml:valueComponent/*) = count(gml:valueComponent/*[name() = name(../../gml:valueComponent[1]/*[1])])">All components of <sch:name/> shall be of the same type</sch:assert>
						<sch:assert test="count(gml:valueComponents/*) = count(gml:valueComponents/*[name() = name(../*[1])])">All components of <sch:name/> shall be of the same type</sch:assert>
					</sch:rule>
				</sch:pattern>
			</appinfo>
		</annotation>
	</element>
	<complexType name="ValueArrayType">
		<complexContent>
			<extension base="gml:CompositeValueType">
				<attributeGroup ref="gml:referenceSystem"/>
			</extension>
		</complexContent>
	</complexType>
	<attributeGroup name="referenceSystem">
		<attribute name="codeSpace" type="anyURI"/>
		<attribute name="uom" type="gml:UomIdentifier"/>
	</attributeGroup>
	<element name="CategoryExtent" type="gml:CategoryExtentType" substitutionGroup="gml:AbstractValue"/>
	<complexType name="CategoryExtentType">
		<simpleContent>
			<restriction base="gml:CodeOrNilReasonListType">
				<length value="2"/>
			</restriction>
		</simpleContent>
	</complexType>
	<element name="CountExtent" type="gml:CountExtentType" substitutionGroup="gml:AbstractValue"/>
	<simpleType name="CountExtentType">
		<restriction base="gml:integerOrNilReasonList">
			<length value="2"/>
		</restriction>
	</simpleType>
	<element name="QuantityExtent" type="gml:QuantityExtentType" substitutionGroup="gml:AbstractValue"/>
	<complexType name="QuantityExtentType">
		<simpleContent>
			<restriction base="gml:MeasureOrNilReasonListType">
				<length value="2"/>
			</restriction>
		</simpleContent>
	</complexType>
	<complexType name="BooleanPropertyType">
		<sequence minOccurs="0">
			<element ref="gml:Boolean"/>
		</sequence>
		<attributeGroup ref="gml:AssociationAttributeGroup"/>
	</complexType>
	<complexType name="CategoryPropertyType">
		<sequence minOccurs="0">
			<element ref="gml:Category"/>
		</sequence>
		<attributeGroup ref="gml:AssociationAttributeGroup"/>
	</complexType>
	<complexType name="QuantityPropertyType">
		<sequence minOccurs="0">
			<element ref="gml:Quantity"/>
		</sequence>
		<attributeGroup ref="gml:AssociationAttributeGroup"/>
	</complexType>
	<complexType name="CountPropertyType">
		<sequence minOccurs="0">
			<element ref="gml:Count"/>
		</sequence>
		<attributeGroup ref="gml:AssociationAttributeGroup"/>
	</complexType>
</schema>
