<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<!-- Data -->

	<xsd:element name="Data" type="DataType"/>
  <xsd:simpleType name="FloatEncodingType">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="HumanReadable"/>
      <xsd:enumeration value="HexBinary"/>
    </xsd:restriction>
  </xsd:simpleType>                	
<!-- Data Type -->
	<xsd:complexType name="DataType">
	  <xsd:sequence>
        <xsd:element name="FloatEncoding" minOccurs="0" type="FloatEncodingType"/>
		<xsd:element name="Name" type="xsd:string" minOccurs="0"/>
		<xsd:element name="NbSample" type="xsd:positiveInteger"/>
		<!--xsd:element name="NbColumn" type="xsd:positiveInteger"/-->
		<xsd:element name="Format" type="FormatType"/>
		<xsd:element name="DataFilename" type="xsd:string"/>
		<xsd:element name="ListColumn" type="ListColumnType" minOccurs="0">
		  <xsd:unique name="MyColumn">
			<xsd:selector xpath="./Column"/>
			<xsd:field xpath="@Num"/> 
		  </xsd:unique>
		</xsd:element>
	  </xsd:sequence>
	</xsd:complexType>

	<!-- Format Type -->
	<xsd:simpleType name="FormatType">
		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="txt"/>
			<xsd:enumeration value="XML"/>
			<xsd:enumeration value="hdf5"/>		
		</xsd:restriction>
	</xsd:simpleType>
	<!-- End Format Type -->
	
	<!-- ListColumn Type -->	
	<xsd:complexType name="ListColumnType">
		<xsd:sequence>
			<xsd:element name="Column" type="ColumnType" maxOccurs="unbounded">
				<xsd:unique name="MyIndividualName">
					<xsd:selector xpath="./IndividualName"/>
					<xsd:field xpath="@Num"/> 
				</xsd:unique>	
			</xsd:element>
		</xsd:sequence>	
	</xsd:complexType>
	
	<!-- Column Type -->
	<xsd:complexType abstract="true" name="ColumnType">
		<xsd:attribute name="Name" type="xsd:string" use="optional"/>			
		<xsd:attribute name="Num" type="xsd:positiveInteger" use="required"/>
	</xsd:complexType>

	<!-- Derived Column Type -->
	<xsd:complexType name="Quantitative">
		<xsd:complexContent>
			<xsd:extension base="ColumnType"/>				
		</xsd:complexContent>
	</xsd:complexType>
	
	<xsd:complexType name="Qualitative">
		<xsd:complexContent>
			<xsd:extension base="ColumnType">
				<xsd:attribute name="NbFactor" type="xsd:positiveInteger"/>
			</xsd:extension>
		</xsd:complexContent>
	</xsd:complexType>
	
	<xsd:complexType name="Weight">
		<xsd:complexContent>
			<xsd:extension base="ColumnType"/>				
		</xsd:complexContent>
	</xsd:complexType>
	
	<xsd:complexType name="Individual">
		<xsd:complexContent>
			<xsd:extension base="ColumnType">			
				<xsd:sequence>
					<xsd:element name="IndividualName" minOccurs="0" maxOccurs="unbounded">
						<xsd:complexType>
							<xsd:simpleContent>
								<xsd:extension base="xsd:string">
									<xsd:attribute name="Num" type="xsd:positiveInteger" use="required"/>
								</xsd:extension>
							</xsd:simpleContent>
						</xsd:complexType>											
					</xsd:element>					
				</xsd:sequence>
			</xsd:extension>
		</xsd:complexContent>
	</xsd:complexType>
	<!-- End Derived Column Type -->	
<!-- End Column Type -->	
<!-- End ListColumn Type -->

<!-- List Factor Name Type -->	
	<xsd:complexType name="ListFactorNameType">
		<xsd:sequence>
			<xsd:element name="FactorName" minOccurs="0" maxOccurs="unbounded">
				<xsd:complexType>
					<xsd:simpleContent>
						<xsd:extension base="xsd:string">
							<xsd:attribute name="Num" type="xsd:positiveInteger" use="required"/>
						</xsd:extension>					
					</xsd:simpleContent>					
				</xsd:complexType>
			</xsd:element>
		</xsd:sequence>
	</xsd:complexType>
	<!-- End List Factor Name Type -->
<!-- End Data Type -->

<!-- Data -->

</xsd:schema>
