<?xml version="1.0" encoding="UTF-8"?>
<!--
  This document provides a schema for representing a request
  for network measurement data. It is based on the draft
  document Requirements for a measurment request
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.ggf.org/namespaces/2004/09/gridNetworkMonitoring" xmlns:tns="http://www.ggf.org/namespaces/2004/09/gridNetworkMonitoring">
  <xs:include schemaLocation="nm_subject.xsd"/>
  <xs:include schemaLocation="nm_params.xsd"/>
  <xs:include schemaLocation="nm_tool.xsd"/>
  <xs:include schemaLocation="nm_timeinfo.xsd"/>
  <xs:include schemaLocation="nm_statistic.xsd"/>
  <xs:include schemaLocation="nm_extend.xsd"/>
  <xs:element name="networkMeasurementRequest" type="tns:NetworkMeasurementRequest"/>
  <xs:complexType name="NetworkMeasurementRequest">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" ref="tns:request"/>
    </xs:sequence>
    <xs:attribute name="version" type="xs:token"/>
  </xs:complexType>
  <xs:element name="request" type="tns:Request"/>
  <xs:complexType name="Request">
    <xs:sequence>
      <xs:element ref="tns:characteristic"/>
      <xs:element ref="tns:subject"/>
      <xs:element minOccurs="0" ref="tns:methodology"/>
      <xs:element minOccurs="0" ref="tns:statistics"/>
    </xs:sequence>
    <xs:attribute name="maxResults">
      <xs:annotation>
        <xs:documentation>The maximum number of measurements to be returned</xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:union memberTypes="xs:token xs:positiveInteger"/>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="allowNewMeasurements" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>If false, new measurements should not be made to satisfy this request</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="reportEverything" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>If true, everything that can be reported, should be, otherwise individual report attributes are used.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>
  <xs:element name="characteristic" type="xs:token">
    <xs:annotation>
      <xs:documentation>The requested characteristic</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:element name="subject">
    <xs:annotation>
      <xs:documentation>The subject of the measurement(s) to be returned</xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:choice>
        <xs:element ref="tns:node"/>
        <xs:element ref="tns:path"/>
      </xs:choice>
      <xs:attributeGroup ref="tns:Report"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="node" type="tns:Node"/>
  <xs:element name="path" type="tns:Path"/>
  <xs:element name="methodology" type="tns:Methodology">
    <xs:annotation>
      <xs:documentation>The methodology to employ</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:element name="statistics" type="tns:Statistics">
    <xs:annotation>
      <xs:documentation>A request for statistics to be returned</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Methodology">
    <xs:sequence>
      <xs:element minOccurs="0" ref="tns:endpoint"/>
      <xs:element minOccurs="0" ref="tns:tool"/>
      <xs:element minOccurs="0" ref="tns:when"/>
      <xs:element minOccurs="0" maxOccurs="unbounded" ref="tns:parameterSet"/>
    </xs:sequence>
  </xs:complexType>
  <xs:element name="endpoint" type="tns:Endpoint">
    <xs:annotation>
      <xs:documentation>The endpoint to which the parameters apply FIXME: does this work?</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:element name="tool" type="tns:Tool">
    <xs:annotation>
      <xs:documentation>The measurement(s) should have been made using this tool, if this element is present</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:element name="when" type="tns:TimeInformation">
    <xs:annotation>
      <xs:documentation>The measurement(s) must have been made in this time period</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:element name="parameterSet" type="tns:ParameterSet">
    <xs:annotation>
      <xs:documentation>Tool parameters</xs:documentation>
    </xs:annotation>
  </xs:element>
  <!--
    Enumerations break wsdl2spy
    Endpoint = token "source" | token "destination" | token "all" | token "none"
  -->
  <xs:simpleType name="Endpoint">
    <xs:restriction base="xs:token"/>
  </xs:simpleType>
  <!-- This is a global declaration as "required" will be used all over the place -->
  <xs:attributeGroup name="Required">
    <xs:annotation>
      <xs:documentation>If true, the appropriate parameter is required to be the given value. The default is false.</xs:documentation>
    </xs:annotation>
    <xs:attribute name="required" type="xs:boolean"/>
  </xs:attributeGroup>
  <!-- This is a global declaration as "report" will be used all over the place -->
  <xs:attributeGroup name="Report">
    <xs:annotation>
      <xs:documentation>If true, the appropriate parameter should be reported in the response. The default is not(networkMeasurementRequest/request#reportEverything)</xs:documentation>
    </xs:annotation>
    <xs:attribute name="report" type="xs:boolean"/>
  </xs:attributeGroup>
</xs:schema>

