<?xml version="1.0" encoding="UTF-8"?>
<xs:schema version="1.1" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://rs.tdwg.org/dwc/xsd/simpledarwincore/"
    xmlns:dcterms="http://purl.org/dc/terms/"
    xmlns:dwr="http://rs.tdwg.org/dwc/xsd/simpledarwincore/"
    xmlns:dwc="http://rs.tdwg.org/dwc/terms/">
    <xs:import namespace="http://rs.tdwg.org/dwc/terms/" schemaLocation="tdwg_dwc_extensions.xsd"/>
    <xs:import namespace="http://purl.org/dc/terms/" schemaLocation="dublin_core.xsd"/>
    
    <xs:annotation>
        <xs:documentation>
            This schema defines Simple Darwin Core records and record sets using the
            terms from namespace http://rs.tdwg.org/dwc/terms/. This schema allows the 
            terms listed to appear exactly once in any order.
        </xs:documentation>
    </xs:annotation>
    
    <xs:element name="SimpleDarwinRecordSet" >
        <xs:annotation>
            <xs:documentation>Simple container to encode multiple darwin core records 
                that have no notion of which class they are. They can therefore represent 
                a taxon, an observation or just a locality, for example.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="dwr:SimpleDarwinRecord" maxOccurs="unbounded" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    
    <!-- SAMPLE domain -->
    <xs:element name="SimpleDarwinRecord">
        <xs:complexType>
            <xs:all>
                <!-- Record-level terms -->
                <xs:element ref="dcterms:type" minOccurs="0"/>
                <xs:element ref="dcterms:modified" minOccurs="0"/>
                <xs:element ref="dcterms:language" minOccurs="0"/>
                <xs:element ref="dcterms:rights" minOccurs="0"/>
                <xs:element ref="dcterms:rightsHolder" minOccurs="0"/>
                <xs:element ref="dcterms:accessRights" minOccurs="0"/>
                <xs:element ref="dcterms:bibliographicCitation" minOccurs="0"/>
                <xs:element ref="dcterms:references" minOccurs="0"/>
                <xs:element ref="dwc:institutionID" minOccurs="0"/>
                <xs:element ref="dwc:collectionID" minOccurs="0"/>
                <xs:element ref="dwc:datasetID" minOccurs="0"/>
                <xs:element ref="dwc:institutionCode" minOccurs="0"/>
                <xs:element ref="dwc:collectionCode" minOccurs="0"/>
                <xs:element ref="dwc:datasetName" minOccurs="0"/>
                <xs:element ref="dwc:ownerInstitutionCode" minOccurs="0"/>
                <xs:element ref="dwc:basisOfRecord" minOccurs="0"/>
                <xs:element ref="dwc:informationWithheld" minOccurs="0"/>
                <xs:element ref="dwc:dataGeneralizations" minOccurs="0"/>
                <xs:element ref="dwc:dynamicProperties" minOccurs="0"/>
                <!-- Occurrence terms -->
                <xs:element ref="dwc:occurrenceID" minOccurs="0"/>
                <xs:element ref="dwc:catalogNumber" minOccurs="0"/>
                <xs:element ref="dwc:occurrenceRemarks" minOccurs="0"/>
                <xs:element ref="dwc:recordNumber" minOccurs="0"/>
                <xs:element ref="dwc:recordedBy" minOccurs="0"/>
                <xs:element ref="dwc:individualID" minOccurs="0"/>
                <xs:element ref="dwc:individualCount" minOccurs="0"/>
                <xs:element ref="dwc:sex" minOccurs="0"/>
                <xs:element ref="dwc:lifeStage" minOccurs="0"/>
                <xs:element ref="dwc:reproductiveCondition" minOccurs="0"/>
                <xs:element ref="dwc:behavior" minOccurs="0"/>
                <xs:element ref="dwc:establishmentMeans" minOccurs="0"/>
                <xs:element ref="dwc:occurrenceStatus" minOccurs="0"/>
                <xs:element ref="dwc:preparations" minOccurs="0"/>
                <xs:element ref="dwc:disposition" minOccurs="0"/>
                <xs:element ref="dwc:otherCatalogNumbers" minOccurs="0"/>
                <xs:element ref="dwc:previousIdentifications" minOccurs="0"/>
                <xs:element ref="dwc:associatedMedia" minOccurs="0"/>
                <xs:element ref="dwc:associatedReferences" minOccurs="0"/>
                <xs:element ref="dwc:associatedOccurrences" minOccurs="0"/>
                <xs:element ref="dwc:associatedSequences" minOccurs="0"/>
                <xs:element ref="dwc:associatedTaxa" minOccurs="0"/>
                <!-- Event terms -->
                <xs:element ref="dwc:eventID" minOccurs="0"/>
                <xs:element ref="dwc:samplingProtocol" minOccurs="0"/>
                <xs:element ref="dwc:samplingEffort" minOccurs="0"/>
                <xs:element ref="dwc:eventDate" minOccurs="0"/>
                <xs:element ref="dwc:eventTime" minOccurs="0"/>
                <xs:element ref="dwc:startDayOfYear" minOccurs="0"/>
                <xs:element ref="dwc:endDayOfYear" minOccurs="0"/>
                <xs:element ref="dwc:year" minOccurs="0"/>
                <xs:element ref="dwc:month" minOccurs="0"/>
                <xs:element ref="dwc:day" minOccurs="0"/>
                <xs:element ref="dwc:verbatimEventDate" minOccurs="0"/>
                <xs:element ref="dwc:habitat" minOccurs="0"/>
                <xs:element ref="dwc:fieldNumber" minOccurs="0"/>
                <xs:element ref="dwc:fieldNotes" minOccurs="0"/>
                <xs:element ref="dwc:eventRemarks" minOccurs="0"/>
                <!-- Location terms -->
                <xs:element ref="dwc:locationID" minOccurs="0"/>
                <xs:element ref="dwc:higherGeographyID" minOccurs="0"/>
                <xs:element ref="dwc:higherGeography" minOccurs="0"/>
                <xs:element ref="dwc:continent" minOccurs="0"/>
                <xs:element ref="dwc:waterbody" minOccurs="0"/>
                <xs:element ref="dwc:islandGroup" minOccurs="0"/>
                <xs:element ref="dwc:island" minOccurs="0"/>
                <xs:element ref="dwc:country" minOccurs="0"/>
                <xs:element ref="dwc:countryCode" minOccurs="0"/>
                <xs:element ref="dwc:stateProvince" minOccurs="0"/>
                <xs:element ref="dwc:county" minOccurs="0"/>
                <xs:element ref="dwc:municipality" minOccurs="0"/>
                <xs:element ref="dwc:locality" minOccurs="0"/>
                <xs:element ref="dwc:verbatimLocality" minOccurs="0"/>
                <xs:element ref="dwc:verbatimElevation" minOccurs="0"/>
                <xs:element ref="dwc:minimumElevationInMeters" minOccurs="0"/>
                <xs:element ref="dwc:maximumElevationInMeters" minOccurs="0"/>
                <xs:element ref="dwc:verbatimDepth" minOccurs="0"/>
                <xs:element ref="dwc:minimumDepthInMeters" minOccurs="0"/>
                <xs:element ref="dwc:maximumDepthInMeters" minOccurs="0"/>
                <xs:element ref="dwc:minimumDistanceAboveSurfaceInMeters" minOccurs="0"/>
                <xs:element ref="dwc:maximumDistanceAboveSurfaceInMeters" minOccurs="0"/>
                <xs:element ref="dwc:locationAccordingTo" minOccurs="0"/>                      
                <xs:element ref="dwc:locationRemarks" minOccurs="0"/>                      
                <xs:element ref="dwc:verbatimCoordinates" minOccurs="0"/>
                <xs:element ref="dwc:verbatimLatitude" minOccurs="0"/>
                <xs:element ref="dwc:verbatimLongitude" minOccurs="0"/>
                <xs:element ref="dwc:verbatimCoordinateSystem" minOccurs="0"/>
                <xs:element ref="dwc:verbatimSRS" minOccurs="0"/>
                <xs:element ref="dwc:decimalLatitude" minOccurs="0"/>
                <xs:element ref="dwc:decimalLongitude" minOccurs="0"/>
                <xs:element ref="dwc:geodeticDatum" minOccurs="0"/>
                <xs:element ref="dwc:coordinateUncertaintyInMeters" minOccurs="0"/>
                <xs:element ref="dwc:coordinatePrecision" minOccurs="0"/>
                <xs:element ref="dwc:pointRadiusSpatialFit" minOccurs="0"/>
                <xs:element ref="dwc:footprintWKT" minOccurs="0"/>
                <xs:element ref="dwc:footprintSRS" minOccurs="0"/>
                <xs:element ref="dwc:footprintSpatialFit" minOccurs="0"/>
                <xs:element ref="dwc:georeferencedBy" minOccurs="0"/>
                <xs:element ref="dwc:georeferencedDate" minOccurs="0"/>
                <xs:element ref="dwc:georeferenceProtocol" minOccurs="0"/>
                <xs:element ref="dwc:georeferenceSources" minOccurs="0"/>
                <xs:element ref="dwc:georeferenceVerificationStatus" minOccurs="0"/>
                <xs:element ref="dwc:georeferenceRemarks" minOccurs="0"/>
                <!-- GeologicalContext terms -->
                <xs:element ref="dwc:geologicalContextID" minOccurs="0"/>
                <xs:element ref="dwc:earliestEonOrLowestEonothem" minOccurs="0"/>
                <xs:element ref="dwc:latestEonOrHighestEonothem" minOccurs="0"/>
                <xs:element ref="dwc:earliestEraOrLowestErathem" minOccurs="0"/>
                <xs:element ref="dwc:latestEraOrHighestErathem" minOccurs="0"/>
                <xs:element ref="dwc:earliestPeriodOrLowestSystem" minOccurs="0"/>
                <xs:element ref="dwc:latestPeriodOrHighestSystem" minOccurs="0"/>
                <xs:element ref="dwc:earliestEpochOrLowestSeries" minOccurs="0"/>
                <xs:element ref="dwc:latestEpochOrHighestSeries" minOccurs="0"/>
                <xs:element ref="dwc:earliestAgeOrLowestStage" minOccurs="0"/>
                <xs:element ref="dwc:latestAgeOrHighestStage" minOccurs="0"/>
                <xs:element ref="dwc:lowestBiostratigraphicZone" minOccurs="0"/>
                <xs:element ref="dwc:highestBiostratigraphicZone" minOccurs="0"/>
                <xs:element ref="dwc:lithostratigraphicTerms" minOccurs="0"/>
                <xs:element ref="dwc:group" minOccurs="0"/>
                <xs:element ref="dwc:formation" minOccurs="0"/>
                <xs:element ref="dwc:member" minOccurs="0"/>
                <xs:element ref="dwc:bed" minOccurs="0"/>
                <!-- Identification terms -->
                <xs:element ref="dwc:identificationID" minOccurs="0"/>
                <xs:element ref="dwc:identifiedBy" minOccurs="0"/>
                <xs:element ref="dwc:dateIdentified" minOccurs="0"/>
                <xs:element ref="dwc:identificationReferences" minOccurs="0"/>
                <xs:element ref="dwc:identificationVerificationStatus" minOccurs="0"/>
                <xs:element ref="dwc:identificationRemarks" minOccurs="0"/>
                <xs:element ref="dwc:identificationQualifier" minOccurs="0"/>
                <xs:element ref="dwc:typeStatus" minOccurs="0"/>
                <!-- Taxon terms -->
                <xs:element ref="dwc:taxonID" minOccurs="0"/>
                <xs:element ref="dwc:scientificNameID" minOccurs="0"/>
                <xs:element ref="dwc:acceptedNameUsageID" minOccurs="0"/>
                <xs:element ref="dwc:parentNameUsageID" minOccurs="0"/>
                <xs:element ref="dwc:originalNameUsageID" minOccurs="0"/>
                <xs:element ref="dwc:nameAccordingToID" minOccurs="0"/>
                <xs:element ref="dwc:namePublishedInID" minOccurs="0"/>
                <xs:element ref="dwc:taxonConceptID" minOccurs="0"/>
                <xs:element ref="dwc:scientificName" minOccurs="0"/>
                <xs:element ref="dwc:acceptedNameUsage" minOccurs="0"/>
                <xs:element ref="dwc:parentNameUsage" minOccurs="0"/>
                <xs:element ref="dwc:originalNameUsage" minOccurs="0"/>
                <xs:element ref="dwc:nameAccordingTo" minOccurs="0"/>
                <xs:element ref="dwc:namePublishedIn" minOccurs="0"/>
                <xs:element ref="dwc:namePublishedInYear" minOccurs="0"/>
                <xs:element ref="dwc:higherClassification" minOccurs="0"/>
                <xs:element ref="dwc:kingdom" minOccurs="0"/>
                <xs:element ref="dwc:phylum" minOccurs="0"/>
                <xs:element ref="dwc:class" minOccurs="0"/>
                <xs:element ref="dwc:order" minOccurs="0"/>
                <xs:element ref="dwc:family" minOccurs="0"/>
                <xs:element ref="dwc:genus" minOccurs="0"/>
                <xs:element ref="dwc:subgenus" minOccurs="0"/>
                <xs:element ref="dwc:specificEpithet" minOccurs="0"/>
                <xs:element ref="dwc:infraspecificEpithet" minOccurs="0"/>
                <xs:element ref="dwc:taxonRank" minOccurs="0"/>
                <xs:element ref="dwc:verbatimTaxonRank" minOccurs="0"/>
                <xs:element ref="dwc:scientificNameAuthorship" minOccurs="0"/>
                <xs:element ref="dwc:vernacularName" minOccurs="0"/>
                <xs:element ref="dwc:nomenclaturalCode" minOccurs="0"/>
                <xs:element ref="dwc:taxonomicStatus" minOccurs="0"/>
                <xs:element ref="dwc:nomenclaturalStatus" minOccurs="0"/>
                <xs:element ref="dwc:taxonRemarks" minOccurs="0"/>
                <xs:element ref="dwr:SimpleDarwinExtensions" minOccurs="0" />
                </xs:all>
        </xs:complexType>
    </xs:element>
    
    <xs:element name="SimpleDarwinExtensions">
        <xs:complexType>
            <xs:choice maxOccurs="unbounded">
                <xs:element ref="dwc:anyClass" />                                
            </xs:choice>
        </xs:complexType>
    </xs:element>

    <!-- 
        ANY SIMPLE EXTENSION CLASS
        Extensions implementing this abstract type should follow the simple dwc approach and only allow each term to exist once, using xs:all.
        As extension records always will be tight to a single parent simple dwc record, there is no need to have an implicit resourceID in extension records.        
    -->
    <xs:element name="anyExtension" abstract="true" substitutionGroup="dwc:anyClass"/>
    
</xs:schema>

