<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema attributeFormDefault="unqualified" 
    elementFormDefault="qualified" 
    targetNamespace="http://bogusnamespace.com/inference_pilot_evaluation/annotation" 
    xmlns:inf2="http://bogusnamespace.com/inference_pilot_evaluation/annotation" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <!-- this schema contains the KB-eval original schema with additions to allow for ID numbers
    on the passage/question, a place for our output (maybe this should be elsewhere?), and a field for
    the "massaged" hypothesis-->
    <!-- First define the non-trivial field types -->
    <!-- Polarity -->
    <xsd:simpleType name="polarityType">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="true"/>
            <xsd:enumeration value="unknown"/>
            <xsd:enumeration value="false"/>
        </xsd:restriction>
    </xsd:simpleType>
    <!-- Force -->
    <xsd:simpleType name="forceType">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="strict"/>
            <xsd:enumeration value="plausible"/>
        </xsd:restriction>
    </xsd:simpleType>
    <!-- Source -->
    <xsd:simpleType name="sourceType">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="linguistic"/>
            <xsd:enumeration value="world"/>
        </xsd:restriction>
    </xsd:simpleType>
    <!-- Provenance -->
    <xsd:complexType name="provenanceType">
        <xsd:simpleContent>
            <xsd:extension base="xsd:string">
                <xsd:attribute name="type">
                    <xsd:simpleType>
                        <xsd:restriction base="xsd:string">
                            <xsd:enumeration value="unedited"/>
                            <xsd:enumeration value="edited"/>
                            <xsd:enumeration value="hand-crafted"/>
                        </xsd:restriction>
                    </xsd:simpleType>
                </xsd:attribute>
            </xsd:extension>
        </xsd:simpleContent>
    </xsd:complexType>
    
        <xsd:complexType name="docType">
            <xsd:simpleContent>
                <xsd:extension base="xsd:string">
                    <xsd:attribute name="id" type="xsd:string" />
                </xsd:extension>
            </xsd:simpleContent>
        </xsd:complexType>

    
    <!-- Next, define the complex "answer" element type that will
       contain all fields that can vary for different answers to the
       same passage/question -->
    <xsd:complexType name="answerType">
        <xsd:sequence>
            <xsd:element name="response" type="xsd:string"/>
            <xsd:element name="because" type="xsd:string"
                minOccurs="0"/>
            <xsd:element name="assumptions" type="xsd:string"
                minOccurs="0"/>
            <xsd:element name="context-type" type="xsd:string"
                minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element name="comment" type="xsd:string" minOccurs="0"
                maxOccurs="unbounded"/>
        </xsd:sequence>
        <!-- For some odd reason, XML Schema forces us to define
         attributes after having defined the subtags -->
        <xsd:attribute name="id" type="xsd:string"/>
        <xsd:attribute name="polarity" type="inf2:polarityType"/>
        <xsd:attribute name="force" type="inf2:forceType"/>
        <xsd:attribute name="source" type="inf2:sourceType"/>
    </xsd:complexType>
    
    <!-- Define the main parent tag for each passage/question and
       associated answers -->
    <xsd:complexType name="inferenceType">
        <xsd:sequence>
            <xsd:element name="passage" type="inf2:docType"></xsd:element>
            <xsd:element name="question" type="inf2:docType"/>
            <xsd:element name="hypothesis" type="inf2:docType" minOccurs="0"/>
            <xsd:element name="provenance" type="inf2:provenanceType"
                minOccurs="0"/>
            <xsd:element name="ouput" type="inf2:answerType" minOccurs="0"/>
            <xsd:element name="answer" type="inf2:answerType" minOccurs="0"
                maxOccurs="unbounded"/>
            <xsd:element name="comment" type="xsd:string" minOccurs="0"
                maxOccurs="unbounded"/>
        </xsd:sequence>
        <!-- For some odd reason, XML Schema forces us to define
         attributes after having defined the subtags -->
        <xsd:attribute name="id" type="xsd:string"/>
    </xsd:complexType>
    
    <!-- Finally, define the top-level root element -->
    <xsd:element name="root">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="inference" type="inf2:inferenceType"
                    maxOccurs="unbounded"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    
</xsd:schema>
