<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
            targetNamespace="http://lifemapper.org" 
            xmlns:lm="http://lifemapper.org" 
            elementFormDefault="qualified">
   <xsd:annotation>
      <xsd:documentation>
         Schema definition for Lifemapper service POST requests.
         Version: 1.0
         Author: CJ Grady
         Contact: lifemapper@ku.edu
      </xsd:documentation>
   </xsd:annotation>
   <xsd:element name="request" type="lm:requestType" />
   <xsd:complexType name="requestType">
      <xsd:annotation>
         <xsd:documentation>
            The type of post request, the options are:
               * algoParamSet
               * experiment
               * occurrenceSet
               * scenario
         </xsd:documentation>
      </xsd:annotation>
      <xsd:choice>
         <xsd:element name="algoParamsSet" 
                      type="lm:algoParamsSetType" 
                      maxOccurs="1" 
                      minOccurs="0" />
                      
         <xsd:element name="experiment" 
                      type="lm:experimentType" 
                      maxOccurs="1" 
                      minOccurs="0" />
                      
         <xsd:element name="occurrenceSet" 
                      type="lm:occurrenceSetType" 
                      maxOccurs="1" 
                      minOccurs="0" />
         
         <xsd:element name="scenario"
                      type="lm:scenarioType"
                      maxOccurs="1"
                      minOccurs="0" />
      </xsd:choice>
   </xsd:complexType>
   <xsd:complexType name="occurrenceSetType">
      <xsd:sequence>
         <xsd:element name="displayName" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="1" />
         
         <xsd:element name="name"
                      type="xsd:string"
                      maxOccurs="1"
                      minOccurs="1" />

         <xsd:element name="points" 
                      type="lm:pointsType" 
                      maxOccurs="1" 
                      minOccurs="1" />
      </xsd:sequence>
   </xsd:complexType>
   <xsd:complexType name="scenarioType">
      <xsd:annotation>
         <xsd:documentation>
            Schema for Lifemapper Scenario post requests.
         </xsd:documentation>
      </xsd:annotation>
      <xsd:all>
         <xsd:element name="code"
                      type="xsd:string"
                      maxOccurs="1"
                      minOccurs="1">
            <xsd:annotation>
               <xsd:documentation>
                  The code to be used for the climate scenario
               </xsd:documentation>
            </xsd:annotation>
         </xsd:element>
         <xsd:element name="title"
                      type="xsd:string"
                      maxOccurs="1"
                      minOccurs="1">
            <xsd:annotation>
               <xsd:documentation>
                  The title to be used for the climate scenario.  This will be
                  displayed when the layer is returned in listing results.
               </xsd:documentation>
            </xsd:annotation>
         </xsd:element>
         <xsd:element name="author"
                      type="xsd:string"
                      maxOccurs="1"
                      minOccurs="0">
            <xsd:annotation>
               <xsd:documentation>
                  The author of the climate scenario.
               </xsd:documentation>
            </xsd:annotation>
         </xsd:element>
         <xsd:element name="startDate"
                      type="xsd:string"
                      maxOccurs="1"
                      minOccurs="0">
            <xsd:annotation>
               <xsd:documentation>
                  Specifies the start of the date range that the scenario's
                  climate layer values were measured.  The format of this 
                  parameter should be ISO 8601.
               </xsd:documentation>
            </xsd:annotation>
         </xsd:element>
         <xsd:element name="endDate"
                      type="xsd:string"
                      maxOccurs="1"
                      minOccurs="0">
            <xsd:annotation>
               <xsd:documentation>
                  Specifies the end of the date range that the scenario's
                  climate layer values were measured.  The format of this
                  parameter should be ISO 8601.
               </xsd:documentation>
            </xsd:annotation>
         </xsd:element>
         <xsd:element name="units"
                      type="xsd:string"
                      maxOccurs="1"
                      minOccurs="1">
            <xsd:annotation>
               <xsd:documentation>
                  Specifies the units used when specifying the size of each 
                  cell.  Common values are dd (for decimal degrees) or m (for
                  meters).
               </xsd:documentation>
            </xsd:annotation>
         </xsd:element>
         <xsd:element name="epsgCode"
                      type="xsd:string"
                      maxOccurs="1"
                      minOccurs="1">
            <xsd:annotation>
               <xsd:documentation>
                  Specifies the EPSG code of the projection performed on each
                  raster.
               </xsd:documentation>
            </xsd:annotation>
         </xsd:element>
         <xsd:element name="description"
                      type="xsd:string"
                      maxOccurs="1"
                      minOccurs="0">
            <xsd:annotation>
               <xsd:documentation>
                  The description of the climate scenario.  This can be used to
                  provide additional explanation of data.
               </xsd:documentation>
            </xsd:annotation>
         </xsd:element>
         <xsd:element name="resolution"
                      type="xsd:string"
                      maxOccurs="1"
                      minOccurs="0">
            <xsd:annotation>
               <xsd:documentation>
                  Sets the resolution for the climate scenario.
               </xsd:documentation>
            </xsd:annotation>
         </xsd:element>
         <xsd:element name="keywords"
                      type="lm:keywordsType"
                      maxOccurs="1"
                      minOccurs="0">
            <xsd:annotation>
               <xsd:documentation>
                  Container for climate scenario keywords.
               </xsd:documentation>
            </xsd:annotation>
         </xsd:element>
         <xsd:element name="layers"
                      type="lm:layersType"
                      maxOccurs="1"
                      minOccurs="1">
            <xsd:annotation>
               <xsd:documentation>
                  Container for climate scenario layers.
               </xsd:documentation>
            </xsd:annotation>
         </xsd:element>
      </xsd:all>
   </xsd:complexType>
   <xsd:complexType name="layersType">
      <xsd:annotation>
         Schema for scenario layers.
      </xsd:annotation>
      <xsd:all>
         <xsd:element name="layer"
                      type="xsd:string"
                      maxOccurs="unbounded"
                      minOccurs="1">
            <xsd:annotation>
               <xsd:documentation>
                  The Lifemapper id number of a layer to add to the climate 
                  scenario.
               </xsd:documentation>
            </xsd:annotation>
         </xsd:element>
      </xsd:all>
   </xsd:complexType>
   <xsd:complexType name="keywordsType">
      <xsd:annotation>
         Schema for scenario keywords.
      </xsd:annotation>
      <xsd:all>
         <xsd:element name="keyword"
                      type="xsd:string"
                      maxOccurs="unbounded"
                      minOccurs="0">
            <xsd:annotation>
               <xsd:documentation>
                  Specifies a keyword to be associated with a scenario.
               </xsd:documentation>
            </xsd:annotation>
         </xsd:element>
      </xsd:all>
   </xsd:complexType>
   <xsd:complexType name="experimentType">
      <xsd:annotation>
         <xsd:documentation>
            Schema for Lifemapper Experiments requests.
         </xsd:documentation>
      </xsd:annotation>
      <xsd:all>
         <xsd:element name="algorithmCode"
                      type="xsd:string"
                      maxOccurs="1"
                      minOccurs="1" />
         <xsd:element name="parameters" 
                       type="lm:algoParametersType" 
                       maxOccurs="1" 
                       minOccurs="0" />
         <xsd:element name="modelScenario" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="1" >
            <xsd:annotation>
               <xsd:documentation>
                  This is the id number of the Lifemapper model scenario.
               </xsd:documentation>
            </xsd:annotation>
         </xsd:element>
         <xsd:element name="occurrenceSetId" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="1" >
            <xsd:annotation>
               <xsd:documentation>
                  This is the id number of the Lifemapper occurrence set.
               </xsd:documentation>
            </xsd:annotation>
         </xsd:element>
         <xsd:element name="projectionScenarios" 
                      type="lm:projectionScenariosType" 
                      maxOccurs="1" 
                      minOccurs="1">
            <xsd:annotation>
               <xsd:documentation>
                  This is a group of Lifemapper projection scenarios.
               </xsd:documentation>
            </xsd:annotation>
         </xsd:element>
      </xsd:all>
   </xsd:complexType>
   <xsd:complexType name="algoParamsSetType">
      <xsd:sequence>
          <xsd:element name="algorithmCode" 
                       type="xsd:string" 
                       maxOccurs="1" 
                       minOccurs="1" />
          <xsd:element name="parameters" 
                       type="lm:algoParametersType" 
                       maxOccurs="1" 
                       minOccurs="0" />
      </xsd:sequence>
   </xsd:complexType>
   <xsd:complexType name="algorithm">
      <xsd:sequence>
         <xsd:element name="algorithmCode"
                      type="xsd:string"
                      maxOccurs="1"
                      minOccurs="1" />
          <xsd:element name="parameters" 
                       type="lm:algoParametersType" 
                       maxOccurs="1" 
                       minOccurs="0" />
      </xsd:sequence>
   </xsd:complexType>
   <xsd:complexType name="pointsType">
       <xsd:sequence>
          <xsd:element name="point" 
                       type="lm:pointType" 
                       maxOccurs="unbounded" 
                       minOccurs="0" />
       </xsd:sequence>
   </xsd:complexType>
   <xsd:complexType name="pointType">
      <xsd:attribute name="localId"         type="xsd:string" />
      <xsd:attribute name="longitude"       type="xsd:float" />
      <xsd:attribute name="latitude"        type="xsd:float" />
      <xsd:attribute name="canonicalName"   type="xsd:string" />
      <xsd:attribute name="catalogNum"      type="xsd:string" />
      <xsd:attribute name="collectionCode"  type="xsd:string" />
      <xsd:attribute name="collectionDate"  type="xsd:string" />
      <xsd:attribute name="collector"       type="xsd:string" />
      <xsd:attribute name="guid"            type="xsd:string" />
      <xsd:attribute name="institutionCode" type="xsd:string" />
      <xsd:attribute name="modTime"         type="xsd:string" />
      <xsd:attribute name="providerName"    type="xsd:string" />
      <xsd:attribute name="resourceName"    type="xsd:string" />
   </xsd:complexType>
   <xsd:complexType name="algoParametersType">
      <xsd:all>
         <xsd:element name="choice" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />
                      
         <xsd:element name="coef0" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="commissionsamplesize" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="commissionthreshold" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="convergencelimit" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="cost" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="degree" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="distance" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="distancetype" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="epoch" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="gamma" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="gaussianpriorsmoothingcoeficient" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="hardomissionthreshold" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="hiddenlayerneurons" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="hingefeature" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="kerneltype" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="learningrate" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="linearfeature" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="maxgenerations" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="maxthreads" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="mincomponents" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="minimumerror" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="modelsunderomissionthreshold" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="momentum" 
                      type="xsd:string" 
                      maxOccurs="1"
                      minOccurs="0" />

         <xsd:element name="nearpointstogetmean" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="nu" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="numberofiterations" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="numberofpseudoabsences" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="populationsize" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="probabilisticoutput" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="productfeature" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="quadraticfeature" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="randomisations" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="resamples" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="standarddeviationcutoff" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="standarddeviations" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="svmtype" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="thresholdfeature" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="terminatetolerance" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="totalruns" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="trainingmethod" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="trainingproportion" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="usedepthrange" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="usedistancetoland" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="useiceconcentration" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="useprimaryproduction" 
                      type="xsd:string"
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="usesalinity" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="usesurfacelayers" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="usetemperature" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

         <xsd:element name="verbosedebugging" 
                      type="xsd:string" 
                      maxOccurs="1" 
                      minOccurs="0" />

      </xsd:all>
   </xsd:complexType>
   <xsd:complexType name="projectionScenariosType">
      <xsd:sequence>
         <xsd:element name="projectionScenario" 
                      type="xsd:string" 
                      maxOccurs="unbounded" 
                      minOccurs="0" >
            <xsd:annotation>
               <xsd:documentation>
                  This is the id number of the Lifemapper projection scenario.
               </xsd:documentation>
            </xsd:annotation>
         </xsd:element>
      </xsd:sequence>
   </xsd:complexType>
</xsd:schema>
