<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <!-- Created by Carlton Vaz 1.3.2008 --> 

  <!-- definition of simple elements -->	
  <xsd:element name="proteinsequence" type="xsd:string" />
  <xsd:element name="aminoacid" type="xsd:string" />
  <xsd:element name="image" type="xsd:string" />
  <xsd:element name="mustbepresent" type="present" />
  <xsd:element name="mustbeabsent" type="absent" />

  <!-- definition of attributes -->	
  <xsd:attribute name="templateid" type="xsd:string" />
  <xsd:attribute name="motifid" type="xsd:string" />
  <xsd:attribute name="phenotypeid" type="xsd:string" />
  <xsd:attribute name="imageid" type="xsd:string" />
  <xsd:attribute name="speciesid" type="xsd:string" />
  
  <!-- defininition of complex elements -->	
  <xsd:complexType name="templates">
    <xsd:sequence>
      <xsd:element ref="template" />
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="template">
    <xsd:sequence>
      <xsd:element ref="proteinsequence" />
    </xsd:sequence>
    <xsd:attribute ref="templateid" use="required"/>
  </xsd:complexType>

  <xsd:complexType name="restrictions">
    <xsd:sequence>
      <xsd:element name="mustbepresent" type="present"/>
      <xsd:element name="mustbeabsent" type="absent"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="present">
    <xsd:sequence>
      <xsd:element ref="aminoacid" />
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="absent">
    <xsd:sequence>
      <xsd:element ref="aminoacid" />
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="motifs">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="motif" type="motifdefinition"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="motifdefinition">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="templates"/>
        <xsd:element ref="restrictions"/>
      </xsd:sequence>
      <xsd:attribute ref="motifid" use="required"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="phenotypes">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="motifs" minOccurs="2" maxOccurs="2"/>
        <xsd:element ref="image" use="required"/>
      </xsd:sequence>
     <xsd:attribute ref="phenotypeid" use="required"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="species">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="templates"/>
        <xsd:element ref="motifs"/>
        <xsd:element ref="phenotypes"/>
      </xsd:sequence>
      <xsd:attribute ref="speciesid" use="required"/>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>
