<?xml version="1.0"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:group name="component">
    <xs:sequence>
      <xs:choice>
        <xs:element name="seq">
          <xs:complexType>
            <xs:sequence>
              <xs:group ref="component" maxOccurs="unbounded" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="or">
          <xs:complexType>
            <xs:sequence>
              <xs:group ref="component" maxOccurs="unbounded" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="and">
          <xs:complexType>
            <xs:sequence>
              <xs:group ref="component" maxOccurs="unbounded" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="prod">
          <xs:complexType>
            <xs:sequence>
              <xs:group ref="component" maxOccurs="unbounded" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="bprod">
          <xs:complexType>
            <xs:sequence>
              <xs:group ref="component" maxOccurs="unbounded" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="neg">
          <xs:complexType>
            <xs:sequence>
              <xs:group ref="component" maxOccurs="1" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="lemma">
          <xs:complexType>
            <xs:simpleContent>
              <xs:extension base="xs:string">
                <xs:attribute name="ls" type="xs:string" use="optional" default="" />
              </xs:extension>
            </xs:simpleContent>
          </xs:complexType>
        </xs:element>
        <xs:element name="lemmas">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="word" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="ls" type="xs:string" use="optional" default="" />
          </xs:complexType>
        </xs:element>
        <xs:element name="pos">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="word" type="xs:string" maxOccurs="1" minOccurs="1" />
              <xs:element name="poscode" maxOccurs="unbounded" minOccurs="0">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute name="key" type="xs:string" use="required" />
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="phrase">
          <xs:complexType>
            <xs:simpleContent>
              <xs:extension base="xs:string">
                <xs:attribute name="case" type="yesno" default="no" />
              </xs:extension>
            </xs:simpleContent>
          </xs:complexType>
        </xs:element>
        <xs:element ref="element">
        </xs:element>
        <xs:element name="pattern">
          <xs:complexType>
            <xs:simpleContent>
              <xs:extension base="xs:string">
                <xs:attribute name="case" type="yesno" default="no" />
              </xs:extension>
            </xs:simpleContent>
          </xs:complexType>
        </xs:element>
        <xs:element name="scope">
          <xs:complexType>
            <xs:sequence>
              <xs:group ref="component" />
              <xs:choice>
                <xs:element ref="element">
                </xs:element>
                <xs:element name="span">
                  <xs:complexType>
                    <xs:attribute name="size" type="xs:positiveInteger"/>
                  </xs:complexType>
                </xs:element>
                
              </xs:choice>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:sequence>
  </xs:group>
  <xs:element name="cql">
    <xs:complexType>
      <xs:sequence>
        <xs:sequence>
          <xs:group ref="component" />
        </xs:sequence>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:simpleType name="yesno">
    <xs:restriction base="xs:string">
      <xs:enumeration value="yes" />
      <xs:enumeration value="no" />
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="attributetype">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="name" type="xs:string" use="required" />
        <xs:attribute name="ns" type="xs:string" />
        <xs:attribute name="var" type="yesno" default="no" />
        <xs:attribute name="pattern" type="yesno" default="no" />
        <xs:attribute name="value" type="xs:string" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:element name="element">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="attribute" type="attributetype" maxOccurs="unbounded" minOccurs="0" />
      </xs:sequence>
      <xs:attribute name="name" type="xs:string" />
      <xs:attribute name="ns" type="xs:string" />
      <xs:attribute name="end" type="yesno" default="no" />
    </xs:complexType>
  </xs:element>
</xs:schema>