<?xml version="1.0" encoding="UTF-8"?>
<!-- 
SPASE Data Dictionary XML Schema. 
To be used to represent one or more terms in the SPASE data dictionary in XML

Written: 13 June 2006 - Todd King
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="spasedd">
<xs:element name="spaseDD">
    <xs:annotation>
        <xs:documentation>Container of  one or more SPASE data dictionary terms.</xs:documentation>
    </xs:annotation>
    <xs:complexType>
       <xs:sequence>
           <xs:element  name="term" type="xs:string" minOccurs="1" maxOccurs="1"> 
               <xs:annotation>
                   <xs:documentation>The name associated with a dictionary term.</xs:documentation>
               </xs:annotation>
           </xs:element>
           <xs:element  name="definition" type="xs:string" minOccurs="1" maxOccurs="1">
               <xs:annotation>
                   <xs:documentation>A detailed explanation of the meaning of the term.</xs:documentation>
               </xs:annotation>
           </xs:element>
           <xs:element  name="type" type="enumType" minOccurs="1" maxOccurs="1" >
               <xs:annotation>
                   <xs:documentation>The type of value which can be associated with the term.</xs:documentation>
               </xs:annotation>
           </xs:element>
           <xs:element ref="values" minOccurs="0" maxOccurs="1" />
           <xs:element ref="elements" minOccurs="0" maxOccurs="1"  />
           <xs:element ref="usage" minOccurs="0" maxOccurs="1" />
       </xs:sequence>
    </xs:complexType>
</xs:element>
    <!-- Container terms -->
    <xs:element name="values">
        <xs:annotation>
            <xs:documentation>The list values which can be associated with the term.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:choice>
                <xs:element name="url" type="xs:string" minOccurs="1" maxOccurs="1"></xs:element>
                <xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="unbounded" />
            </xs:choice>
        </xs:complexType>
    </xs:element>
    <xs:element name="elements">
        <xs:annotation>
            <xs:documentation>The list of terms which can be expressed within the context of this term (sub-elements).</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element name="element" type="xs:string" minOccurs="1" maxOccurs="unbounded" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="usage">
        <xs:annotation>
            <xs:documentation>The list of terms this term can be expressed within.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element name="usedby" type="xs:string" minOccurs="1" maxOccurs="unbounded" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <!-- Enumerations -->
    <!-- Term type -->
   <xs:simpleType name="enumType">
       <xs:restriction base="xs:string" >
           <xs:enumeration value="Container" />
           <xs:enumeration value="Count" />
           <xs:enumeration value="Date" />
           <xs:enumeration value="Enumeration" />
           <xs:enumeration value="Item" />
           <xs:enumeration value="Numeric" />
           <xs:enumeration value="Text" />
           <xs:enumeration value="Time" />
           <xs:enumeration value="Duration" />
       </xs:restriction>
    </xs:simpleType>
</xs:schema>