<?xml version="1.0" encoding="US-ASCII"?>
<xs:schema targetNamespace="http://www.ebi.ac.uk/ADFConverter" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ADFConv="http://www.ebi.ac.uk/ADFConverter">
	<!-- Document type definition-->
	<xs:element name="documentStructure" type="ADFConv:documentStructureType">
		<xs:annotation>
			<xs:documentation> data structure in a or several files</xs:documentation>
		</xs:annotation>
	</xs:element>
	<xs:complexType name="documentStructureType">
		<xs:annotation>
			<xs:documentation>definition of a data document: can contain several data table (in several files) </xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="files">
				<xs:annotation>
				<xs:documentation> set of one or sereral data files</xs:documentation>
			</xs:annotation>
				<xs:complexType>
					<xs:sequence>
						<xs:element name="file" type="ADFConv:FileType" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<!-- File Type definition -->
	<xs:complexType name="FileType">
		<xs:annotation>
			<xs:documentation> definition of a file</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="dataSet">
				<xs:annotation>
					<xs:documentation> set of data contained in a file or spreadsheet</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:sequence>
						<xs:element name="data" type="ADFConv:DataType" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="extension" type="xs:string" use="required"/>
		<xs:attribute name="name" type="xs:string" default=" "/>
		<xs:attribute name="fileFormat" type="ADFConv:fileFormatType" use="required"/>
	</xs:complexType>
	<xs:simpleType name="fileFormatType">
		<xs:annotation>
			<xs:documentation>type of file format : text or workbook , the only file format supported.</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:enumeration value="text"/>
			<xs:enumeration value="workbook"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="TableOrientationType">
		<xs:annotation>
			<xs:documentation>Orientation of the data table : horizontal (default) - vertical</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:enumeration value="horizontal"/>
			<xs:enumeration value="vertical"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="DataType">
		<xs:annotation>
			<xs:documentation>structure of data: can be composed of several table</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="tables">
			<xs:annotation>
				<xs:documentation> set of data tables (at least one)</xs:documentation>
			</xs:annotation>
				<xs:complexType>
					<xs:sequence>
						<xs:element name="table" type="ADFConv:tableType" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="name" type="xs:string"/>
		<xs:attribute name="tableDelimiter" type="xs:string"/>
		<xs:attribute name="dataFormat" type="ADFConv:dataFormatType" use="required"/>
	</xs:complexType>
	<xs:simpleType name="dataFormatType">
		<xs:annotation>
			<xs:documentation>Format of data : tabular or worksheet </xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:enumeration value="tabular"/>
			<xs:enumeration value="spreadsheet"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="tableType">
		<xs:annotation>
			<xs:documentation>structure of datatable: can have a header</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="header" type="ADFConv:headerType" minOccurs="0"/>
		</xs:sequence>
		<xs:attribute name="name" type="xs:string"/>
		<xs:attribute name="sheetNumber" type="xs:int"/>
		<xs:attribute name="dataDelimiter" type="xs:string" default=""/>
		<xs:attribute name="orientation" type="ADFConv:TableOrientationType" default="horizontal"/>
		<xs:attribute name="haveHeader" type="xs:boolean" default="true"/>
	</xs:complexType>
	<xs:element name="filer" type="ADFConv:FileType">
		<xs:annotation>
			<xs:documentation>data file strucuture definition</xs:documentation>
		</xs:annotation>
	</xs:element>
	<!-- Header definition -->
	<xs:complexType name="headerType">
		<xs:annotation>
			<xs:documentation>Header list Structure: contains item</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="items">
				<xs:annotation>
					<xs:documentation>set of header items, describing  the table structure</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:sequence>
						<xs:element name="item" type="ADFConv:ItemType" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
				<!--	 <xs:key name="ID">
						  <xs:selector xpath="item"/>
						  <xs:field xpath="@mame"/>
					</xs:key>
					<xs:keyref name="IDREF" refer="ID">
						  <xs:selector xpath="item/itemDependence/itemref|item/itemDependence/location/previousColumns/previousColumn"/>
      <xs:field xpath="@ref"/>
    </xs:keyref>-->
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<xs:element name="itemTemp" type="ADFConv:ItemType"/>
	<xs:complexType name="CheckRuleType">
		<xs:annotation>
			<xs:documentation>Rule for checking: using pattern to identify items</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="regex">
				<xs:annotation>
					<xs:documentation> regulax expression used for identification</xs:documentation>
				</xs:annotation>
				<xs:simpleType>
					<xs:restriction base="xs:string">
						<xs:pattern value="[^/].+[^/]"/>
						<xs:pattern value="/.+/"/>
						<!--		<xs:pattern value="\slash .+\slash"/>-->
					</xs:restriction>
				</xs:simpleType>
			</xs:element>
			<xs:element name="description" type="xs:string" minOccurs="0">
				<xs:annotation>
					<xs:documentation> description of the rule, will be displayed in the tool</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="CardinalityType">
		<xs:annotation>
			<xs:documentation>Cardinality of an item or value in a field Represent by a minimal occur and a maximal</xs:documentation>
		</xs:annotation>
		<xs:attribute name="lowerBound" type="xs:nonNegativeInteger" use="required"/>
		<xs:attribute name="upperBound" type="xs:int" default="-1"/>
		<!-- integer from 0 to 126789 shoulb enough-->
		<!--<xs:restriction base="xs:string">
			<xs:pattern value="\d\.\.\d{1,}"/>
		</xs:restriction>-->
	</xs:complexType>
	<xs:complexType name="SubNameType">
		<xs:annotation>
			<xs:documentation>Definition for the subname of the item</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="type" type="ADFConv:SubNameTypeName" minOccurs="0"/>
			<xs:element name="constraints" minOccurs="0">
				<xs:complexType>
					<xs:annotation>
						<xs:documentation>list of constraints, that should match the  item subname </xs:documentation>
					</xs:annotation>
					<xs:sequence>
						<xs:element name="constraint" type="ADFConv:ConstraintType" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="prefixDelimiter" type="xs:string" use="required"/>
		<xs:attribute name="suffixDelimiter" type="xs:string"/>
	</xs:complexType>
	<!--<xs:attribute name="maxOccurs" type="maxOccurs_type" default="1"/>	-->
	<xs:complexType name="ItemType">
		<xs:annotation>
			<xs:documentation> an header item with characteristic of it for checking</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="relaxCheckRules" minOccurs="0">
				<xs:annotation>
					<xs:documentation> list of  relax rules: relax checking mode,  the different possibilities for the item </xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:sequence>
						<xs:element name="relaxCheck" type="ADFConv:CheckRuleType" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="strictCheck" type="ADFConv:CheckRuleType">
				<xs:annotation>
					<xs:documentation> a unique rule, exactly matching the specification</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="itemType" type="xs:string">
				<xs:annotation>
					<xs:documentation> name  of the item type </xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="exactName" type="xs:string">
			<xs:annotation>
				<xs:documentation> exact name, according to the specification, that should have the item</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="fieldValueType" type="ADFConv:FieldType">
				<xs:annotation>
					<xs:documentation> characterics of associated fields</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="cardinality" type="ADFConv:CardinalityType">
				<xs:annotation>
				<xs:documentation>Cardinality of the item in the table header (how many time it is supposed to be present in the header)</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="fieldCardinality" type="ADFConv:CardinalityType">
					<xs:annotation>
				<xs:documentation>Cardinality of associated field in the table  (how many time it is supposed to be present in a row)</xs:documentation>
				</xs:annotation>
				</xs:element>
			<xs:element name="location" type="ADFConv:LocationType">
					<xs:annotation>
				<xs:documentation>Location of the item in the header</xs:documentation>
				</xs:annotation>
				</xs:element>
			<xs:element name="multiplicity" type="xs:boolean" default="false" minOccurs="0">
				<xs:annotation>
					<xs:documentation>if multiplicity of values in a associatd field </xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="valueFieldSeparator" type="xs:string" default=";" minOccurs="0">
				<xs:annotation>
					<xs:documentation>separator of values in a field, if multiplicity possible</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="innerValueFieldSeparator" type="xs:string" minOccurs="0">
				<xs:annotation>
					<xs:documentation>innerseparator of values in a field, if a value can contained several data</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="fieldDependence" minOccurs="0">
				<xs:annotation>
					<xs:documentation>defines dependance between field</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:sequence>
						<xs:element name="itemref" type="xs:IDREF" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
				<!--	<xs:key name="itemUnique">
								<xs:selector xpath="."/>
								<xs:field xpath="@name"/>
							</xs:key>-->
			</xs:element>
			<xs:element name="subNames" minOccurs="0">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="subName" type="ADFConv:SubNameType" maxOccurs="unbounded"/>
						<!-- for now, only one is handle by the application -->
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="simpleMicroarrayLayoutRelatedItem" type="xs:IDREF" minOccurs="0"/>
		</xs:sequence>
		<xs:attribute name="name" type="xs:ID" use="required"/>
		<xs:attribute name="element" type="xs:string" default="default"/>
	</xs:complexType>
	<xs:complexType name="FieldType">
		<xs:annotation>
			<xs:documentation>Specifies the field value type and constraints</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="typeName" type="ADFConv:fieldTypeName"/>
			<xs:element name="constraints" minOccurs="0">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="constraint" type="ADFConv:ConstraintType" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<xs:simpleType name="fieldTypeName">
		<xs:annotation>
			<xs:documentation>type of the field value :  : a free text, a controlled vocabulary, a date...</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:enumeration value="Integer"/>
			<xs:enumeration value="Free Text"/>
			<xs:enumeration value="Website address"/>
			<xs:enumeration value="Email"/>
			<xs:enumeration value="Controlled vocabulary"/>
			<xs:enumeration value="MGED ontology term"/>
			<xs:enumeration value="Date"/>
			<xs:enumeration value="DatabaseEntry"/>
			<xs:enumeration value="Sequence"/>
			<xs:enumeration value="Species"/>
			<xs:enumeration value="Regex"/>
			<xs:enumeration value="Other"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="SubNameTypeName">
		<xs:annotation>
			<xs:documentation>type of the subname of a header item :   a database tag, a group tag, e...</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:enumeration value="Database Tag"/>
			<xs:enumeration value="Group Tag"/>
			<xs:enumeration value="Other"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="LocationType">
		<xs:annotation>
			<xs:documentation>type of the field value : : a free text, a controlled vocabulary, a date...</xs:documentation>
		</xs:annotation>
		<xs:choice>
			<xs:element name="columNumber" type="xs:int"/>
			<xs:element name="previousColumns">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="previousColumn" type="xs:IDREF" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
		</xs:choice>
	</xs:complexType>
	<xs:element name="header" type="ADFConv:headerType">
		<xs:annotation>
			<xs:documentation> list of header item of data table contained in a file</xs:documentation>
		</xs:annotation>
	</xs:element>
	<xs:complexType name="ConstraintType">
		<xs:sequence>
			<xs:element name="rule" type="ADFConv:CheckRuleType"/>
			<xs:element name="curatedValue" type="xs:string" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
</xs:schema>
