<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2018 EMBL - European Bioinformatics Institute
  ~ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
  ~ file except in compliance with the License. You may obtain a copy of the License at
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~ Unless required by applicable law or agreed to in writing, software distributed under the
  ~ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  ~ CONDITIONS OF ANY KIND, either express or implied. See the License for the
  ~ specific language governing permissions and limitations under the License.
  -->

<!-- version:1.5.61 -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:com="SRA.common">
  <xs:import schemaLocation="SRA.common.xsd" namespace="SRA.common"/>

  <xs:complexType name="SampleType">
    <xs:annotation>
      <xs:documentation>
        A Sample defines an isolate of sequenceable material upon which
        sequencing experiments can be based.  The Sample object may be a surrogate for taxonomy
        accession or an anonymized individual identifier.  Or, it may fully specify
        provenance and isolation method of the starting material.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="com:ObjectType">
        <xs:sequence>
          <xs:element name="TITLE" type="xs:string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>
           Short text that can be used to call out sample records in search results or in displays.
         </xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="SAMPLE_NAME">
            <xs:complexType>
              <xs:all minOccurs="1">
                <xs:element name="TAXON_ID" minOccurs="1" maxOccurs="1" type="xs:int">
                  <xs:annotation>
                    <xs:documentation>
                  NCBI Taxonomy Identifier.  This is appropriate for individual organisms and
                  some environmental samples.
                </xs:documentation>
                  </xs:annotation>
                </xs:element>
                <xs:element name="SCIENTIFIC_NAME" minOccurs="0" maxOccurs="1" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                  Scientific name of sample that distinguishes its taxonomy.  Please use a 
                  name or synonym that is tracked in the INSDC Taxonomy database. 
                  Also, this field can be used to confirm the TAXON_ID setting.
                </xs:documentation>
                  </xs:annotation>
                </xs:element>
                <xs:element name="COMMON_NAME" minOccurs="0" maxOccurs="1" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                  GenBank common name of the organism.  Examples: human, mouse.
                </xs:documentation>
                  </xs:annotation>
                </xs:element>
              </xs:all>
              <xs:attribute name="display_name" type="xs:string"/>
            </xs:complexType>
          </xs:element>
          <xs:element name="DESCRIPTION" type="xs:string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>
            Free-form text describing the sample, its origin, and its method of isolation.
          </xs:documentation>
            </xs:annotation>
          </xs:element>


          <xs:element name="SAMPLE_LINKS" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>
            Links to resources related to this sample or sample set (publication, datasets, online databases).
          </xs:documentation>
            </xs:annotation>
            <xs:complexType>
              <xs:sequence minOccurs="1" maxOccurs="unbounded">
                <xs:element name="SAMPLE_LINK" type="com:LinkType"/>
              </xs:sequence>
            </xs:complexType>
          </xs:element>

          <xs:element name="SAMPLE_ATTRIBUTES" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>
            Properties and attributes of a sample.  These can be entered as free-form 
            tag-value pairs. For certain studies, submitters may be asked to follow a
            community established ontology when describing the work.
          </xs:documentation>
            </xs:annotation>
            <xs:complexType>
              <xs:sequence maxOccurs="unbounded" minOccurs="1">
                <xs:element name="SAMPLE_ATTRIBUTE" type="com:AttributeType"/>

              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="SampleSetType">
    <xs:sequence minOccurs="1" maxOccurs="unbounded">
      <xs:element name="SAMPLE" type="SampleType"/>
    </xs:sequence>
  </xs:complexType>

  <xs:element name="SAMPLE_SET" type="SampleSetType">
    <xs:annotation>
      <xs:documentation>
        SAMPLE_SET serves as a container for a set of samples and a name space
        for establishing referential integrity between them. 
      </xs:documentation>
    </xs:annotation>

  </xs:element>

  <xs:element name="SAMPLE" type="SampleType"/>

</xs:schema>
