<?xml version="1.0" encoding="UTF-8"?>
<!--
  Revision history
  2010-08-26   Complete revision according to new common specification by the metadata work group after review. AJH, DTIC
      2010-11-17 Revised to current state of kernel review, FZ, TIB 
      2011-01-17 Complete revsion after community review. FZ, TIB
      2011-03-17 Release of v2.1: added a namespace; mandatory properties got minLength; changes in the definitions of relationTypes
      IsDocumentedBy/Documents and isCompiledBy/Compiles; changes type of property "Date" from xs:date to xs:string. FZ, TIB
      2011-06-27 v2.2: namespace: kernel-2.2, additions to controlled lists "resourceType", "contributorType", "relatedIdentifierType", and "descriptionType". Removal of intermediate include-files.
  2013-05 v3.0: namespace: kernel-3.0; delete LastMetadataUpdate & MetadateVersionNumber; additions to controlled lists "contributorType", "dateType", "descriptionType", "relationType", "relatedIdentifierType" & "resourceType"; deletion of "StartDate" & "EndDate" from list "dateType" and "Film" from "resourceType";  allow arbitrary order of elements; allow optional wrapper elements to be empty; include xml:lang attribute for title, subject & description; include attribute schemeURI for nameIdentifier of creator, contributor & subject; added new attributes "relatedMetadataScheme", "schemeURI" & "schemeType" to relatedIdentifier; included new property "geoLocation"
-->
<grammar ns="http://datacite.org/schema/kernel-3" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns:rng="http://relaxng.org/ns/structure/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <start>
    <ref name="resource"/>
  </start>
  <define name="titleType">
    <choice>
      <value>AlternativeTitle</value>
      <value>Subtitle</value>
      <value>TranslatedTitle</value>
    </choice>
  </define>
  <define name="contributorType">
    <a:documentation>
			The type of contributor of the resource.
		</a:documentation>
    <choice>
      <value>ContactPerson</value>
      <value>DataCollector</value>
      <value>DataManager</value>
      <value>Distributor</value>
      <value>Editor</value>
      <value>Funder</value>
      <value>HostingInstitution</value>
      <value>Other</value>
      <value>Producer</value>
      <value>ProjectLeader</value>
      <value>ProjectManager</value>
      <value>ProjectMember</value>
      <value>RegistrationAgency</value>
      <value>RegistrationAuthority</value>
      <value>RelatedPerson</value>
      <value>ResearchGroup</value>
      <value>RightsHolder</value>
      <value>Researcher</value>
      <value>Sponsor</value>
      <value>Supervisor</value>
      <value>WorkPackageLeader</value>
    </choice>
  </define>
  <define name="dateType">
    <a:documentation>
			The type of date. Use RKMS‐ISO8601 standard for depicting date ranges.To indicate the end of an embargo period, use Available. To indicate the start of an embargo period, use Submitted or Accepted, as appropriate.
		</a:documentation>
    <choice>
      <value>Accepted</value>
      <value>Available</value>
      <value>Collected</value>
      <value>Copyrighted</value>
      <value>Created</value>
      <value>Issued</value>
      <value>Submitted</value>
      <value>Updated</value>
      <value>Valid</value>
    </choice>
  </define>
  <define name="resourceType">
    <a:documentation>
			The general type of a resource.
		</a:documentation>
    <choice>
      <value>Audiovisual</value>
      <value>Collection</value>
      <value>Dataset</value>
      <value>Event</value>
      <value>Image</value>
      <value>InteractiveResource</value>
      <value>Model</value>
      <value>PhysicalObject</value>
      <value>Service</value>
      <value>Software</value>
      <value>Sound</value>
      <value>Text</value>
      <value>Workflow</value>
      <value>Other</value>
    </choice>
  </define>
  <define name="relationType">
    <a:documentation>
			Description of the relationship of the resource being registered (A) and the related resource (B).
		</a:documentation>
    <choice>
      <value>IsCitedBy</value>
      <value>Cites</value>
      <value>IsSupplementTo</value>
      <value>IsSupplementedBy</value>
      <value>IsContinuedBy</value>
      <value>Continues</value>
      <value>IsNewVersionOf</value>
      <value>IsPreviousVersionOf</value>
      <value>IsPartOf</value>
      <value>HasPart</value>
      <value>IsReferencedBy</value>
      <value>References</value>
      <value>IsDocumentedBy</value>
      <value>Documents</value>
      <value>IsCompiledBy</value>
      <value>Compiles</value>
      <value>IsVariantFormOf</value>
      <value>IsOriginalFormOf</value>
      <value>IsIdenticalTo</value>
      <value>HasMetadata</value>
      <value>IsMetadataFor</value>
    </choice>
  </define>
  <define name="relatedIdentifierType">
    <a:documentation>
			The type of the RelatedIdentifier.
		</a:documentation>
    <choice>
      <value>ARK</value>
      <value>DOI</value>
      <value>EAN13</value>
      <value>EISSN</value>
      <value>Handle</value>
      <value>ISBN</value>
      <value>ISSN</value>
      <value>ISTC</value>
      <value>LISSN</value>
      <value>LSID</value>
      <value>PMID</value>
      <value>PURL</value>
      <value>UPC</value>
      <value>URL</value>
      <value>URN</value>
    </choice>
  </define>
  <define name="descriptionType">
    <a:documentation>
			The type of the description.
		</a:documentation>
    <choice>
      <value>Abstract</value>
      <value>Methods</value>
      <value>SeriesInformation</value>
      <value>TableOfContents</value>
      <value>Other</value>
    </choice>
  </define>
  <define name="resource">
    <element name="resource">
      <a:documentation>
			
	Root element of a single record. This wrapper element is for XML implementation only and is not defined in the DataCite DOI standard.
        Note: This is the case for all wrapper elements within this schema!
			No content in this wrapper element.
		</a:documentation>
      <interleave>
        <optional>
          <attribute name="xsi:schemaLocation"/>
        </optional>
        <element name="identifier">
          <a:documentation>REQUIRED
						A persistent identifier that identifies a resource.
						Currently, only DOI is allowed.
					</a:documentation>
          <attribute name="identifierType">
            <value>DOI</value>
          </attribute>
          <ref name="doiType"/>
        </element>
        <element name="creators">
          <oneOrMore>
            <element name="creator">
              <a:documentation>REQUIRED
									The main researchers involved working on the data, or the authors of the publication in priority order. May be a corporate/institutional or personal name.
									Format: Family, Given.
								</a:documentation>
              <element name="creatorName">
                <ref name="nonemptycontentStringType"/>
              </element>
              <optional>
                <element name="nameIdentifier">
                  <attribute name="nameIdentifierScheme"/>
                  <optional>
                    <attribute name="schemeURI">
                      <data type="anyURI"/>
                    </attribute>
                  </optional>
                  <ref name="nonemptycontentStringType"/>
                </element>
              </optional>
            </element>
          </oneOrMore>
        </element>
        <element name="titles">
          <oneOrMore>
            <element name="title">
              <a:documentation>REQUIRED
									A name or title by which a resource is known.
								</a:documentation>
              <optional>
                <attribute name="titleType">
                  <ref name="titleType"/>
                </attribute>
              </optional>
              <optional>
                <ref name="lang"/>
              </optional>
              <ref name="nonemptycontentStringType"/>
            </element>
          </oneOrMore>
        </element>
        <element name="publisher">
          <a:documentation>REQUIRED
						The name of the entity that holds, archives, publishes prints, distributes, releases, issues, or produces the resource. This property will be used to formulate the citation, so consider the prominence of the role.
						In the case of datasets, "publish" is understood to mean making the data available to the community of researchers.
					</a:documentation>
          <ref name="nonemptycontentStringType"/>
        </element>
        <element name="publicationYear">
          <a:documentation>REQUIRED
						Year when the data is made publicly available. If an embargo period has been in effect, use the date when the embargo period ends.
						In the case of datasets, "publish" is understood to mean making the data available on a specific date to the community of researchers. If there is no standard publication year value, use the date that would be preferred from a citation perspective.
						YYYY
					</a:documentation>
          <ref name="yearType"/>
        </element>
        <optional>
          <element name="subjects">
            <zeroOrMore>
              <element name="subject">
                <a:documentation>
									Subject, keywords, classification codes, or key phrases describing the resource.
								</a:documentation>
                <optional>
                  <attribute name="subjectScheme"/>
                </optional>
                <optional>
                  <attribute name="schemeURI">
                    <data type="anyURI"/>
                  </attribute>
                </optional>
                <optional>
                  <ref name="lang"/>
                </optional>
                <text/>
              </element>
            </zeroOrMore>
          </element>
        </optional>
        <optional>
          <element name="contributors">
            <zeroOrMore>
              <element name="contributor">
                <a:documentation>
									The institution or person responsible for collecting, creating, or otherwise contributing to the developement of the dataset.
									The personal name format should be: Family, Given.
								</a:documentation>
                <element name="contributorName">
                  <data type="string"/>
                </element>
                <optional>
                  <element name="nameIdentifier">
                    <attribute name="nameIdentifierScheme"/>
                    <optional>
                      <attribute name="schemeURI">
                        <data type="anyURI"/>
                      </attribute>
                    </optional>
                    <ref name="nonemptycontentStringType"/>
                  </element>
                </optional>
                <attribute name="contributorType">
                  <ref name="contributorType"/>
                </attribute>
              </element>
            </zeroOrMore>
          </element>
        </optional>
        <optional>
          <element name="dates">
            <zeroOrMore>
              <element name="date">
                <a:documentation>
									Different dates relevant to the work.
									YYYY,YYYY-MM-DD, YYYY-MM-DDThh:mm:ssTZD or any other format or level of granularity described in W3CDTF. Use RKMS-ISO8601 standard for depicting date ranges.
								</a:documentation>
                <attribute name="dateType">
                  <ref name="dateType"/>
                </attribute>
                <text/>
              </element>
            </zeroOrMore>
          </element>
        </optional>
        <optional>
          <element name="language">
            <data type="language">
              <a:documentation>
						Primary language of the resource. Allowed values are taken from  IETF BCP 47, ISO 639-1 language codes.
					</a:documentation>
            </data>
          </element>
        </optional>
        <optional>
          <element name="resourceType">
            <a:documentation>
						The type of a resource. You may enter an additional free text description.
						The format is open, but the preferred format is a single term of some detail so that a pair can be formed with the sub-property.
					</a:documentation>
            <attribute name="resourceTypeGeneral">
              <ref name="resourceType"/>
            </attribute>
            <text/>
          </element>
        </optional>
        <optional>
          <element name="alternateIdentifiers">
            <zeroOrMore>
              <element name="alternateIdentifier">
                <a:documentation>
									An identifier or identifiers other than the primary Identifier applied to the resource being registered. This may be any alphanumeric string which is unique within its domain of issue. May be used for local identifiers. AlternateIdentifier should be used for another identifier of the same instance (same location, same file).
								</a:documentation>
                <attribute name="alternateIdentifierType"/>
                <text/>
              </element>
            </zeroOrMore>
          </element>
        </optional>
        <optional>
          <element name="relatedIdentifiers">
            <zeroOrMore>
              <element name="relatedIdentifier">
                <a:documentation>
									Identifiers of related resources. Use this property to indicate subsets of properties, as appropriate.
								</a:documentation>
                <attribute name="relatedIdentifierType">
                  <ref name="relatedIdentifierType"/>
                </attribute>
                <attribute name="relationType">
                  <ref name="relationType"/>
                </attribute>
                <optional>
                  <attribute name="relatedMetadataScheme"/>
                </optional>
                <optional>
                  <attribute name="schemeURI">
                    <data type="anyURI"/>
                  </attribute>
                </optional>
                <optional>
                  <attribute name="schemeType"/>
                </optional>
                <text/>
              </element>
            </zeroOrMore>
          </element>
        </optional>
        <optional>
          <element name="sizes">
            <zeroOrMore>
              <element name="size">
                <data type="string">
                  <a:documentation>
									Unstructures size information about the resource.
								</a:documentation>
                </data>
              </element>
            </zeroOrMore>
          </element>
        </optional>
        <optional>
          <element name="formats">
            <zeroOrMore>
              <element name="format">
                <data type="string">
                  <a:documentation>
									Technical format of the resource.
									Use file extension or MIME type where possible.
								</a:documentation>
                </data>
              </element>
            </zeroOrMore>
          </element>
        </optional>
        <optional>
          <element name="version">
            <data type="string">
              <a:documentation>
						Version number of the resource. If the primary resource has changed the version number increases.
						Register a new identifier for a major version change. Individual stewards need to determine which are major vs. minor versions. May be used in conjunction with properties 11 and 12 (AlternateIdentifier and RelatedIdentifier) to indicate various information updates. May be used in conjunction with property 17 (Description) to indicate the nature and file/record range of version.
					</a:documentation>
            </data>
          </element>
        </optional>
        <optional>
          <element name="rightsList">
            <zeroOrMore>
              <element name="rights">
                <a:documentation>
									Any rights information for this resource. Provide a rights management statement for the resource or reference a service providing such information. Include embargo information if applicable. 
Use the complete title of a license and include version information if applicable.
								</a:documentation>
                <optional>
                  <attribute name="rightsURI">
                    <data type="anyURI"/>
                  </attribute>
                </optional>
                <text/>
              </element>
            </zeroOrMore>
          </element>
        </optional>
        <optional>
          <element name="descriptions">
            <zeroOrMore>
              <element name="description">
                <a:documentation>
									All additional information that does not fit in any of the other categories. May be used for technical information. It is a best practice to supply a description.
								</a:documentation>
                <attribute name="descriptionType">
                  <ref name="descriptionType"/>
                </attribute>
                <optional>
                  <ref name="lang"/>
                </optional>
                <zeroOrMore>
                  <!-- mixed content -->
                  <choice>
                    <element name="br">
                      <empty/>
                    </element>
                    <text/>
                  </choice>
                </zeroOrMore>
              </element>
            </zeroOrMore>
          </element>
        </optional>
        <optional>
          <element name="geoLocations">
            <zeroOrMore>
              <element name="geoLocation">
                <a:documentation>
									Spatial region or named place where the data was gathered or about which the data is focused.
									A point contains a single latitude-longitude pair, separated by whitespace.
									A box contains two white space separated latitude-longitude pairs, with each pair separated by whitespace. The first pair is the lower corner, the second is the upper corner.
								</a:documentation>
                <optional>
                  <element name="geoLocationPoint">
                    <ref name="point"/>
                  </element>
                </optional>
                <optional>
                  <element name="geoLocationBox">
                    <ref name="box"/>
                  </element>
                </optional>
                <optional>
                  <element name="geoLocationPlace">
                    <text/>
                  </element>
                </optional>
              </element>
            </zeroOrMore>
          </element>
        </optional>
      </interleave>
    </element>
  </define>
  <!-- TYPE DECLARATIONS -->
  <!-- defines the value for a DOI: DOI must start with "10." -->
  <define name="doiType">
    <data type="token">
      <param name="pattern">10\..+/.+</param>
    </data>
  </define>
  <!-- defines value for mandatory fields -->
  <define name="nonemptycontentStringType">
    <data type="string">
      <param name="minLength">1</param>
    </data>
  </define>
  <define name="nameId">
    <optional>
      <attribute name="nameIdentifier">
        <data type="string"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="nameIdentifierScheme">
        <data type="string"/>
      </attribute>
    </optional>
  </define>
  <!-- defines the value for a year -->
  <define name="yearType">
    <data type="token">
      <param name="pattern">[\d]{4}</param>
    </data>
  </define>
  <!-- definitions for geoLocation -->
  <define name="point">
    <list>
      <data type="double"/>
      <data type="double"/>
    </list>
  </define>
  <define name="box">
    <list>
      <data type="double"/>
      <data type="double"/>
      <data type="double"/>
      <data type="double"/>
    </list>
  </define>
  <define name="lang">
    <attribute name="xml:lang">
      <choice>
        <data type="language"/>
        <empty/>
      </choice>
    </attribute>
  </define>
</grammar>
