<?xml version="1.0" encoding="UTF-8"?>

<schema xmlns="http://www.w3.org/2001/XMLSchema"
  xmlns:thes="http://www.alexandria.ucsb.edu/thesaurus"
  targetNamespace="http://www.alexandria.ucsb.edu/thesaurus"
  elementFormDefault="qualified">

<annotation>
  <appinfo>
    <header xmlns="">$Header: /export/home/gjanee/thesaurus/RCS/thesaurus-protocol.xsd,v 1.1 2002/05/01 21:51:21 gjanee Exp $</header>
    <log xmlns="">
      $Log: thesaurus-protocol.xsd,v $
      Revision 1.1  2002/05/01 21:51:21  gjanee
      Initial revision

    </log>
  </appinfo>
  <documentation>
    <author xmlns="">
      <name>Greg Jan&#x00E9;e</name>
      <affiliation>Alexandria Digital Library Project</affiliation>
      <email-address>gjanee@alexandria.ucsb.edu</email-address>
    </author>
  </documentation>
</annotation>

<element name="properties">
  <complexType>
    <sequence>
      <element name="name" type="string" minOccurs="0"/>
      <element name="version" type="string" minOccurs="0"/>
      <element name="description" type="string" minOccurs="0"/>
      <element name="query-operators">
        <complexType>
          <attribute name="equals" type="boolean" use="required"/>
          <attribute name="contains-all-words" type="boolean" use="required"/>
          <attribute name="contains-any-words" type="boolean" use="required"/>
          <attribute name="matches-regexp" type="boolean" use="required"/>
        </complexType>
      </element>
      <element name="extended-schema" type="anyURI" minOccurs="0"/>
    </sequence>
  </complexType>
</element>

<element name="term">
  <complexType>
    <simpleContent>
      <extension base="string">
        <attribute name="preferred" type="boolean" default="true"/>
      </extension>
    </simpleContent>
  </complexType>
</element>

<element name="term-description">
  <complexType>
    <sequence>
      <element ref="thes:term"/>
      <element name="note" minOccurs="0" maxOccurs="unbounded">
        <complexType>
          <simpleContent>
            <extension base="string">
              <attribute name="type" type="string"/>
            </extension>
          </simpleContent>
        </complexType>
      </element>
      <choice>
        <sequence>
          <element name="broader">
            <complexType>
              <sequence>
                <element ref="thes:term" minOccurs="0" maxOccurs="unbounded"/>
              </sequence>
            </complexType>
          </element>
          <element name="narrower">
            <complexType>
              <sequence>
                <element ref="thes:term" minOccurs="0" maxOccurs="unbounded"/>
              </sequence>
            </complexType>
          </element>
          <element name="used-for">
            <complexType>
              <sequence>
                <element ref="thes:term" minOccurs="0" maxOccurs="unbounded"/>
              </sequence>
            </complexType>
          </element>
          <element name="related">
            <complexType>
              <sequence>
                <element ref="thes:term" minOccurs="0" maxOccurs="unbounded"/>
              </sequence>
            </complexType>
          </element>
        </sequence>
        <element name="use-instead">
          <complexType>
            <sequence>
              <element ref="thes:term" maxOccurs="unbounded"/>
            </sequence>
            <attribute name="conjunction" type="boolean" default="false"/>
          </complexType>
        </element>
      </choice>
    </sequence>
  </complexType>
</element>

<element name="extended">
  <complexType>
    <sequence>
      <any processContents="lax"/>
    </sequence>
  </complexType>
</element>

<element name="list">
  <complexType>
    <choice>
      <element ref="thes:term" minOccurs="0" maxOccurs="unbounded"/>
      <element ref="thes:term-description" minOccurs="0"
        maxOccurs="unbounded"/>
      <element ref="thes:extended" minOccurs="0" maxOccurs="unbounded"/>
    </choice>
  </complexType>
</element>

<element name="node">
  <complexType>
    <sequence>
      <choice>
        <element ref="thes:term"/>
        <element ref="thes:term-description"/>
        <element ref="thes:extended"/>
      </choice>
      <choice minOccurs="0" maxOccurs="unbounded">
        <element ref="thes:node"/>
        <element ref="thes:noderef"/>
      </choice>
    </sequence>
    <attribute name="id" type="ID"/>
  </complexType>
</element>

<element name="noderef">
  <complexType>
    <attribute name="ref" type="IDREF" use="required"/>
  </complexType>
</element>

<element name="hierarchy">
  <complexType>
    <sequence>
      <element ref="thes:node"/>
    </sequence>
    <attribute name="direction" use="required">
      <simpleType>
        <restriction base="string">
          <enumeration value="broader"/>
          <enumeration value="narrower"/>
        </restriction>
      </simpleType>
    </attribute>
    <attribute name="max-levels" type="integer" use="required"/>
  </complexType>
</element>

<element name="error">
  <complexType>
    <sequence>
      <element name="code" type="string" minOccurs="0"/>
      <element name="description" type="string" minOccurs="0"/>
    </sequence>
  </complexType>
</element>

<element name="response">
  <complexType>
    <choice>
      <element ref="thes:properties"/>
      <element ref="thes:list"/>
      <element ref="thes:hierarchy"/>
      <element ref="thes:error"/>
    </choice>
    <attribute name="version" type="string" use="required"/>
  </complexType>
</element>

</schema>
