<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:wml2="http://www.opengis.net/waterml/2.0"
  xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:om="http://www.opengis.net/om/2.0"
  xmlns:sams="http://www.opengis.net/samplingSpatial/2.0" xmlns:sam="http://www.opengis.net/sampling/2.0"
  targetNamespace="http://www.opengis.net/waterml/2.0" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.0.2">
  <annotation>
    <documentation>Specialized observation metadata classes for OGC WaterML2.0
      
      OGC WaterML 2.0 is an OGC Standard.
      Copyright (c) 2012,2014 Open Geospatial Consortium.
      To obtain additional rights of use, visit http://www.opengeospatial.org/legal/ .
    </documentation>
  </annotation>
  <import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd"/>
  <import namespace="http://www.isotc211.org/2005/gmd" schemaLocation="http://schemas.opengis.net/iso/19139/20070417/gmd/gmd.xsd"/>
  <import namespace="http://www.opengis.net/om/2.0" schemaLocation="http://schemas.opengis.net/om/2.0/observation.xsd"/>
  <include schemaLocation="waterml2.xsd"/>

  <!-- The specialised 19115 Metadata type required by OM_Observation/metadata --> 
  <element name="ObservationMetadata" substitutionGroup="gmd:MD_Metadata" type="wml2:ObservationMetadataType">
    <annotation>
      <documentation>Metadata relating to water observation. Specialisation of the ISO19115 MD_Metadata type. </documentation>
    </annotation>
  </element>
  <complexType name="ObservationMetadataType">
    <complexContent>
      <extension base="gmd:MD_Metadata_Type">
        <sequence>
          <element maxOccurs="1" minOccurs="0" name="intendedObservationSpacing" type="duration">
            <annotation>
              <documentation>Defines the expected interval in which observations can be expected. e.g. daily.</documentation>
            </annotation>
          </element>
          <element maxOccurs="1" minOccurs="0" name="status" type="gml:ReferenceType">
            <annotation>
              <documentation>Indicates the statues of the observation. E.g. unreleased, verified etc.</documentation>
            </annotation>
          </element>
          <element maxOccurs="1" minOccurs="0" name="sampledMedium" type="gml:ReferenceType">
            <annotation>
              <documentation>Indicates the medium that was sampled. E.g. water, air, etc.</documentation>
            </annotation>
          </element>
          <element maxOccurs="1" minOccurs="0" name="maximumGap" type="duration">
            <annotation>
              <documentation>
                Defines the allowed gap between series when joining this time series with another. 
              </documentation>
            </annotation>
            </element>
          <element maxOccurs="unbounded" minOccurs="0" name="parameter" type="om:NamedValuePropertyType">
            <annotation>
              <documentation>A soft-typed parameter to allow extension through name-value pairs.</documentation>
            </annotation>
          </element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>
  
  <complexType name="ObservationMetadataPropertyType">
    <sequence minOccurs="0">
      <element ref="wml2:ObservationMetadata"/>
    </sequence>
    <attributeGroup ref="gml:AssociationAttributeGroup"/>
    <attributeGroup ref="gml:OwnershipAttributeGroup"/>
  </complexType>
</schema>
