<?xml version="1.0" encoding="UTF-8"?>
<wflow:Workflow xmlns="http://schemas.ggf.org/wflow"
	xmlns:wflow="http://schemas.ggf.org/wflow"
	xmlns:jsdl="http://schemas.ggf.org/jsdl/2005/11/jsdl"
	xmlns:xsi="http://www.w3.org/2001/XMLSchemas-instance">

	<!-- This example is similar to WorkflowExample-1.xml (located at
		 http://www.cs.virginia.edu/~mmm2a/Workflows/WorkflowExample-1.xml).
		 The differences are that we give more then one JSDL template
		 document in this one, the first of which is used to perform some
		 out-of-band initialization.  We indicate this by creating an
		 artificial dependency in the second JSDL document called a flow
		 and then referencing that later in a Workflow node.
	-->
	<jsdl:JobDescription id="prepare-task">
		<!-- The job identification element is standard JSDL and not relevant
			 to this example
		-->
		<jsdl:JobIdentification>
			<jsdl:JobName>One Generator</jsdl:JobName>
			<jsdl:Description>A job which Generates data required for using the fibonacci flow.</jsdl:Description>
		</jsdl:JobIdentification>

		<jsdl:Application>
			<jsdl:ApplicationName>one-generator</jsdl:ApplicationName>
			<!-- In most cases, this element would have other information
				 inside of it (like a POSIXApplication element or
				 HPCApplication element).  We leave it blank here to simplify
				 the example.
			-->
		</jsdl:Application>
	</jsdl:JobDescription>

	<jsdl:JobDescription id="add-task">
		<jsdl:JobIdentification>
			<jsdl:JobName>Adder</jsdl:JobName>
			<jsdl:Description>A job which takes two input values (integers) and produces an output value which is the sum of the inputs.</jsdl:Description>
		</jsdl:JobIdentification>

		<jsdl:Application>
			<jsdl:ApplicationName>adder</jsdl:ApplicationName>
			<!-- Here is where we might place elements for the JSDLPosix
				 extension, or the HPC extension, or something else -->
		</jsdl:Application>

		<jsdl:DataStaging name="input-1">
			<jsdl:FileName>input-1.dat</jsdl:FileName>
			<jsdl:CreationFlag>overwrite</jsdl:CreationFlag>
			<jsdl:Source/>
		</jsdl:DataStaging>

		<jsdl:DataStaging name="input-2">
			<jsdl:FileName>input-2.dat</jsdl:FileName>
			<jsdl:CreationFlag>overwrite</jsdl:CreationFlag>
			<jsdl:Source/>
		</jsdl:DataStaging>

		<jsdl:DataStaging name="output">
			<jsdl:FileName>output.dat</jsdl:FileName>
			<jsdl:CreationFlag>overwrite</jsdl:CreationFlag>
			<jsdl:Target/>
		</jsdl:DataStaging>

		<wflow:DataStream name="foo">
		</wflow:DataStream>
	</jsdl:JobDescription>

	<wflow:Node id="initializer">
		<wflow:JSDL jsdl-ref="prepare-task"/>
	</wflow:Node>

	<wflow:Node id="fib-2">
		<wflow:JSDL jsdl-ref="add-task">
			<wflow:Dependencies>
				<wflow:Dependency node-ref="initializer"/>
			</wflow:Dependencies>

			<wflow:Input data-ref="input-1">
				<wflow:URI>http://tempuri.org/data/one.dat</wflow:URI>
			</wflow:Input>

			<wflow:Input data-ref="input-2">
				<wflow:URI>http://tempuri.org/data/one.dat</wflow:URI>
			</wflow:Input>
		</wflow:JSDL>
	</wflow:Node>

	<wflow:Node id="fib-3">
		<wflow:JSDL jsdl-ref="add-task">
			<wflow:Dependencies>
				<wflow:Dependency node-ref="initializer"/>
			</wflow:Dependencies>

			<wflow:Input data-ref="input-1">
				<wflow:URI>http://tempuri.org/data/one.dat</wflow:URI>
			</wflow:Input>

			<wflow:Input data-ref="input-2">
				<wflow:Node node-ref="fib-2">
					<wflow:Source data-ref="output"/>
				</wflow:Node>
			</wflow:Input>
		</wflow:JSDL>
	</wflow:Node>

	<wflow:Node id="fib-4">
		<wflow:JSDL jsdl-ref="add-task">
			<wflow:Input data-ref="input-1">
				<wflow:Node node-ref="fib-2">
					<wflow:Source data-ref="output"/>
				</wflow:Node>
			</wflow:Input>

			<wflow:Input data-ref="input-2">
				<wflow:Node node-ref="fib-3">
					<wflow:Source data-ref="output"/>
				</wflow:Node>
			</wflow:Input>

			<wflow:Output data-ref="output">
				<wflow:Target>http://tempuri.org/fib-4.dat</wflow:Target>
			</wflow:Output>
		</wflow:JSDL>
	</wflow:Node>

	<wflow:Flows>
		<wflow:Flow node-ref="fib-4"/>
	</wflow:Flows>
</wflow:Workflow>
