<?xml version = "1.0" encoding = "UTF-8"?>
<!--
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	#
	# Copyright (C) 2003-2008 Open Microscopy Environment
	#       Massachusetts Institute of Technology,
	#       National Institutes of Health,
	#       University of Dundee,
	#       University of Wisconsin at Madison
	#
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<!--
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	# Written by: Ilya G. Goldberg, Josiah Johnston, Andrew J Patterson 
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<schema xmlns = "http://www.w3.org/2001/XMLSchema"
	targetNamespace = "http://openmicroscopy.com/Schemas/DataHistory/2008-02"
	 xmlns:DH = "http://openmicroscopy.com/Schemas/DataHistory/2008-02"
	 xmlns:xsd = "http://www.w3.org/2001/XMLSchema"
	 xmlns:OME = "http://www.openmicroscopy.org/Schemas/OME/2008-02"
	 version="1"
	 elementFormDefault = "qualified">
	<import namespace = "http://www.openmicroscopy.org/Schemas/OME/2008-02" schemaLocation = "http://www.openmicroscopy.org/Schemas/OME/2008-02/ome.xsd"/>
	<element name = "Input">
		<annotation>
			<documentation>Identifies a set of attributes that satisfied a formal input.</documentation>
		</annotation>
		<complexType>
			<attribute name = "Name" use = "required" type = "string">
				<annotation>
					<documentation>Formal Input name</documentation>
				</annotation>
			</attribute>
			<attribute name = "ModuleExecutionID" type = "string">
				<annotation>
					<documentation>References a module execution that produced the attribute set fed to this input.</documentation>
				</annotation>
			</attribute>
		</complexType>
	</element>
	<element name = "Output">
		<annotation>
			<documentation>Identifies a set of attributes that were generated by a formal output.</documentation>
		</annotation>
		<complexType>
			<sequence>
				<element ref = "DH:AttributeRef" minOccurs = "0" maxOccurs = "unbounded"/>
			</sequence>
			<attribute name = "Name" use = "required" type = "string">
				<annotation>
					<documentation>Formal Output Name</documentation>
				</annotation>
			</attribute>
		</complexType>
	</element>
	<element name = "AttributeRef">
		<annotation>
			<documentation>Reference to an attribute.</documentation>
		</annotation>
		<complexType>
			<attribute name = "ID" use = "required" type = "string">
				<annotation>
					<documentation>References an attribute by LSID or id local to document.</documentation>
				</annotation>
			</attribute>
		</complexType>
	</element>
	<element name = "ModuleExecution">
		<annotation>
			<documentation>Describes the data dependency of a module run. ModuleRun is meant to describe the relationships a module run creates, not the specifics of its execution. A Module may in fact have been executed more than once. Isolating execution specifics from the relationship allows us to acknowledge that multiple executions occured without storing two copies of their identical output.
Non-deterministic modules may have only one ExecutionHistory per ModuleRun because their results are not guaranteed to be the same for identical inputs.
			</documentation>
		</annotation>
		<complexType>
			<sequence>
				<element ref = "DH:ExecutionHistory"/>
				<element ref = "DH:Input" minOccurs = "0" maxOccurs = "unbounded"/>
				<element ref = "DH:Output" minOccurs = "0" maxOccurs = "unbounded"/>
			</sequence>
			<attribute name = "ID" use = "required" type = "string"/>
			<attribute name = "DatasetID" use = "required" type = "OME:DatasetID">
				<annotation>
					<documentation>Dataset this was run against.</documentation>
				</annotation>
			</attribute>
			<attribute name = "ModuleID" use = "required" type = "OME:ModuleID">
				<annotation>
					<documentation>References a module by LSID</documentation>
				</annotation>
			</attribute>
			<attribute name = "Dependence" use = "required">
				<annotation>
					<documentation>Module Execution Dependence.</documentation>
				</annotation>
				<simpleType>
					<restriction base = "string">
						<enumeration value = "G"/>
						<enumeration value = "D"/>
						<enumeration value = "I"/>
						<enumeration value = "F"/>
					</restriction>
				</simpleType>
			</attribute>
		</complexType>
	</element>
	<element name = "ExecutionHistory">
		<complexType>
			<attribute name = "RunTime" use = "required" type = "string">
				<annotation>
					<documentation>How long the module took to run. </documentation>
				</annotation>
			</attribute>
			<attribute name = "Timestamp" use = "required" type = "string">
				<annotation>
					<documentation>When the module was executed.</documentation>
				</annotation>
			</attribute>
			<attribute name = "Status" use = "required" type = "string"/>
			<attribute name = "ErrorMessage" type = "string"/>
			<attribute name = "AttributeCreateTime" type = "string"/>
			<attribute name = "AttributeSortTime" type = "string"/>
		</complexType>
	</element>
	<element name = "DataHistory">
		<annotation>
			<documentation>Describes all known history of data.</documentation>
		</annotation>
		<complexType>
			<sequence>
				<element ref = "DH:ModuleExecution" maxOccurs = "unbounded"/>
			</sequence>
		</complexType>
	</element>
</schema>
