datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes" 
namespace xhtml = "http://www.w3.org/1999/xhtml"


include "common.rnc"

start = JobState

#---------------------------------------------------------------#
#                     Mobyle JobState Definition                #
#---------------------------------------------------------------#

JobState = element jobState {
	#this part describes the elements specific to the file that stores job information
	element name {xsd:anyURI}&
	#name is the url of the program invoked to run the job 
	element host {xsd:anyURI}&
	#host is the host server of the job
	element id {xsd:anyURI}&
	#id is the job identifier
	element date {xsd:token}&
	#date on which the job has been submitted on the server
	element status{
		element value{
			"building"|"submitted"|"pending"|"running"|"finished"|"error"
			|"killed"|"hold"|"finishing"
		}&
		element message{text}?
	}&
	Email?&
	element sessionKey {text}?&
	element workflowId {text}?&
	element data{
		Input*&
		Output*
	}?&
	(
    	(
    	    # this is the "program specific" part of the "job state"
        	## parameter files
        	element paramFiles {
        		File*
        	}?&
        	## generated command line
        	element commandLine{text}?
    	)
    	|
    	(
    	    # this is the "workflow specific" part of the "job state"
        	element jobLink{
        	 attribute taskRef {xsd:anyURI}&
        	 attribute jobId {xsd:anyURI}
        	} 
    	)
	)
}

Input = element input{
	Parameter&
	((File&
	  element fmtProgram {text}?&
	  element formattedFile{
			FileContent
	  	}?)
	  |element value {text})
}

Output = element output{
	Parameter&
	File*
}

File = element file{
	FileContent
}

FileContent = (
	attribute size{xsd:positiveInteger}?&
	attribute fmt{xsd:string}?&
	attribute origName{xsd:string}&
	text
)