<?xml version=“1.0”?>

<xs:schema xmlns:xs=“www.w3.org/2001/XMLSchema”>

<xs:annotation>
  <xs:documentation>PROIEL XML format version 3.0</xs:documentation>
</xs:annotation>

<!-- Source elements -->
<xs:complexType name="Source">
  <xs:sequence>
    <xs:element name="title" minOccurs="1" maxOccurs="1" type="xs:string"/>
    <xs:element name="alternative-title" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="author" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="citation-part" minOccurs="1" maxOccurs="1" type="xs:string"/>
    <xs:element name="principal" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="funder" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="distributor" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="distributor-address" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="address" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="date" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="license" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="license-url" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="reference-system" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="editor" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="editorial-note" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="annotator" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="reviewer" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="electronic-text-editor" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="electronic-text-title" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="electronic-text-version" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="electronic-text-publisher" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="electronic-text-place" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="electronic-text-date" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="electronic-text-original-url" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="electronic-text-license" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="electronic-text-license-url" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="printed-text-editor" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="printed-text-title" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="printed-text-edition" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="printed-text-publisher" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="printed-text-place" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="printed-text-date" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="chronology-composition" minOccurs="0" maxOccurs="1" type="xs:string"/>
    <xs:element name="chronology-manuscript" minOccurs="0" maxOccurs="1" type="xs:string"/>

    <xs:element name="tag" minOccurs="0" maxOccurs="unbounded" type="Tag"/>
    <xs:element name="note" minOccurs="0" maxOccurs="unbounded" type="Note"/>
    <xs:element name="link" minOccurs="0" maxOccurs="unbounded" type="Link"/>

    <xs:element name="div" minOccurs="1" maxOccurs="unbounded" type="Div"/>

  </xs:sequence>

  <xs:attribute name="id" type="xs:string" use="required"/>
  <xs:attribute name="alignment-id" type="xs:string" use="optional"/>
  <xs:attribute name="language" type="xs:string" use="required"/>
  <xs:attribute name="dialect" type="xs:string" use="optional"/>
</xs:complexType>

<xs:complexType name="Div">
  <xs:sequence>
    <xs:element name="title" minOccurs="1" maxOccurs="1" type="xs:string"/>

    <xs:element name="tag" minOccurs="0" maxOccurs="unbounded" type="Tag"/>
    <xs:element name="note" minOccurs="0" maxOccurs="unbounded" type="Note"/>
    <xs:element name="link" minOccurs="0" maxOccurs="unbounded" type="Link"/>

    <xs:element name="sentence" minOccurs="1" maxOccurs="unbounded" type="Sentence"/>
  </xs:sequence>

  <xs:attribute name="id" type="xs:nonNegativeInteger" use="optional"/>
  <xs:attribute name="alignment-id" type="xs:nonNegativeInteger" use="optional"/>
  <xs:attribute name="presentation-before" type="xs:string" use="optional"/>
  <xs:attribute name="presentation-after" type="xs:string" use="optional"/>
</xs:complexType>

<xs:complexType name="Sentence">
  <xs:sequence>
    <xs:element name="tag" minOccurs="0" maxOccurs="unbounded" type="Tag"/>
    <xs:element name="note" minOccurs="0" maxOccurs="unbounded" type="Note"/>
    <xs:element name="link" minOccurs="0" maxOccurs="unbounded" type="Link"/>

    <xs:element name="token" minOccurs="1" maxOccurs="unbounded" type="Token"/>
  </xs:sequence>

  <xs:attribute name="id" type="xs:nonNegativeInteger" use="optional"/>
  <xs:attribute name="alignment-id" type="xs:nonNegativeInteger" use="optional"/>
  <xs:attribute name="presentation-before" type="xs:string" use="optional"/>
  <xs:attribute name="presentation-after" type="xs:string" use="optional"/>
  <xs:attribute name="status" type="SentenceStatus" use="optional"/>
  <xs:attribute name="annotated-by" type="xs:string" use="optional"/>
  <xs:attribute name="annotated-at" type="xs:dateTime" use="optional"/>
  <xs:attribute name="reviewed-by" type="xs:string" use="optional"/>
  <xs:attribute name="reviewed-at" type="xs:dateTime" use="optional"/>
</xs:complexType>

<xs:simpleType name="SentenceStatus">
  <xs:restriction base="xs:string">
    <xs:enumeration value="annotated"/>
    <xs:enumeration value="reviewed"/>
    <xs:enumeration value="unannotated"/>
  </xs:restriction>
</xs:simpleType>

<xs:complexType name="Token">
  <xs:sequence>
    <xs:element name="tag" minOccurs="0" maxOccurs="unbounded" type="Tag"/>
    <xs:element name="note" minOccurs="0" maxOccurs="unbounded" type="Note"/>
    <xs:element name="link" minOccurs="0" maxOccurs="unbounded" type="Link"/>

    <xs:element name="slash" minOccurs="0" maxOccurs="unbounded" type="Slash"/>
  </xs:sequence>

  <xs:attribute name="id" type="xs:nonNegativeInteger" use="optional"/>
  <xs:attribute name="alignment-id" type="xs:nonNegativeInteger" use="optional"/>
  <xs:attribute name="lemma" type="xs:string" use="optional"/>
  <xs:attribute name="part-of-speech" type="xs:string" use="optional"/>
  <xs:attribute name="morphology" type="xs:string" use="optional"/>
  <xs:attribute name="citation-part" type="xs:string" use="optional"/>
  <xs:attribute name="relation" type="xs:string" use="optional"/>
  <xs:attribute name="head-id" type="xs:nonNegativeInteger" use="optional"/>
  <xs:attribute name="information-status" type="xs:string" use="optional"/>
  <xs:attribute name="antecedent-id" type="xs:nonNegativeInteger" use="optional"/>
  <xs:attribute name="contrast-group" type="xs:string" use="optional"/>
  <xs:attribute name="foreign-ids" type="xs:string" use="optional"/>

  <!-- XSD does not allow us to constrain the use of these attributes properly so they are marked optional even though their occurrence depends on the value of empty-token-sort and form. -->
  <xs:attribute name="empty-token-sort" type="EmptyTokenSort" use="optional"/>
  <xs:attribute name="form" type="xs:string" use="optional"/>
  <xs:attribute name="presentation-before" type="xs:string" use="optional"/>
  <xs:attribute name="presentation-after" type="xs:string" use="optional"/>
</xs:complexType>

<xs:simpleType name="EmptyTokenSort">
  <xs:restriction base="xs:string">
    <xs:enumeration value="P"/>
    <xs:enumeration value="C"/>
    <xs:enumeration value="V"/>
  </xs:restriction>
</xs:simpleType>

<xs:complexType name="Slash">
  <xs:attribute name="target-id" type="xs:nonNegativeInteger" use="required"/>
  <xs:attribute name="relation" type="xs:string" use="required"/>
</xs:complexType>

<!-- Shared metadata elements -->
<xs:complexType name="Tag">
  <xs:attribute name="attribute" type="xs:string" use="required"/>
  <xs:attribute name="value" type="xs:string" use="required"/>
  <xs:attribute name="target-id" type="xs:string" use="optional"/>
  <xs:attribute name="target-type" type="xs:string" use="optional"/>
</xs:complexType>

<xs:complexType name="Link">
  <xs:attribute name="target" type="xs:string" use="required"/>
  <xs:attribute name="type" type="xs:string" use="required"/>
</xs:complexType>

<xs:complexType name="Note">
  <xs:simpleContent>
    <xs:extension base="xs:string">
      <xs:attribute name="originator" type="xs:string" use="required"/>
    </xs:extension>
  </xs:simpleContent>
</xs:complexType>

<!-- Dictionary elements -->
<xs:complexType name="DictionarySource">
  <xs:attribute name="idref" type="xs:string" use="required"/>
  <xs:attribute name="license" type="xs:string" use="optional"/>
  <xs:attribute name="n" type="xs:nonNegativeInteger" use="optional"/>
</xs:complexType>

<xs:complexType name="DictionaryToken">
  <xs:attribute name="idref" type="xs:string" use="required"/>
  <xs:attribute name="flags" type="xs:string" use="optional"/>
</xs:complexType>

<xs:complexType name="DictionaryArgument">
  <xs:attribute name="relation" type="xs:string" use="required"/>
  <xs:attribute name="lemma" type="xs:string" use="optional"/>
  <xs:attribute name="part-of-speech" type="xs:string" use="optional"/>
  <xs:attribute name="mood" type="xs:string" use="optional"/>
  <xs:attribute name="case" type="xs:string" use="optional"/>
</xs:complexType>

<xs:complexType name="DictionaryTokens">
  <xs:sequence>
    <xs:element name="token" minOccurs="0" maxOccurs="unbounded" type="DictionaryToken"/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="DictionaryArguments">
  <xs:sequence>
    <xs:element name="argument" minOccurs="0" maxOccurs="unbounded" type="DictionaryArgument"/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="DictionaryFrame">
  <xs:sequence>
    <xs:element name="arguments" minOccurs="1" maxOccurs="1" type="DictionaryArguments"/>
    <xs:element name="tokens" minOccurs="1" maxOccurs="unbounded" type="DictionaryTokens"/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="DictionaryValency">
  <xs:sequence>
    <xs:element name="frame" minOccurs="1" maxOccurs="unbounded" type="DictionaryFrame"/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="DictionarySlot2">
  <xs:attribute name="form" type="xs:string" use="required"/>
  <xs:attribute name="n" type="xs:nonNegativeInteger" use="required"/>
</xs:complexType>

<xs:complexType name="DictionarySlot1">
  <xs:sequence>
    <xs:element name="slot2" minOccurs="1" maxOccurs="unbounded" type="DictionarySlot2"/>
  </xs:sequence>

  <xs:attribute name="morphology" type="xs:string" use="required"/>
</xs:complexType>

<xs:complexType name="DictionaryParadigm">
  <xs:sequence>
    <xs:element name="slot1" minOccurs="1" maxOccurs="unbounded" type="DictionarySlot1"/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="DictionaryHomograph">
  <xs:attribute name="lemma" type="xs:string" use="required"/>
  <xs:attribute name="part-of-speech" type="xs:string" use="required"/>
</xs:complexType>

<xs:complexType name="DictionaryHomographs">
  <xs:sequence>
    <xs:element name='homograph' minOccurs="1" maxOccurs="unbounded" type='DictionaryHomograph'/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="DictionaryGloss">
  <xs:simpleContent>
    <xs:extension base="xs:string">
      <xs:attribute name="language" type="xs:string" use="required"/>
    </xs:extension>
  </xs:simpleContent>
</xs:complexType>

<xs:complexType name="DictionaryGlosses">
  <xs:sequence>
    <xs:element name='gloss' minOccurs="1" maxOccurs="unbounded" type='DictionaryGloss'/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="DictionaryDistribution">
  <xs:sequence>
    <xs:element name='source' minOccurs="1" maxOccurs="unbounded" type='DictionarySource'/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="DictionaryLemma">
  <xs:sequence>
    <xs:element name="tag" minOccurs="0" maxOccurs="unbounded" type="Tag"/>
    <xs:element name="note" minOccurs="0" maxOccurs="unbounded" type="Note"/>
    <xs:element name="link" minOccurs="0" maxOccurs="unbounded" type="Link"/>

    <xs:element name="distribution" minOccurs="0" maxOccurs="1" type="DictionaryDistribution"/>
    <xs:element name="glosses" minOccurs="0" maxOccurs="1" type="DictionaryGlosses"/>
    <xs:element name="homographs" minOccurs="0" maxOccurs="1" type="DictionaryHomographs"/>
    <xs:element name="paradigm" minOccurs="0" maxOccurs="1" type="DictionaryParadigm"/>
    <xs:element name="valency" minOccurs="0" maxOccurs="1" type="DictionaryValency"/>
  </xs:sequence>

  <xs:attribute name="lemma" type="xs:string" use="required"/>
  <xs:attribute name="part-of-speech" type="xs:string" use="required"/>
</xs:complexType>

<xs:complexType name="DictionarySources">
  <xs:sequence>
    <xs:element name='source' minOccurs="1" maxOccurs="unbounded" type='DictionarySource'/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="DictionaryLemmata">
  <xs:sequence>
    <xs:element name='lemma' minOccurs="1" maxOccurs="unbounded" type='DictionaryLemma'/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="Dictionary">
  <xs:sequence>
    <xs:element name="tag" minOccurs="0" maxOccurs="unbounded" type="Tag"/>
    <xs:element name="note" minOccurs="0" maxOccurs="unbounded" type="Note"/>
    <xs:element name="link" minOccurs="0" maxOccurs="unbounded" type="Link"/>

    <xs:element name='sources' minOccurs="0" maxOccurs="1" type='DictionarySources'/>
    <xs:element name='lemmata' minOccurs="0" maxOccurs="1" type='DictionaryLemmata'/>
  </xs:sequence>

  <xs:attribute name="language" type="xs:string" use="required"/>
  <xs:attribute name="dialect" type="xs:string" use="optional"/>
</xs:complexType>

<!-- Annotation elements -->
<xs:complexType name="PartOfSpeechValue">
  <xs:attribute name="tag" type="xs:string" use="required"/>
  <xs:attribute name="summary" type="xs:string" use="required"/>
</xs:complexType>

<xs:complexType name="PartsOfSpeech">
  <xs:sequence>
    <xs:element name='value' minOccurs="1" maxOccurs="unbounded" type='PartOfSpeechValue'/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="InformationStatusValue">
  <xs:attribute name="tag" type="xs:string" use="required"/>
  <xs:attribute name="summary" type="xs:string" use="required"/>
</xs:complexType>

<xs:complexType name="InformationStatuses">
  <xs:sequence>
    <xs:element name='value' minOccurs="1" maxOccurs="unbounded" type='InformationStatusValue'/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="RelationValue">
  <xs:attribute name="tag" type="xs:string" use="required"/>
  <xs:attribute name="summary" type="xs:string" use="required"/>
  <xs:attribute name="primary" type="xs:boolean" use="required"/>
  <xs:attribute name="secondary" type="xs:boolean" use="required"/>
</xs:complexType>

<xs:complexType name="Relations">
  <xs:sequence>
    <xs:element name='value' minOccurs="1" maxOccurs="unbounded" type='RelationValue'/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="MorphologyValue">
  <xs:attribute name="tag" type="xs:string" use="required"/>
  <xs:attribute name="summary" type="xs:string" use="required"/>
</xs:complexType>

<xs:complexType name="MorphologyField">
  <xs:sequence>
    <xs:element name='value' minOccurs="1" maxOccurs="unbounded" type='MorphologyValue'/>
  </xs:sequence>

  <xs:attribute name="tag" type="xs:string" use="required"/>
</xs:complexType>

<xs:complexType name="Morphology">
  <xs:sequence>
    <xs:element name='field' minOccurs="1" maxOccurs="unbounded" type='MorphologyField'/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="Annotation">
  <xs:sequence>
    <xs:element name='relations' minOccurs="1" maxOccurs="1" type='Relations'/>
    <xs:element name='parts-of-speech' minOccurs="1" maxOccurs="1" type='PartsOfSpeech'/>
    <xs:element name='morphology' minOccurs="1" maxOccurs="1" type='Morphology'/>
    <xs:element name='information-statuses' minOccurs="1" maxOccurs="1" type='InformationStatuses'/>
  </xs:sequence>
</xs:complexType>

<!-- Top-level element -->
<xs:complexType name="Proiel">
  <xs:sequence>
    <xs:element name='annotation' minOccurs="0" maxOccurs="1" type='Annotation'/>
    <xs:element name='source' minOccurs="0" maxOccurs="unbounded" type='Source'/>
    <xs:element name='dictionary' minOccurs="0" maxOccurs="unbounded" type='Dictionary'/>
  </xs:sequence>

  <xs:attribute name='export-time' type="xs:dateTime" use="optional"/>
  <xs:attribute name="schema-version" type="xs:decimal" use="required" fixed="3.0"/>
</xs:complexType>

<xs:element name='proiel' type='Proiel'/>

</xs:schema>