<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" xmlns:sch="http://www.ascc.net/xml/schematron" targetNamespace="http://www.opengis.net/gml" elementFormDefault="qualified" version="3.2.0" finalDefault="" blockDefault="" attributeFormDefault="unqualified">
    <annotation>
        <appinfo source="urn:opengis:specification:gml:schema-xsd:valueObjects:v3.2.0">valueObjects.xsd</appinfo>
        <documentation>see GML 16.5</documentation>
    </annotation>
    <include schemaLocation="geometryBasic0d1d.xsd"/>
    <include schemaLocation="temporal.xsd"/>
    <element name="Boolean" substitutionGroup="gml:AbstractScalarValue" nillable="true" abstract="false">
        <complexType mixed="false">
            <simpleContent>
                <extension base="boolean">
                    <attribute name="nilReason" type="gml:NilReasonType" use="optional"/>
                </extension>
            </simpleContent>
        </complexType>
    </element>
    <element name="BooleanList" type="gml:booleanOrNilReasonList" substitutionGroup="gml:AbstractScalarValueList" nillable="false" abstract="false"/>
    <element name="Category" substitutionGroup="gml:AbstractScalarValue" nillable="true" abstract="false">
        <complexType mixed="false">
            <simpleContent>
                <extension base="gml:CodeType">
                    <attribute name="nilReason" type="gml:NilReasonType" use="optional"/>
                </extension>
            </simpleContent>
        </complexType>
    </element>
    <element name="CategoryList" type="gml:CodeOrNilReasonListType" substitutionGroup="gml:AbstractScalarValueList" nillable="false" abstract="false"/>
    <element name="Count" substitutionGroup="gml:AbstractScalarValue" nillable="true" abstract="false">
        <complexType mixed="false">
            <simpleContent>
                <extension base="integer">
                    <attribute name="nilReason" type="gml:NilReasonType" use="optional"/>
                </extension>
            </simpleContent>
        </complexType>
    </element>
    <element name="CountList" type="gml:integerOrNilReasonList" substitutionGroup="gml:AbstractScalarValueList" nillable="false" abstract="false"/>
    <element name="Quantity" substitutionGroup="gml:AbstractScalarValue" nillable="true" abstract="false">
        <complexType mixed="false">
            <simpleContent>
                <extension base="gml:MeasureType">
                    <attribute name="nilReason" type="gml:NilReasonType" use="optional"/>
                </extension>
            </simpleContent>
        </complexType>
    </element>
    <element name="QuantityList" type="gml:MeasureOrNilReasonListType" substitutionGroup="gml:AbstractScalarValueList" nillable="false" abstract="false"/>
    <element name="AbstractValue" type="anyType" abstract="true" substitutionGroup="gml:AbstractObject" nillable="false"/>
    <element name="AbstractScalarValue" type="anyType" abstract="true" substitutionGroup="gml:AbstractValue" nillable="false"/>
    <element name="AbstractScalarValueList" type="anyType" abstract="true" substitutionGroup="gml:AbstractValue" nillable="false"/>
    <group name="Value">
        <choice>
            <element ref="gml:AbstractValue" minOccurs="1" maxOccurs="1" nillable="false"/>
            <element ref="gml:AbstractGeometry" minOccurs="1" maxOccurs="1" nillable="false"/>
            <element ref="gml:AbstractTimeObject" minOccurs="1" maxOccurs="1" nillable="false"/>
            <element ref="gml:Null" minOccurs="1" maxOccurs="1" nillable="false"/>
        </choice>
    </group>
    <element name="valueProperty" type="gml:ValuePropertyType" nillable="false" abstract="false"/>
    <element name="valueComponent" type="gml:ValuePropertyType" nillable="false" abstract="false"/>
    <complexType name="ValuePropertyType" mixed="false" abstract="false">
        <sequence minOccurs="0" maxOccurs="1">
            <group ref="gml:Value" minOccurs="1" maxOccurs="1"/>
        </sequence>
        <attributeGroup ref="gml:AssociationAttributeGroup"/>
        <attributeGroup ref="gml:OwnershipAttributeGroup"/>
    </complexType>
    <element name="valueComponents" type="gml:ValueArrayPropertyType" nillable="false" abstract="false"/>
    <complexType name="ValueArrayPropertyType" mixed="false" abstract="false">
        <sequence maxOccurs="unbounded" minOccurs="1">
            <group ref="gml:Value" minOccurs="1" maxOccurs="1"/>
        </sequence>
        <attributeGroup ref="gml:OwnershipAttributeGroup"/>
    </complexType>
    <element name="CompositeValue" type="gml:CompositeValueType" substitutionGroup="gml:AbstractValue" nillable="false" abstract="false"/>
    <complexType name="CompositeValueType" mixed="false" abstract="false">
        <xsd:complexContent xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <extension base="gml:AbstractGMLType">
                <sequence minOccurs="1" maxOccurs="1">
                    <element ref="gml:valueComponent" minOccurs="0" maxOccurs="unbounded" nillable="false"/>
                    <element ref="gml:valueComponents" minOccurs="0" maxOccurs="1" nillable="false"/>
                </sequence>
                <attributeGroup ref="gml:AggregationAttributeGroup"/>
            </extension>
        </xsd:complexContent>
    </complexType>
    <element name="ValueArray" type="gml:ValueArrayType" substitutionGroup="gml:CompositeValue" nillable="false" abstract="false">
        <annotation>
            <appinfo>
                <sch:ns prefix="gml" uri="http://www.opengis.net/gml"/>
                <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" mixed="false" abstract="false">
        <xsd:complexContent xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <extension base="gml:CompositeValueType">
                <attributeGroup ref="gml:referenceSystem"/>
            </extension>
        </xsd:complexContent>
    </complexType>
    <attributeGroup name="referenceSystem">
        <attribute name="codeSpace" type="anyURI" use="optional"/>
        <attribute name="uom" type="gml:UomIdentifier" use="optional"/>
    </attributeGroup>
    <element name="CategoryExtent" type="gml:CategoryExtentType" substitutionGroup="gml:AbstractValue" nillable="false" abstract="false"/>
    <complexType name="CategoryExtentType" mixed="false" abstract="false">
        <simpleContent>
            <restriction base="gml:CodeOrNilReasonListType">
                <length value="2" fixed="false"/>
            </restriction>
        </simpleContent>
    </complexType>
    <element name="CountExtent" type="gml:CountExtentType" substitutionGroup="gml:AbstractValue" nillable="false" abstract="false"/>
    <simpleType name="CountExtentType">
        <restriction base="gml:integerOrNilReasonList">
            <length value="2" fixed="false"/>
        </restriction>
    </simpleType>
    <element name="QuantityExtent" type="gml:QuantityExtentType" substitutionGroup="gml:AbstractValue" nillable="false" abstract="false"/>
    <complexType name="QuantityExtentType" mixed="false" abstract="false">
        <simpleContent>
            <restriction base="gml:MeasureOrNilReasonListType">
                <length value="2" fixed="false"/>
            </restriction>
        </simpleContent>
    </complexType>
    <complexType name="BooleanPropertyType" mixed="false" abstract="false">
        <sequence minOccurs="0" maxOccurs="1">
            <element ref="gml:Boolean" minOccurs="1" maxOccurs="1" nillable="false"/>
        </sequence>
        <attributeGroup ref="gml:AssociationAttributeGroup"/>
    </complexType>
    <complexType name="CategoryPropertyType" mixed="false" abstract="false">
        <sequence minOccurs="0" maxOccurs="1">
            <element ref="gml:Category" minOccurs="1" maxOccurs="1" nillable="false"/>
        </sequence>
        <attributeGroup ref="gml:AssociationAttributeGroup"/>
    </complexType>
    <complexType name="QuantityPropertyType" mixed="false" abstract="false">
        <sequence minOccurs="0" maxOccurs="1">
            <element ref="gml:Quantity" minOccurs="1" maxOccurs="1" nillable="false"/>
        </sequence>
        <attributeGroup ref="gml:AssociationAttributeGroup"/>
    </complexType>
    <complexType name="CountPropertyType" mixed="false" abstract="false">
        <sequence minOccurs="0" maxOccurs="1">
            <element ref="gml:Count" minOccurs="1" maxOccurs="1" nillable="false"/>
        </sequence>
        <attributeGroup ref="gml:AssociationAttributeGroup"/>
    </complexType>
</schema>