<?xml version="1.0"?>
<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<!--                                                       -->
<!-- The Enterprise Privacy Authorization Language (EPAL)  -->
<!--                                                       -->
<!--  - Access Request -                                   -->
<!--                                                       -->
<!--  Authors:                                             -->
<!--      Paul Ashley <pashley at us.ibm.com>              -->
<!--      Satoshi Hada <satoshih at jp.ibm.com>            -->
<!--      G&uuml;nter Karjoth <gka at zurich.ibm.com>      -->
<!--      Calvin Powers <cspowers at us.ibm.com>           -->
<!--      Matthias Schunter <mts at zurich.ibm.com>        -->
<!--                                                       -->
<!--  Abstract: This schema defines the structures of an   -->
<!--    EPAL authorization query and the returned answer   -->
<!--                                                       -->
<!--  Version: 1.1                                         -->
<!--                                                       -->
<!-- $Id: epal-interface.xsd,v 1.13 2003/06/05 06:18:24 satoshih Exp $     -->
<xs:schema
  targetNamespace="http://www.research.ibm.com/privacy/epal/interface"
  xmlns:epal="http://www.research.ibm.com/privacy/epal"
  xmlns:epal-interface="http://www.research.ibm.com/privacy/epal/interface"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xml:lang="en"
  elementFormDefault="qualified"
  attributeFormDefault="unqualified">

  <!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
  <!--                                                       -->
  <!-- Import schema of "epal" namepace                      -->
  <!--                                                       -->

  <xs:import namespace="http://www.research.ibm.com/privacy/epal"
    schemaLocation="epal.xsd"/>

  <!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
  <!--                                                       -->
  <!-- DECLARATION OF THE TOPLEVEL ELEMENTS                  -->
  <!--                                                       -->

  <xs:element name="epal-query">
    <xs:complexType>
      <xs:sequence>
        <!-- The user category accessing the data-->
        <xs:element name="user-category" type="epal:referringObjectType"
          minOccurs="1"
          maxOccurs="unbounded"></xs:element>
        <!-- The category of the accessed data -->
        <xs:element name="data-category" type="epal:referringObjectType"
          minOccurs="1"
          maxOccurs="unbounded"></xs:element>
        <!-- The stated purpose of the access -->
        <xs:element name="purpose" type="epal:referringObjectType"
          minOccurs="1"
          maxOccurs="unbounded"></xs:element>
        <!-- The stated operation of the access -->
        <xs:element name="action" type="epal:referringObjectType"
          minOccurs="1"
          maxOccurs="unbounded"></xs:element>
        <!-- The list of XML container instances each corresponding to a container definition. -->
        <xs:element name="container" minOccurs="0" maxOccurs="unbounded">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="attribute" minOccurs="0"
                maxOccurs="unbounded">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="value" type="epal:epalSimpleType"
                      minOccurs="0"
                      maxOccurs="unbounded"/>
                  </xs:sequence>
                  <xs:attribute name="refid" use="required"
                    type="xs:NCName"></xs:attribute>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="refid" type="xs:NCName"/>
          </xs:complexType>
          <!-- Attribute refid's must be unique within each container -->
          <xs:unique name="uniqueAttribute">
            <xs:selector xpath="./epal-interface:attribute"/>
            <xs:field xpath="@refid"/>
          </xs:unique>        
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="epal-ruling">
    <xs:complexType>
      <xs:sequence>
        <!-- The rules that mandated authorized access. -->
        <xs:element name="originating-rule" minOccurs="0"
          maxOccurs="unbounded"
          type="epal:referringObjectType"/>
        <!-- The returned obligations -->
        <xs:element name="obligation" minOccurs="0"
          maxOccurs="unbounded">
          <xs:complexType>
            <xs:complexContent>
              <xs:extension base="epal:referringObjectType">
                <xs:sequence>
                  <!-- The rules that mandated this obligation -->
                  <xs:element name="originating-rule" minOccurs="1"
                    maxOccurs="unbounded"
                    type="epal:referringObjectType"/>
                  <!-- The XML input for each returned obligation -->
                  <xs:element name="parameter" minOccurs="0"
                    maxOccurs="unbounded">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="value"
                          type="epal:epalSimpleType"
                          minOccurs="0"
                          maxOccurs="unbounded"/>
                      </xs:sequence>
                      <xs:attribute name="simpleType" use="required"
                        type="epal:epalSimpleTypeURI"/>
                      <xs:attribute name="refid" use="required"
                        type="xs:NCName"/>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:extension>
            </xs:complexContent>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="ruling">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="allow"/>
            <xs:enumeration value="deny"/>
            <xs:enumeration value="not-applicable"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
    </xs:complexType>
  </xs:element>
</xs:schema>