<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:vr="http://www.ivoa.net/xml/VOResource/v1.0"
           xmlns:slap="http://www.ivoa.net/xml/SLAP/v1.0"
           xmlns:vm="http://www.ivoa.net/xml/VOMetadata/v0.1"
           targetNamespace="http://www.ivoa.net/xml/SLAP/v1.0"
           elementFormDefault="unqualified" attributeFormDefault="unqualified"
           version="1.1">

   <!--
	First version 09/09/09
	Authors: Jesus Salgado/Aurelien Stebe (ESAVO)
     -->
   <xs:annotation>
      <xs:appinfo>
        <vm:schemaName>SLAP</vm:schemaName>
        <vm:schemaPrefix>xs</vm:schemaPrefix>
        <vm:targetPrefix>slap</vm:targetPrefix>
      </xs:appinfo>
      <xs:documentation>
        XML Schema used to describe the capabilities of a service instance
        conforming to the Simple Line Access Protocol (SLAP).
      </xs:documentation>
   </xs:annotation>

   <xs:import namespace="http://www.ivoa.net/xml/VOResource/v1.0"
   	schemaLocation="http://docs.g-vo.org/schemata/VOResource.xsd"/>

   <!-- SLAP Capabilities -->
   <xs:complexType name="SimpleLineAccess">
      <xs:annotation>
         <xs:documentation>
            The capabilities of an SLAP service implementation.
         </xs:documentation>
      </xs:annotation>

      <xs:complexContent>
         <xs:extension base="vr:Capability">
            <xs:sequence>

               <xs:element name="complianceLevel" type="slap:ComplianceLevel">
                  <xs:annotation>
                     <xs:documentation>
                        The category indicating the level to which this
                        service instance complies with the SLAP standard.
                     </xs:documentation>
                     <xs:documentation>
                        Allowed values are "minimal" and "full".
                        See definitions of allowed values for details.
                     </xs:documentation>
                  </xs:annotation>
               </xs:element>

               <xs:element name="dataSource" type="slap:DataSource">
                  <xs:annotation>
                     <xs:documentation>
                        The category specifying where the data accessed by
			the service originally came from.
                     </xs:documentation>
                     <xs:documentation>
                        Allowed values are "observational/astrophysical",
			"observational/laboratory", "theoretical"
                     </xs:documentation>
                  </xs:annotation>
               </xs:element>

               <xs:element name="maxRecords" type="xs:positiveInteger"
                           minOccurs="0" maxOccurs="1">
                  <xs:annotation>
                     <xs:documentation>
                        The hard limit on the largest number of records that
                        the query operation will return in a single response.
                        Not providing this value means that there is no
                        effective limit.
                     </xs:documentation>
                     <xs:documentation>
                        This does not refer to the total number of spectra in
                        the archive but rather maximum number of records the
                        service is capable of returning.  A limit that is
                        greater than the number of spectra available in the
                        archive is equivalent to their being no effective
                        limit.  (See RM, Hanisch 2007.)
                     </xs:documentation>
                  </xs:annotation>
               </xs:element>

               <xs:element name="testQuery" type="slap:Query"
                           minOccurs="0" maxOccurs="1">
                  <xs:annotation>
                     <xs:documentation>
                        A set of queryData parameters that is expected to
			produce at least one matched record which can be
                        used to test the service.
                     </xs:documentation>
                     <xs:documentation>
		        The value should include all parameters required
			for the test query but should exclude the baseURL
			and the REQUEST parameter.
                     </xs:documentation>
                  </xs:annotation>
               </xs:element>

            </xs:sequence>
         </xs:extension>
      </xs:complexContent>
   </xs:complexType>

   <xs:simpleType name="ComplianceLevel">
      <xs:annotation>
         <xs:documentation>
            The allowed values for indicating the level at which a service
	    instance complies with the SLAP standard.
         </xs:documentation>
      </xs:annotation>

      <xs:restriction base="xs:token">
         <xs:enumeration value="minimal">
            <xs:annotation>
               <xs:documentation>
                  The service supports all of the capabilities and features
                  of the SLAP protocol identified as "must" in the
                  specification.
               </xs:documentation>
               <xs:documentation>
                  In brief, this includes:
                    * implementing the GET interface,
                    * WAVELENGTH, REQUEST for input query,
		    * ssldm:Line.wavelength.value and ssldm:Line.title for output
		    fields
                    * supports the "FORMAT=METADATA" metadata query.
               </xs:documentation>
            </xs:annotation>
         </xs:enumeration>

         <xs:enumeration value="full">
            <xs:annotation>
               <xs:documentation>
                  The service supports, at a minimum, all of the capabilities
		  and features of the SLAP protocol identified as "must" or
		  "should" in the specification.
               </xs:documentation>
            </xs:annotation>
         </xs:enumeration>
      </xs:restriction>
   </xs:simpleType>

   <xs:simpleType name="DataSource">
      <xs:annotation>
         <xs:documentation>
           The defined categories that specify where the line data
           originally came from, i.e., the type of data collections to
	   which the service provides access.
         </xs:documentation>
      </xs:annotation>

      <xs:restriction base="xs:token">
         <xs:enumeration value="observational/astrophysical">
            <xs:annotation>
               <xs:documentation>
                 Lines observed and identified in real spectra of
		 astrophysical observations by different
		 instrument/projects
               </xs:documentation>
            </xs:annotation>
         </xs:enumeration>

         <xs:enumeration value="observational/laboratory">
            <xs:annotation>
               <xs:documentation>
                 Lines observed and identified in real spectra of
		 laboratory measurements
               </xs:documentation>
            </xs:annotation>
         </xs:enumeration>

         <xs:enumeration value="theoretical">
            <xs:annotation>
               <xs:documentation>
		 Servers containing theoretical spectral lines
               </xs:documentation>
            </xs:annotation>
         </xs:enumeration>

      </xs:restriction>
   </xs:simpleType>

   <xs:complexType name="Query">
      <xs:annotation>
         <xs:documentation>
            A query to be sent to the service, e.g., a test query.
         </xs:documentation>
      </xs:annotation>

      <xs:sequence>
         <xs:element name="wavelength" type="slap:WavelengthRange" minOccurs="0">
            <xs:annotation>
               <xs:documentation>
                  Spectral range in meters to be used to constrain the query
		  of spectral lines.
               </xs:documentation>
            </xs:annotation>
         </xs:element>

         <xs:element name="queryDataCmd" type="xs:string" minOccurs="0">
            <xs:annotation>
               <xs:documentation>
                   Fully specified queryData test query formatted as an URL
		   argument list in the syntax specified by the SLAP standard.
                   The list must exclude the REQUEST argument which is
                   assumed to be set to "queryData".  VERSION may be
		   included if the test query applies to a specific version
		   of the service protocol.
               </xs:documentation>
               <xs:documentation>
		   If queryDataCmd is used to form a query, the default
		   value of WAVELENGTH specified above is not
		   used; if the test query requires WAVELENGTH it
		   should be included directly in queryDataCmd.
               </xs:documentation>
               <xs:documentation>
                   This value must be a string in the form of name=value
                   pairs delimited with ampersands (&amp;).  A query may
		   then be formed by appending to the baseURL the request
		   argument, "REQUEST=queryData&amp;", followed by the
		   contents of this element.
               </xs:documentation>
            </xs:annotation>
         </xs:element>
      </xs:sequence>
   </xs:complexType>

   <xs:complexType name="WavelengthRange">
      <xs:annotation>
         <xs:documentation>
            Spectral range in meters to be used to constrain the query
	    of spectral lines
         </xs:documentation>
      </xs:annotation>

      <xs:sequence>
         <xs:element name="minWavelength" type="xs:double" minOccurs="0">
            <xs:annotation>
               <xs:documentation>
                  Minimum wavelength in meters to be used to constrain the query
	    	  of spectral lines
               </xs:documentation>
            </xs:annotation>
         </xs:element>

         <xs:element name="maxWavelength" type="xs:double" minOccurs="0">
            <xs:annotation>
               <xs:documentation>
                  Maximum wavelength in meters to be used to constrain the query
	    	  of spectral lines
               </xs:documentation>
            </xs:annotation>
         </xs:element>
      </xs:sequence>
   </xs:complexType>

</xs:schema>
