<?xml version="1.0"?>

<!--Policy in the EPAL language aimed at location based services.  Compare with NewP3P.xml policy.-->

<!--EPAL policy for location based services example-->
<epal-policy default-ruling="deny" 
 version="1.2" xmlns="http://www.research.ibm.com/privacy/epal" 
 xmlns:xs="http://www.w3.org/2001/XMLSchema" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:schemaLocation="http://www.research.ibm.com/privacy/epal epal.xsd 
 http://www.w3.org/2001/XMLSchema xs-dummy.xsd ">
  <policy-information id="AdLocPolicy">
    <short-description language="en">Policy controlling messages sent, location based services rendered, retention, and transfer of location data</short-description>
    <long-description language="en">This policy defines obligations and rules for some aspects of a location based service.
(1) It allows messages to be sent to a user as well as customized maps
(2) It allows transfer of location information about the user provided that (1) only city-level accurate information is given and (2) that the company receiving the data has a privacy policy that is compliant with the provider company
(3)It allows location information to be stored by the company for 24 hours at most
(4) It obligates the provider to give customers full access to all data stored about them.</long-description>

    <issuer>
      <name>LBS Company</name>
      <organization>Penn Security Lab</organization>
      <e-mail>lbs@upenn.edu</e-mail>
      <address>200 South 33rd Street, Philadelphia, PA 19104</address>
      <country>USA</country>
    </issuer>

    <location>http://www.lbs.example.com</location>
    <version-info end-date="2005-07-26T12:00:00"
       last-modified="2004-07-26T12:19:00" 
       start-date="2004-07-26T12:19:00" test="true"/>
  </policy-information>

  <epal-vocabulary-ref id="AdLocVocab" location="http://www.lbs.example.com"/>

  <!--Conditions... What kind of conditions do we need here?-->
  <!-- <condition id="">  </condition> -->
  <condition id="CityOnly">
    <short-description language="en">The location information must only be of city level granularity.  That means that the information for all fields of finer grain than city must be left blank</short-description>
    <predicate refid="http://www.research.ibm.com/privacy/epal#and">
       <!--Room number field is blank-->
       <predicate refid="http://www.research.ibm.com/privacy/epal#string-equal">
          <function refid="http://www.research.ibm.com/privacy/epal#string-bag-to-value">
             <attribute-reference container-refid="LocationContainer" attribute-refid="RoomNum"/>
          </function>
          <attribute-value simpleType="http://www.w3.org/2001/XMLSchema#string">""</attribute-value>
       </predicate>

       <!--Building field is blank-->
       <predicate refid="http://www.research.ibm.com/privacy/epal#string-equal">
          <function refid="http://www.research.ibm.com/privacy/epal#string-bag-to-value">
             <attribute-reference container-refid="LocationContainer" attribute-refid="Building"/>
          </function>
          <attribute-value simpleType="http://www.w3.org/2001/XMLSchema#string">""</attribute-value>          
       </predicate>

       <!--Address field is blank-->
       <predicate refid="http://www.research.ibm.com/privacy/epal#string-equal">
          <function refid="http://www.research.ibm.com/privacy/epal#string-bag-to-value">
             <attribute-reference container-refid="LocationContainer" attribute-refid="Address"/>
          </function>
          <attribute-value simpleType="http://www.w3.org/2001/XMLSchema#string">""</attribute-value>          
       </predicate>

       <!--Postal code field is blank-->
       <predicate refid="http://www.research.ibm.com/privacy/epal#string-equal">
          <function refid="http://www.research.ibm.com/privacy/epal#string-bag-to-value">
             <attribute-reference container-refid="LocationContainer" attribute-refid="PostalCode"/>
          </function>
          <attribute-value simpleType="http://www.w3.org/2001/XMLSchema#string">""</attribute-value>          
       </predicate>

       <!--Latitude field is blank-->
       <predicate refid="http://www.research.ibm.com/privacy/epal#string-equal">
          <function refid="http://www.research.ibm.com/privacy/epal#string-bag-to-value">
             <attribute-reference container-refid="LocationContainer" attribute-refid="Latitude"/>
          </function>
          <attribute-value simpleType="http://www.w3.org/2001/XMLSchema#string">""</attribute-value>          
       </predicate>

       <!--Longitude field is blank-->
       <predicate refid="http://www.research.ibm.com/privacy/epal#string-equal">
          <function refid="http://www.research.ibm.com/privacy/epal#string-bag-to-value">
             <attribute-reference container-refid="LocationContainer" attribute-refid="Longitude"/>
          </function>
          <attribute-value simpleType="http://www.w3.org/2001/XMLSchema#string">""</attribute-value>
       </predicate>
    </predicate>
  </condition>

  <!--Rules-->
  <!--Allows messages and maps to be sent to the subjects as per the contract-->
  <rule id="DeliverData" ruling="allow">
      <short-description language="en">Deliver content and data to the user</short-description>
      <long-description language="en">Allows the delivery of content and data to the user as per the contract</long-description>

      <user-category refid="Root"/>
      <data-category refid="Location"/>
      <purpose refid="Services"/>
      <action refid="SendContent"/>
      <!-- <condition refid="NCName"/> -->
      <obligation refid="GetConsent"/>
  </rule>

  <!--Allows advertising messages to be sent to the subjects if the user has given consent-->
  <rule id="SendAd" ruling="allow">
      <short-description language="en">Send an advertising message</short-description>
      <long-description language="en">Allows the sending of advertising messages if the user has opted in</long-description>

      <user-category refid="Root"/>
      <data-category refid="Location"/>
      <purpose refid="Advertising"/>
      <action refid="SendMessage"/>
      <!-- <condition refid="NCName"/> -->
      <obligation refid="GetConsent"/>
  </rule>

  <!--Allows customer service messages to be sent by the workers without obligation-->
  <rule id="SendCustomerService" ruling="allow">
      <short-description language="en">Send customer service notice</short-description>
      <long-description language="en">Allows the sending of customer service information</long-description>

      <user-category refid="Worker"/>
      <data-category refid="Location"/>
      <purpose refid="CustomerService"/>
      <action refid="SendMessage"/>
      <!-- <condition refid="NCName"/> -->
      <!-- <obligation refid=""/> -->
  </rule>

  <!--Allows the transfer of location information to outside parties provided that only city level information is provided-->
  <rule id="Transfer" ruling="allow">
      <short-description language="en">Transfer location information</short-description>
      <long-description language="en">Allows the transfer of location information by a managero only if the data is reduced to city-level accuracy and the receiving company has a policy that has been checked</long-description>

      <user-category refid="Manager"/>
      <data-category refid="Location"/>
      <purpose refid="Root"/>
      <action refid="Transfer"/>
      <condition refid="CityOnly"/> -->
      <obligation refid="CheckOutsidePolicy"/>
  </rule>

 <!--Allows data storage for only 24 hours-->
  <rule id="24HrRetain" ruling="allow">
      <short-description language="en">Retention for only 24 hours</short-description>
      <long-description language="en">Allows the retention of data only for 24 hours, after which data must be destroyed</long-description>

      <user-category refid="Worker"/>
      <data-category refid="Location"/>
      <purpose refid="Internal"/>
      <action refid="Store"/>
      <!-- <condition refid="NCName"/> -->
      <obligation refid="24HourRetain"/>
      <obligation refid="GrantAccess"/>
  </rule>
</epal-policy>