<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <include href="common.rng"/>
  <start>
    <ref name="UserSpace"/>
  </start>
  <!--
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -#
                        Mobyle UserSpace Definition               #
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -#
  -->
  <define name="UserSpace">
    <element name="userSpace">
      <interleave>
        <element name="authenticated">
          <data type="boolean"/>
        </element>
        <element name="activated">
          <data type="boolean"/>
        </element>
        <element name="activatingKey">
          <data type="string"/>
        </element>
        <ref name="Email"/>
        <element name="passwd">
          <data type="string"/>
        </element>
        <optional>
          <element name="captchaSolution">
            <data type="string"/>
          </element>
        </optional>
        <element name="dataList">
          <zeroOrMore>
            <element name="data">
              <interleave>
                <attribute name="id">
                  <data type="ID"/>
                </attribute>
                <attribute name="size">
                  <data type="positiveInteger"/>
                </attribute>
                <attribute name="count">
                  <data type="positiveInteger"/>
                </attribute>
                <element name="userName">
                  <data type="string"/>
                </element>
                <element name="type">
                  <interleave>
                    <zeroOrMore>
                      <!-- warning: the type format will soon be unified between program& job and userSpace documents. -->
                      <element name="biotype">
                        <text/>
                      </element>
                    </zeroOrMore>
                    <!--
                      the biological type of the parameter DNA & Protein ...
                      the biotypes list represents the list of accepted 'types'
                      for input parameters and the list of 'types' that an 
                      output may belong to
                    -->
                    <element name="datatype">
                      <interleave>
                        <!-- type of the data Sequence & Structure & Matrix ... -->
                        <element name="class">
                          <text/>
                        </element>
                        <optional>
                          <element name="superclass">
                            <text/>
                          </element>
                        </optional>
                      </interleave>
                      <!--
                         superclass& or class if class does not exist
                        is a Mobyle parameter Class defined in Src/Mobyle/Core.py or in Local/CustomClasses/
                      -->
                    </element>
                    <zeroOrMore>
                      <ref name="DataFormat"/>
                    </zeroOrMore>
                  </interleave>
                </element>
                <element name="headOfData">
                  <data type="string"/>
                </element>
                <element name="inputModes">
                  <element name="inputMode">
                    <choice>
                      <value>db</value>
                      <value>paste</value>
                      <value>upload</value>
                      <value>result</value>
                    </choice>
                  </element>
                </element>
                <element name="producedBy">
                  <attribute name="id">
                    <data type="IDREF"/>
                  </attribute>
                </element>
                <element name="usedBy">
                  <attribute name="id">
                    <data type="IDREF"/>
                  </attribute>
                </element>
              </interleave>
            </element>
          </zeroOrMore>
        </element>
        <element name="jobList">
          <zeroOrMore>
            <element name="job">
              <interleave>
                <attribute name="id">
                  <data type="anyURI"/>
                </attribute>
                <element name="userName">
                  <data type="string"/>
                </element>
                <element name="programName">
                  <data type="string"/>
                </element>
                <zeroOrMore>
                  <element name="userAnnotation">
                    <interleave>
                      <optional>
                        <element name="description">
                          <data type="string"/>
                        </element>
                      </optional>
                      <zeroOrMore>
                        <element name="labels">
                          <data type="string"/>
                        </element>
                      </zeroOrMore>
                    </interleave>
                  </element>
                </zeroOrMore>
                <element name="date">
                  <data type="string"/>
                </element>
                <element name="status">
                  <data type="string"/>
                </element>
                <element name="dataUsed">
                  <attribute name="id">
                    <data type="string"/>
                  </attribute>
                </element>
                <element name="dataProduced">
                  <attribute name="id">
                    <data type="string"/>
                  </attribute>
                </element>
              </interleave>
            </element>
          </zeroOrMore>
        </element>
      </interleave>
    </element>
  </define>
</grammar>
