<?xml version="1.0" encoding="UTF-8"?>
<!-- edited by Jerome LAURET (Brookhaven National Laboratories) -->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <xsd:element name="AbstractRequest">
                <xsd:annotation>
                        <xsd:documentation>A group of requests and a description of how the requests are organized into
a logical sequence of events (AND, OR, XOR, etc ... relationship) as well
as datasets which may be used by requests</xsd:documentation>
                </xsd:annotation>
                <xsd:complexType>
                        <xsd:choice maxOccurs="unbounded">
                                <xsd:element ref="Request"/>
                                <xsd:element ref="Task"/>
                                <xsd:element ref="Application"/>
                                <xsd:element ref="Dataset" minOccurs="0"/>
                                <xsd:element ref="ResourceSpecifications" minOccurs="0"/>
                                <xsd:element name="WorkFlow">
                                        <xsd:annotation>
                                                <xsd:documentation>MergeRequests { id=[xs:ID] }
                RequestID { idref=[xs:IDref] }
                ....
ChooseBetweenRequests { id=[xs:ID] }
                RequestID { idref=[xs:IDref] }
        SetupRequestDependancy { id=[xs:ID] }
                RequestToBeDoneFirstID { idref=[xs:IDref] }
                RequestWaitingForInputID { idref=[xs:IDref] }
</xsd:documentation>
                                        </xsd:annotation>
                                </xsd:element>
                        </xsd:choice>
                </xsd:complexType>
        </xsd:element>
        <xsd:element name="Request">
                <xsd:annotation>
                        <xsd:documentation>For easier handling of initialization, end-task garbagge collection and task
wrap up, we may want to define initialization/finalization special requests.
Those could be defined once, and re-used for every job generated by a
single request.
Also, there may be a need to do a unique request (taks) for all jobs (not
for each jobs).</xsd:documentation>
                </xsd:annotation>
                <xsd:complexType>
                        <xsd:sequence>
                                <xsd:element name="RequestName" minOccurs="0"/>
                                <xsd:element name="RequestDescription" minOccurs="0"/>
                                <xsd:element name="OutputHandling" minOccurs="0">
                                        <xsd:annotation>
                                                <xsd:documentation>This element may be removed later (only a placeholder for later considertaion).
Ideally, outputs are themselves datasets and currentely, input/output are
non-symetrical.</xsd:documentation>
                                        </xsd:annotation>
                                        <xsd:complexType>
                                                <xsd:choice maxOccurs="unbounded">
                                                        <xsd:element name="Copy">
                                                                <xsd:complexType>
                                                                        <xsd:sequence>
                                                                                <xsd:element name="Source"/>
                                                                                <xsd:element name="Destination"/>
                                                                        </xsd:sequence>
                                                                </xsd:complexType>
                                                        </xsd:element>
                                                        <xsd:element name="Register"/>
                                                </xsd:choice>
                                        </xsd:complexType>
                                </xsd:element>
                        </xsd:sequence>
                        <xsd:attribute name="ID" type="xsd:ID"/>
                        <xsd:attribute name="taskRef" type="xsd:IDREF" use="required"/>
                        <xsd:attribute name="appRef" type="xsd:IDREF" use="required"/>
                        <xsd:attribute name="datasetRef" type="xsd:IDREF" use="optional"/>
                        <xsd:attribute name="resourceRef" type="xsd:IDREF" use="optional"/>
                </xsd:complexType>
        </xsd:element>
        <!-- Basic application: it defines a name and a version. -->
        <xsd:element name="Application" type="applicationType">
                <xsd:annotation>
                        <xsd:documentation>Example: A XXTask will depend (or reference) a XXX aplication. Purpose
is to allow versionning. </xsd:documentation>
                </xsd:annotation>
        </xsd:element>
        <xsd:complexType name="applicationType">
                <xsd:attribute name="ID" type="xsd:ID" use="required"/>
                <xsd:attribute name="type" type="xsd:string" use="optional"/>
                <xsd:attribute name="name" type="xsd:string" use="required"/>
                <xsd:attribute name="ver" type="xsd:string" use="optional"/>
        </xsd:complexType>
        <!-- -->
        <!-- Basic tasks are being implemented as extension of a basic type taskType-->
        <xsd:element name="Task" type="taskType">
                <xsd:annotation>
                        <xsd:documentation>In the newly proposed U-JDL, application and task are merged.</xsd:documentation>
                </xsd:annotation>
        </xsd:element>
        <xsd:complexType name="taskType">
                <xsd:sequence>
                        <xsd:element name="STDIN" type="xsd:anyURI" minOccurs="0"/>
                        <xsd:element name="STDOUT" type="xsd:anyURI" minOccurs="0"/>
                        <xsd:element name="STDERR" type="xsd:anyURI" minOccurs="0"/>
                </xsd:sequence>
                <xsd:attribute name="ID" type="xsd:ID" use="required"/>
                <xsd:attribute name="type" type="xsd:string" use="optional"/>
        </xsd:complexType>
        <!-- Implementation example 1: Script Task  -->
        <xsd:complexType name="scriptTaskType">
                <xsd:complexContent>
                        <xsd:extension base="taskType">
                                <xsd:sequence>
                                        <xsd:element name="Script">
                                                <xsd:complexType>
                                                        <xsd:simpleContent>
                                                                <xsd:extension base="xsd:string"/>
                                                        </xsd:simpleContent>
                                                </xsd:complexType>
                                        </xsd:element>
                                        <xsd:element name="Arguments" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
                                </xsd:sequence>
                        </xsd:extension>
                </xsd:complexContent>
        </xsd:complexType>
        <xsd:element name="ScriptTask" type="scriptTaskType" substitutionGroup="Task"/>
        <!-- Implementation example 2: Java task. Java requires preparation -->
        <xsd:complexType name="javaTaskType">
                <xsd:complexContent>
                        <xsd:extension base="taskType">
                                <xsd:sequence>
                                        <xsd:element name="ClassName" type="xsd:anyURI">
                                                <xsd:annotation>
                                                        <xsd:documentation>Either a jar or a class name</xsd:documentation>
                                                </xsd:annotation>
                                        </xsd:element>
                                        <xsd:element name="Jar" type="xsd:anyURI">
                                                <xsd:annotation>
                                                        <xsd:documentation>The location of the JAR file containing the main class</xsd:documentation>
                                                </xsd:annotation>
                                        </xsd:element>
                                        <xsd:element name="Arguments" type="xsd:string" minOccurs="0" maxOccurs="unbounded">
                                                <xsd:annotation>
                                                        <xsd:documentation>The arguments to use to execute the JAR file.</xsd:documentation>
                                                </xsd:annotation>
                                        </xsd:element>
                                        <xsd:element name="ClassPath" type="xsd:anyURI" minOccurs="0"/>
                                </xsd:sequence>
                        </xsd:extension>
                </xsd:complexContent>
        </xsd:complexType>
        <xsd:element name="JavaTask" type="javaTaskType" substitutionGroup="Task"/>
        <!-- -->
        <!-- Basic dataset.
TODO: is still unclear if the type should be there and how should be used -->
        <xsd:element name="Dataset">
                <xsd:annotation>
                        <xsd:documentation>Below, some ideas from DIAL

Dataset{        identity=[xs:ID],
                mutability=[locked,appending],
                location=[virtual,logical,physical,staged,mixed],
                composite=[xs:boolean] }
Contentlist
                ContentKey { type=[xs:string]
</xsd:documentation>
                </xsd:annotation>
                <xsd:complexType>
                        <xsd:complexContent>
                                <xsd:extension base="datasetType"/>
                        </xsd:complexContent>
                </xsd:complexType>
        </xsd:element>
        <xsd:complexType name="datasetType">
                <xsd:attribute name="ID" type="xsd:ID" use="required"/>
                <xsd:attribute name="type" type="xsd:string" use="optional"/>
        </xsd:complexType>
        <!-- Basic extra.
TODO: a better name would be required for this -->
        <xsd:complexType name="fileType">
                <xsd:simpleContent>
                        <xsd:extension base="xsd:string">
                                <xsd:attribute name="fileName" type="xsd:anyURI" use="required"/>
                        </xsd:extension>
                </xsd:simpleContent>
        </xsd:complexType>
        <!-- File List type. This type can be used for both datasets that consists of a list of files,
but also in those task that need to specify a list of files.-->
        <xsd:complexType name="filelistType">
                <xsd:sequence>
                        <xsd:element name="file" type="xsd:anyURI" maxOccurs="unbounded"/>
                </xsd:sequence>
        </xsd:complexType>
        <!-- Physical file dataset. This dataset consists of a pure list of physical files. -->
        <xsd:element name="physicalDataset" type="physicalDatasetType" substitutionGroup="Dataset"/>
        <xsd:complexType name="physicalDatasetType">
                <xsd:complexContent>
                        <xsd:extension base="datasetType">
                                <xsd:sequence>
                                        <xsd:element name="datafiles" type="filelistType"/>
                                </xsd:sequence>
                        </xsd:extension>
                </xsd:complexContent>
        </xsd:complexType>
        <!-- Logical file dataset. This dataset consists of a list of logical files and a catalog
identifier that will be used to resolve the names. -->
        <xsd:element name="logicalDataset" type="logicalDatasetType" substitutionGroup="Dataset"/>
        <xsd:complexType name="logicalDatasetType">
                <xsd:complexContent>
                        <xsd:extension base="datasetType">
                                <xsd:sequence>
                                        <xsd:element name="catalog" type="xsd:string"/>
                                        <xsd:element name="datafiles" type="filelistType"/>
                                </xsd:sequence>
                        </xsd:extension>
                </xsd:complexContent>
        </xsd:complexType>
        <!-- -->
        <!-- Resource specifications will provide input to Schedulers as per how much 
the request will be consuming -->
        <!-- InputResource and OutputResource will have several implementations to clearly indentify the quanta we deal with-->
        <xsd:element name="ResourceSpecifications">
                <xsd:complexType>
                        <xsd:sequence>
                                <xsd:element ref="MemoryPerProcess" minOccurs="0"/>
                                <xsd:element ref="InputResource" minOccurs="0"/>
                                <xsd:element ref="OutputResource" minOccurs="0"/>
                                <xsd:element name="Time"/>
                                <xsd:any namespace="##any" minOccurs="0" maxOccurs="unbounded">
                                        <xsd:annotation>
                                                <xsd:documentation>The number of resource requirements may change in future.</xsd:documentation>
                                        </xsd:annotation>
                                </xsd:any>
                        </xsd:sequence>
                </xsd:complexType>
        </xsd:element>
        <xsd:complexType name="resourceType">
                <xsd:sequence>
                        <xsd:choice>
                                <xsd:sequence>
                                        <xsd:element name="MininumUnitsRequired" type="xsd:long" minOccurs="0">
                                                <xsd:annotation>
                                                        <xsd:documentation>Minimum may be used for dispatching purposes. A process will not start unless the available resource is above this minimum.</xsd:documentation>
                                                </xsd:annotation>
                                        </xsd:element>
                                        <xsd:element name="MaximumUnitsEstimated" type="xsd:long" minOccurs="0">
                                                <xsd:annotation>
                                                        <xsd:documentation>If unspecified, there are no known upper limits. If specified, this value indicates that the job will use this value as  maximum quanta of the resource will be taken.</xsd:documentation>
                                                </xsd:annotation>
                                        </xsd:element>
                                </xsd:sequence>
                                <xsd:element name="UnitsPerSeconds" type="xsd:long">
                                        <xsd:annotation>
                                                <xsd:documentation>Rate estimated by the user for his request.</xsd:documentation>
                                        </xsd:annotation>
                                </xsd:element>
                        </xsd:choice>
                        <xsd:element name="AverageSizeOfUnit" type="xsd:float">
                                <xsd:annotation>
                                        <xsd:documentation>In MB</xsd:documentation>
                                </xsd:annotation>
                        </xsd:element>
                </xsd:sequence>
        </xsd:complexType>
        <xsd:element name="MemoryPerProcess" type="resourceType">
                <xsd:annotation>
                        <xsd:documentation>Total Memory (Virtual + RAM). Distinction is not relevant to users ??</xsd:documentation>
                </xsd:annotation>
        </xsd:element>
        <xsd:element name="InputResource" type="resourceType">
                <xsd:annotation>
                        <xsd:documentation>In SUMS, we implemented a numFilesPerHour. This gave an indication of
the input rate for a request. The request would then be split into sub-jobs
according to available resources (CPUtime limit associated to a queue). A
job would end up with 100 files each for example ... while the dataset would
be of several 1000 files. BUT, input may be implemented with a different
concept than files. For example, input can be events, tracks, gene
sequence, etc ... This tries to generalize the idea.</xsd:documentation>
                </xsd:annotation>
        </xsd:element>
        <!--InputResource  - extensions of resourceType - They may be extended types-->
        <xsd:element name="InputFiles" type="resourceType" substitutionGroup="InputResource"/>
        <xsd:element name="InputTracks" type="resourceType" substitutionGroup="InputResource"/>
        <xsd:element name="InputEvents" type="resourceType" substitutionGroup="InputResource"/>
        <xsd:element name="OutputResource" type="resourceType">
                <xsd:annotation>
                        <xsd:documentation>Symetric of input ... Note that the type of storage is not specified here (like
if the storage is NFS, AFS, Db, etc ...). The rate combined with the unit
size will obviously limit the possibilities of where the jobs can run. This
implies that this resource alone may map to several low-level JDL
requirements (TransferRate, Type from the StorageDevice element
in Glue CE, or event connection speed if we speak of db)</xsd:documentation>
                </xsd:annotation>
        </xsd:element>
        <!-- All below elements are extensions of  resourceType - Note that they may be extended-->
        <xsd:element name="OutputFiles" type="resourceType" substitutionGroup="OutputResource"/>
        <xsd:element name="OutputTracks" type="resourceType" substitutionGroup="OutputResource"/>
        <xsd:element name="OutputEvents" type="resourceType" substitutionGroup="OutputResource"/>
</xsd:schema>