<?xml version = "1.0" encoding = "UTF-8"?>
<!-- style sheet OFF -->
<!--
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    #
    # Copyright (C) 2003-2011 Open Microscopy Environment
    #       Massachusetts Institute of Technology,
    #       National Institutes of Health,
    #       University of Dundee,
    #       University of Wisconsin at Madison
    #
    # This work is licensed under the
    #       Creative Commons Attribution 3.0 Unported License.
    # To view a copy of this license, visit
    #       http://creativecommons.org/licenses/by/3.0/
    # or send a letter to
    #       Creative Commons, 444 Castro Street, Suite 900,
    #       Mountain View, California, 94041, USA.
    # For attribution instructions, visit
    #       http://www.openmicroscopy.org/info/attribution
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<!--
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	# Written by: Ilya G. Goldberg, Josiah Johnston, Andrew J Patterson 
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<xsd:schema
	targetNamespace = "http://openmicroscopy.com/Schemas/DataHistory/2009-09"
	 xmlns:DH = "http://openmicroscopy.com/Schemas/DataHistory/2009-09"
	 xmlns:xsd = "http://www.w3.org/2001/XMLSchema"
	 xmlns:OME = "http://www.openmicroscopy.org/Schemas/OME/2009-09"
	 version="1"
	 elementFormDefault = "qualified">

	<xsd:import namespace="http://www.openmicroscopy.org/Schemas/OME/2009-09" schemaLocation="http://www.openmicroscopy.org/Schemas/OME/2009-09/ome.xsd"/>

	<xsd:element name = "Input"> <!-- top level definition -->
		<xsd:annotation>
			<xsd:documentation>Identifies a set of attributes that satisfied a formal input.</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:attribute name = "Name" use = "required" type = "xsd:string">
				<xsd:annotation>
					<xsd:documentation>Formal Input name</xsd:documentation>
				</xsd:annotation>
			</xsd:attribute>
			<xsd:attribute name = "ModuleExecutionID" use="optional" type = "xsd:string">
				<xsd:annotation>
					<xsd:documentation>References a module execution that produced the attribute set fed to this input.</xsd:documentation>
				</xsd:annotation>
			</xsd:attribute>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name = "Output"> <!-- top level definition -->
		<xsd:annotation>
			<xsd:documentation>Identifies a set of attributes that were generated by a formal output.</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref = "DH:AttributeRef" minOccurs = "0" maxOccurs = "unbounded"/>
			</xsd:sequence>
			<xsd:attribute name = "Name" use = "required" type = "xsd:string">
				<xsd:annotation>
					<xsd:documentation>Formal Output Name</xsd:documentation>
				</xsd:annotation>
			</xsd:attribute>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name = "AttributeRef"> <!-- top level definition -->
		<xsd:annotation>
			<xsd:documentation>Reference to an attribute.</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:attribute name = "ID" use = "required" type = "xsd:string">
				<xsd:annotation>
					<xsd:documentation>References an attribute by LSID or id local to document.</xsd:documentation>
				</xsd:annotation>
			</xsd:attribute>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name = "ModuleExecution"> <!-- top level definition -->
		<xsd:annotation>
			<xsd: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.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref = "DH:ExecutionHistory" minOccurs="1" maxOccurs="1"/>
				<xsd:element ref = "DH:Input" minOccurs = "0" maxOccurs = "unbounded"/>
				<xsd:element ref = "DH:Output" minOccurs = "0" maxOccurs = "unbounded"/>
			</xsd:sequence>
			<xsd:attribute name = "ID" use = "required" type = "xsd:string"/>
			<xsd:attribute name = "DatasetID" use = "required" type = "OME:DatasetID">
				<xsd:annotation>
					<xsd:documentation>Dataset this was run against.</xsd:documentation>
				</xsd:annotation>
			</xsd:attribute>
			<xsd:attribute name = "ModuleID" use = "required" type = "OME:ModuleID">
				<xsd:annotation>
					<xsd:documentation>References a module by LSID</xsd:documentation>
				</xsd:annotation>
			</xsd:attribute>
			<xsd:attribute name = "Dependence" use = "required">
				<xsd:annotation>
					<xsd:documentation>Module Execution Dependence.</xsd:documentation>
				</xsd:annotation>
				<xsd:simpleType>
					<xsd:restriction base = "xsd:string">
						<xsd:enumeration value = "G"/>
						<xsd:enumeration value = "D"/>
						<xsd:enumeration value = "I"/>
						<xsd:enumeration value = "F"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:attribute>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name = "ExecutionHistory"> <!-- top level definition -->
		<xsd:complexType>
			<xsd:attribute name = "RunTime" use = "required" type = "xsd:string">
				<xsd:annotation>
					<xsd:documentation>How long the module took to run. </xsd:documentation>
				</xsd:annotation>
			</xsd:attribute>
			<xsd:attribute name = "Timestamp" use = "required" type = "xsd:string">
				<xsd:annotation>
					<xsd:documentation>When the module was executed.</xsd:documentation>
				</xsd:annotation>
			</xsd:attribute>
			<xsd:attribute name = "Status" use = "required" type = "xsd:string"/>
			<xsd:attribute name = "ErrorMessage" use="optional" type = "xsd:string"/>
			<xsd:attribute name = "AttributeCreateTime" use="optional" type = "xsd:string"/>
			<xsd:attribute name = "AttributeSortTime" use="optional" type = "xsd:string"/>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name = "DataHistory"> <!-- top level definition -->
		<xsd:annotation>
			<xsd:documentation>Describes all known history of data.</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref = "DH:ModuleExecution" minOccurs="1" maxOccurs = "unbounded"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
</xsd:schema>

