<?xml version="1.0" encoding="UTF-8"?><!-- $Id: UWS.xsd,v 1.6 2008/10/01 11:54:02 pah Exp $ --><!-- proposal for basic UWS schema - Paul Harrison May 2008 --><!-- 

$Log: UWS.xsd,v $
Revision 1.6  2008/10/01 11:54:02  pah
fix up cvs header

Revision 1.5  2008/09/25 00:22:35  pah
change termination time to execution duration

 --><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:uws="http://www.ivoa.net/xml/UWS/v0.9.2" xmlns:xlink="http://www.w3.org/1999/xlink" targetNamespace="http://www.ivoa.net/xml/UWS/v0.9.2" elementFormDefault="qualified" attributeFormDefault="unqualified">
   <xs:import namespace="http://www.w3.org/1999/xlink" schemaLocation="http://software.astrogrid.org/schema/stc/STC/v1.30/XLINK.xsd"/>
   <!--
      <xs:import namespace="http://www.w3.org/1999/xlink"
      schemaLocation="http://www.ivoa.net/xml/Xlink/xlink.xsd"/>
   -->
   <xs:complexType name="ShortJobDescription">
      <xs:sequence>
         <xs:element ref="uws:phase"/>
      </xs:sequence>
      <xs:attribute name="id" type="uws:JobIdentifier" use="required"/>
      <xs:attributeGroup ref="uws:reference"/>
   </xs:complexType>
   <xs:attributeGroup name="reference">
      <xs:annotation>
         <xs:documentation>standard xlink references</xs:documentation>
      </xs:annotation>
      <xs:attribute ref="xlink:type" use="optional" default="simple"/>
      <xs:attribute ref="xlink:href" use="optional"/>
   </xs:attributeGroup>
   <xs:simpleType name="ExecutionPhase">
      <!--
         need to think a little here about the implication of allowing a
         "re-entrant" application that is capable of running
         mini-jobs...probably this is indicated with a different state
         varible entirely
      -->
      <xs:annotation>
         <xs:documentation>
            Enumeration of possible phases of job execution
         </xs:documentation>
      </xs:annotation>
      <xs:restriction base="xs:string">
         <xs:enumeration value="PENDING">
            <xs:annotation>
               <xs:documentation>
                  The first phase a job is entered into - this is where a job is being set up but no request to run has occurred.
               </xs:documentation>
            </xs:annotation>
         </xs:enumeration>
         <xs:enumeration value="QUEUED">
            <xs:annotation>
               <xs:documentation>
                  An job has been accepted for execution but is waiting
                  in a queue
               </xs:documentation>
            </xs:annotation>
         </xs:enumeration>
         <xs:enumeration value="EXECUTING">
            <xs:annotation>
               <xs:documentation>An job is running</xs:documentation>
            </xs:annotation>
         </xs:enumeration>
         <xs:enumeration value="COMPLETED">
            <xs:annotation>
               <xs:documentation>
                  An job has completed successfully
               </xs:documentation>
            </xs:annotation>
         </xs:enumeration>
         <xs:enumeration value="ERROR">
            <xs:annotation>
               <xs:documentation>
                  Some form of error has occurred
               </xs:documentation>
            </xs:annotation>
         </xs:enumeration>
         <xs:enumeration value="UNKNOWN">
            <xs:annotation>
               <xs:documentation>
                  The job is in an unknown state
               </xs:documentation>
            </xs:annotation>
         </xs:enumeration>
         <xs:enumeration value="HELD">
            <xs:annotation>
               <xs:documentation>
                  The job is HELD pending execution and will not
                  automatically be executed (cf pending)
               </xs:documentation>
            </xs:annotation>
         </xs:enumeration>
         <xs:enumeration value="SUSPENDED">
            <xs:annotation>
               <xs:documentation>
                  The job has been suspended by the system during
                  execution
               </xs:documentation>
            </xs:annotation>
         </xs:enumeration>
         <xs:enumeration value="ABORTED">
            <xs:annotation>
               <xs:documentation>
                  The job has been aborted, either by user request or by the server because of lack or overuse of resources.
               </xs:documentation>
            </xs:annotation>
         </xs:enumeration>
      </xs:restriction>
   </xs:simpleType>
   <xs:complexType name="JobSummary">
      <xs:sequence>
         <xs:element name="jobId" type="uws:JobIdentifier"/>
         <xs:element ref="uws:phase"/>
         <xs:element ref="uws:quote" maxOccurs="1" minOccurs="0"/>
         <xs:element name="startTime" type="xs:dateTime" nillable="true"/>
         <xs:element name="endTime" type="xs:dateTime" nillable="true"/>
         <xs:element ref="uws:executionDuration"/>
         <xs:element ref="uws:destruction"/>
         <xs:element name="errorSummary" type="uws:ErrorSummary" maxOccurs="1" minOccurs="0"/>
      </xs:sequence>
   </xs:complexType>
   <xs:simpleType name="JobIdentifier">
      <xs:annotation>
         <xs:documentation>
            The identifier for the job
         </xs:documentation>
      </xs:annotation>
      <xs:restriction base="xs:string"/>
   </xs:simpleType>
   <xs:element name="job" type="uws:JobSummary">
      <xs:annotation>
         <xs:documentation>
            This is the information that is returned when a GET is made
            for a single job resource - i.e. /(jobs)/(jobid)
         </xs:documentation>
      </xs:annotation>
   </xs:element>
   <xs:element name="phase" type="uws:ExecutionPhase">
      <xs:annotation>
         <xs:documentation>
            the execution phase - returned at /(jobs)/(jobid)/phase
         </xs:documentation>
      </xs:annotation>
   </xs:element>
   <xs:element name="quote" type="xs:dateTime" nillable="true">
      <xs:annotation>
         <xs:documentation>
            A Quote predicts when the job is likely to complete - returned at /(jobs)/(jobid)/quote
            TODO - how to encode "don't know"
         </xs:documentation>
      </xs:annotation>
   </xs:element>
   <xs:element name="executionDuration" type="xs:int" nillable="false">
   <!-- TODO look if xs:duration here has any benefits -->
      <xs:annotation>
         <xs:documentation>
            The duration (in seconds) for which the job should be allowed to run - a value of 0 is intended to mean unlimited - returned at /(jobs)/(jobid)/executionduration
         </xs:documentation>
      </xs:annotation>
   </xs:element>
   <xs:element name="destruction" type="xs:dateTime" nillable="true">
      <xs:annotation>
         <xs:documentation>
            The time at which the whole job + records + results will be destroyed. returned at /(jobs)/(jobid)/destruction
         </xs:documentation>
      </xs:annotation>
   </xs:element>
   <xs:element name="jobList">
      <xs:annotation>
         <xs:documentation>
              The list of job references returned at /(jobs)
           </xs:documentation>
      </xs:annotation>
      <xs:complexType>
         <xs:annotation>
            <xs:documentation>
                  ISSUE - do we want to have any sort of paging or
                  selection mechanism in case the job list gets very
                  large? Or is that an unnecessary complication...
               </xs:documentation>
         </xs:annotation>
         <xs:sequence>
            <xs:element name="jobref" type="uws:ShortJobDescription" maxOccurs="unbounded" minOccurs="0"/>
         </xs:sequence>
      </xs:complexType>
   </xs:element>
   <xs:complexType name="ResultReference">
      <xs:annotation>
         <xs:documentation>
            A reference to a UWS result
         </xs:documentation>
      </xs:annotation>
      <xs:sequence>
         <xs:element ref="uws:phase" maxOccurs="1" minOccurs="0"/><!-- TODO why is this here - pah? -->
      </xs:sequence>
      <xs:attribute name="id" type="xs:string" use="required"/>
      <xs:attributeGroup ref="uws:reference"/>
   </xs:complexType>
   <xs:element name="resultList">
      <xs:annotation>
         <xs:documentation>
              The element returned for /(jobs)/(jobid)/results
           </xs:documentation>
      </xs:annotation>
      <xs:complexType>
         <xs:sequence>
            <xs:element name="result" type="uws:ResultReference" maxOccurs="unbounded" minOccurs="0"/>
         </xs:sequence>
      </xs:complexType>
   </xs:element>
   <xs:complexType name="ErrorSummary">
      <xs:annotation>
         <xs:documentation>
            A short summary of the error
         </xs:documentation>
      </xs:annotation>
      <xs:sequence>
         <xs:element name="message" type="xs:string"/>
         <xs:element name="detail" maxOccurs="1" minOccurs="0">
            <xs:complexType>
               <xs:attributeGroup ref="uws:reference"/>
            </xs:complexType>
         </xs:element>
      </xs:sequence>
      <xs:attribute name="type" type="uws:ErrorType">
         <xs:annotation>
            <xs:documentation>characterization of the type of the error</xs:documentation>
         </xs:annotation>
      </xs:attribute>
   </xs:complexType>
   <xs:simpleType name="ErrorType">
      <xs:restriction base="xs:string">
         <xs:enumeration value="transient"/>
         <xs:enumeration value="fatal"/>
      </xs:restriction>
   </xs:simpleType>
</xs:schema><!--

 -->