<?xml version='1.0' encoding='ISO-8859-1'?> 
<!DOCTYPE uridef[
  <!ENTITY rdf     "http://www.w3.org/1999/02/22-rdf-syntax-ns">
  <!ENTITY rdfs    "http://www.w3.org/2000/01/rdf-schema">
  <!ENTITY xsd     "http://www.w3.org/2001/XMLSchema">
  <!ENTITY daml    "http://www.daml.org/2001/03/daml+oil">
  <!ENTITY dex     "http://www.daml.org/2001/03/daml+oil-ex">
  <!ENTITY exd     "http://www.daml.org/2001/03/daml+oil-ex-dt">
  <!ENTITY service "http://www.daml.org/services/daml-s/0.9/Service.daml">
  <!ENTITY process "http://www.daml.org/services/daml-s/0.9/Process.daml">
  <!ENTITY time    "http://www.ai.sri.com/~daml/ontologies/time/Time.daml">
  <!ENTITY congo   "http://www.daml.org/services/daml-s/0.9/CongoService.daml"> 
  <!ENTITY congodf    "http://www.daml.org/services/daml-s/0.9/CongoProcessDataFlow.daml"> 
  <!ENTITY DEFAULT "http://www.daml.org/services/daml-s/0.9/CongoProcess.daml"> 
  <!ENTITY THIS    "http://www.daml.org/services/daml-s/0.9/CongoProcess.daml"> 
]>


<rdf:RDF
  xmlns:rdf =     "&rdf;#"
  xmlns:rdfs =    "&rdfs;#"
  xmlns:xsd =     "&xsd;#"
  xmlns:daml =    "&daml;#"
  xmlns:dex =     "&dex;#"
  xmlns:exd =     "&exd;#"
  xmlns:congodf = "&congodf;#"
  xmlns:service = "&service;#"
  xmlns:process = "&process;#"
  xmlns:time =    "&time;#"
  xmlns =         "&DEFAULT;#"
>

<daml:Ontology rdf:about="">
  <daml:versionInfo>
    $Id: CongoProcess.daml,v 1.32 2003/07/29 22:35:24 martin Exp $
  </daml:versionInfo>
  <rdfs:comment>

      A B2C bookbuying example of DAML-S (DARPA Agent Markup Language
      for Services; see http://www.daml.org/services/) usage, illustrating a
      simple use of the process model.  

      NOTE:  This is a sketch; not a complete example.  It is designed
      to illustrate the usage of the process model ontology.

      The service described here is a book buying (or selling, depending
      on your perspective) service from www.congo.com.  We present two
      forms of the service.  First, there's a one-step form, CongoBuy,
      with the service treated as ATOMIC; i.e., no interactions between
      buying and selling agents are required, apart from invocation of the
      service and receipt of its outputs by the buyer.  Given certain inputs
      and preconditions, the service provides certain outputs and has specific
      effects.  

      Second, a full-fledged version of the service is specified,
      showing its composition from its component services. 
      The full-fledged version of the service, FullCongoBuy,
      includes an arrangement of subprocesses LocateBook, PutInCart, SignIn, 
      CreateAcct, CreateProfile, LoadProfile, SpecifyDeliveryDetails, 
      FinalizeBuy each with its own specification of inputs and outputs. 

      Note: Input, output, precondition, and effect properties of *composite*
      processes can, in principle, be automatically generated by tools.
      Since such tools don't yet exist, they have been manually generated
      for this example.


        Original Congo example created by Srini Narayanan (srini@ai.sri.com).
        Major modifications by  Mark Burstein, David Martin, Sheila McIlraith,
        Srini Narayanan, Terri Payne.
  </rdfs:comment>
  <daml:imports rdf:resource="&daml;"/>
  <daml:imports rdf:resource="&time;"/>
  <daml:imports rdf:resource="&service;"/>
  <daml:imports rdf:resource="&process;"/>
  <daml:imports rdf:resource="&congodf;"/>
</daml:Ontology>

<!--###################################################
    DATA TYPES
    ###################################################-->

<daml:Class rdf:ID="CreditCardType">
  <daml:oneOf rdf:parseType="daml:collection">
    <CreditCardType rdf:ID="MasterCard"/>
    <CreditCardType rdf:ID="VISA"/>
    <CreditCardType rdf:ID="AmericanExpress"/>
    <CreditCardType rdf:ID="DiscoverCard"/>
   </daml:oneOf>
</daml:Class>

<daml:Class rdf:ID="PackagingType">
  <daml:oneOf rdf:parseType="daml:collection">
    <PackagingType rdf:ID="Giftwrap"/>
    <PackagingType rdf:ID="Ordinary"/>
  </daml:oneOf>
</daml:Class>

<daml:Class rdf:ID="DeliveryType">
  <daml:oneOf rdf:parseType="daml:collection">
    <DeliveryType rdf:ID="FedExOneDay"/>
    <DeliveryType rdf:ID="FedEx2-3day"/>
    <DeliveryType rdf:ID="UPS"/>
    <DeliveryType rdf:ID="OrdinaryMail"/>
  </daml:oneOf>
</daml:Class>

<daml:Class rdf:ID="ValidityType">
  <daml:oneOf rdf:parseType="daml:collection">
    <ValidityType rdf:ID="Valid"/>
    <ValidityType rdf:ID="Expired"/>
    <ValidityType rdf:ID="InvalidCCNumber"/>
    <ValidityType rdf:ID="InvalidCCType"/>
    <ValidityType rdf:ID="AuthorizationRefused"/>
  </daml:oneOf>
</daml:Class>


<!-- ###########################################
     Conditions used in the Congo example
     ###########################################
-->

<daml:Class rdf:ID="BookInStock">
  <rdfs:subClassOf rdf:resource="&process;#Condition"/>
</daml:Class>

<daml:Class rdf:ID="BookOutStock">
  <rdfs:subClassOf rdf:resource="&process;#Condition"/>
</daml:Class>

<!-- ###########################################
     Stubs for other datatypes
     ###########################################
-->

<daml:Class rdf:ID="Book">
  <rdfs:subClassOf rdf:resource="&daml;#Thing"/>
</daml:Class>

<daml:Class rdf:ID="OrderShippedOutput">
  <rdfs:subClassOf rdf:resource="&daml;#Thing"/>
</daml:Class>

<daml:Class rdf:ID="OrderShippedEffect">
  <rdfs:subClassOf rdf:resource="&daml;#Thing"/>
</daml:Class>

<daml:Class rdf:ID="BookOutStockOutput">
  <rdfs:subClassOf rdf:resource="&daml;#Thing"/>
</daml:Class>

<daml:Class rdf:ID="SignInData">
  <rdfs:subClassOf rdf:resource="&daml;#Thing"/>
</daml:Class>

<rdf:Property rdf:ID="acctName">
  <rdfs:domain rdf:resource="#SignInData"/>
  <rdfs:range rdf:resource="&xsd;#string"/>
</rdf:Property>

<rdf:Property rdf:ID="password">
  <rdfs:domain rdf:resource="#SignInData"/>
  <rdfs:range rdf:resource="&xsd;#string"/>
</rdf:Property>

<daml:Class rdf:ID="ProfileInfo">
  <rdfs:subClassOf rdf:resource="&daml;#Thing"/>
</daml:Class>

<daml:Class rdf:ID="AcctInfo">
 <daml:unionOf rdf:parseType="daml:collection">
    <daml:Class rdf:about="#SignInData"/>
    <daml:Class rdf:about="#ProfileInfo"/>
 </daml:unionOf>
</daml:Class>

<daml:Class rdf:ID="ENotify">
  <rdfs:subClassOf rdf:resource="&daml;#Thing"/>
</daml:Class>

<daml:Class rdf:ID="CreateAcctOutputType">
 <daml:unionOf rdf:parseType="daml:collection">
    <daml:Class rdf:about="#AcctInfo"/>
    <daml:Class rdf:about="#ENotify"/>
 </daml:unionOf>
</daml:Class>

<!-- Shopping cart
Holding the books is the Cart Class defined below 
various processes like AddToCart, RemoveFromCart, itemInCart?, 
etc can be defined using the Cart Class as the structure manipulated.
So the ouput/effect of these processes would manipulate the cart to
add, delete items.  (These manipulations are not yet specified here.)
-->

<daml:Class rdf:ID="Cart">
  <daml:intersectionOf rdf:parseType="daml:collection">
    <daml:Class rdf:about="&daml;#List"/>
    <daml:Restriction>
      <daml:onProperty rdf:resource="&daml;#item"/>
      <daml:toClass rdf:resource="#Book"/>
    </daml:Restriction>
  </daml:intersectionOf>
</daml:Class>


<!--###################################################
    ProcessModel instances
    ###################################################-->

<process:ProcessModel rdf:ID="ExpressCongoBuyProcessModel">
  <service:describes rdf:resource="&congo;#ExpressCongoBuyService"/>
  <process:hasProcess rdf:resource="#ExpressCongoBuy"/>
</process:ProcessModel>

<process:ProcessModel rdf:ID="FullCongoBuyProcessModel">
  <service:describes rdf:resource="&congo;#FullCongoBuyService"/>
  <process:hasProcess rdf:resource="#FullCongoBuy"/>
</process:ProcessModel>

<!--###################################################
    ###################################################
    THE ATOMIC PROCESS ExpressCongoBuy
    ###################################################
    ###################################################-->

<!-- This is an express "one shot" service for buying a book
  with Congo.  It takes as input a Book ISBN number and
  the customer's sign-in information, and has the effect of
  ordering the book if the book is in stock.  In this case,
  the output of the service is to a message saying the book 
  is ordered.  If the book is not in stock, the output says 
  that the book is out of stock. 
-->

<daml:Class rdf:ID="ExpressCongoBuy">
  <rdfs:subClassOf rdf:resource="&process;#AtomicProcess"/>
</daml:Class>

<!-- Inputs -->

<rdf:Property rdf:ID="congoBuyBookISBN">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#ExpressCongoBuy"/>
  <rdfs:range rdf:resource="&xsd;#string"/>
</rdf:Property>

<rdf:Property rdf:ID="congoBuySignInInfo">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#ExpressCongoBuy"/>
  <rdfs:range rdf:resource="#SignInData"/>
</rdf:Property>

<!-- 
2 Preconditions: AccountExists and CreditExists.
-->

<daml:Class rdf:ID="CreditExists">
  <rdfs:subClassOf rdf:resource="&process;#Condition"/>
</daml:Class>

<daml:Class rdf:ID="AcctExists">
  <rdfs:subClassOf rdf:resource="&process;#Condition"/>
</daml:Class>

<rdf:Property rdf:ID="congoBuyAcctExistsPrecondition">
  <rdfs:subPropertyOf rdf:resource="&process;#precondition"/>
  <rdfs:domain rdf:resource="#ExpressCongoBuy"/>
  <rdfs:range rdf:resource="#AcctExists"/>
</rdf:Property>

<rdf:Property rdf:ID="congoBuyCreditExistsPrecondition">
  <rdfs:subPropertyOf rdf:resource="&process;#precondition"/>
  <rdfs:domain rdf:resource="#ExpressCongoBuy"/>
  <rdfs:range rdf:resource="#CreditExists"/>
</rdf:Property>

<!-- Other parameters -->


<!-- If the book is in stock, then the effect is that the
	 order was shipped and there is an associated output.
	 If the book is out of stock, then there is no effect
	 and the output there is an output indicating that the
	 book is out of stock.

     What follows is an example of how to create conditional
     outputs and effects using anonymous subclasses (via the
     use of DAML+OIL "Restriction").  We contrast this with the
     explicit naming of the "ConditionalOutput" and "ConditionalEffect"
     subclasses, respectively, that would serve as an alternative
     encoding.  The locateBookOutput property and associated LocateBook
     class, which is a subclass of ConditionalOutput, is an example
     of the explicit naming.  In general, this may be inefficient as
     it creates superfluous named classes.  We recommend the approach
     below.
-->
<daml:Property rdf:ID="congoOrderShippedEffect">
  <rdfs:subPropertyOf rdf:resource="&process;#effect"/>
  <rdfs:domain rdf:resource="#ExpressCongoBuy"/>
  <rdfs:range>
    <daml:Class>
        <rdfs:subClassOf rdf:resource="&process;#ConditionalEffect"/>
        <rdfs:subClassOf>
           <daml:Restriction>
              <daml:onProperty rdf:resource="&process;#ceCondition"/>
              <daml:toClass rdf:resource="#BookInStock"/>
           </daml:Restriction>
        </rdfs:subClassOf>
        <rdfs:subClassOf>
           <daml:Restriction>
              <daml:onProperty rdf:resource="&process;#ceEffect"/>
              <daml:toClass rdf:resource="#OrderShippedEffect"/>
           </daml:Restriction>
        </rdfs:subClassOf>
   </daml:Class>
  </rdfs:range>
</daml:Property>

<daml:Property rdf:ID="congoOrderShippedOutput">
  <rdfs:subPropertyOf rdf:resource="&process;#output"/>
  <rdfs:domain rdf:resource="#ExpressCongoBuy"/>
  <rdfs:range>
    <daml:Class>
       <rdfs:subClassOf rdf:resource="&process;#ConditionalOutput"/>
       <rdfs:subClassOf>
          <daml:Restriction>
            <daml:onProperty rdf:resource="&process;#coCondition"/>
            <daml:toClass rdf:resource="#BookInStock"/>
          </daml:Restriction>
       </rdfs:subClassOf>
       <rdfs:subClassOf>
         <daml:Restriction>
           <daml:onProperty rdf:resource="&process;#coOutput"/>
           <daml:toClass rdf:resource="#OrderShippedOutput"/>
         </daml:Restriction>
      </rdfs:subClassOf>
    </daml:Class>
 </rdfs:range>
</daml:Property>

<daml:Property rdf:ID="congoOutOfStockOutput">
  <rdfs:subPropertyOf rdf:resource="&process;#output"/>
  <rdfs:range>
     <daml:Class>
        <rdfs:subClassOf rdf:resource="&process;#ConditionalOutput"/>
        <rdfs:subClassOf>
          <daml:Restriction>
             <daml:onProperty rdf:resource="&process;#coCondition"/>
             <daml:toClass rdf:resource="#BookOutStock"/>
          </daml:Restriction>
        </rdfs:subClassOf>
        <rdfs:subClassOf>
           <daml:Restriction>
              <daml:onProperty rdf:resource="&process;#coOutput"/>
              <daml:toClass rdf:resource="#BookOutStockOutput"/>
           </daml:Restriction>
        </rdfs:subClassOf>
      </daml:Class>
   </rdfs:range>
</daml:Property>



<!--###################################################
    ###################################################
    THE COMPOSITE PROCESS: FullCongoBuy
    ###################################################
    ###################################################-->

<!-- 

Now for the full-fledged book-buying process, FullCongoBuy. This
is more complicated since it has to specify the process schema
including alternatives, conditional executions, etc. 

We build the class recursively in a top-down manner. The basic idea is
that each CompositeProcess is composedOf a ControlConstruct, which may
be a Sequence, Alternative, If-then-else, etc.  Each such
ConstrolConstruct, in turn, has a "components" property (a list or
bag), which specifies the classes of the subcomponents of the
ControlConstruct. These classes may themselves be processes or control
constructs.  Finally we bottom out when the components of a composite
process are atomic processes.

In the Congo example we assume the following basic structure for the
composition. The main steps are to locate a book and to then buy
it. While (for exposition) we assume that the locate book is an atomic
process (without components), the buying of a book involves a sequence
of subprocesses that correspond to specifying a payment method,
specifying the details of delivery (address, wrapping type, etc.) and
finalizing the buy process. These are the component subprocesses of
the sequence corresponding to the full-fledged buying process. The
detailed buying sequence involves a sequence of component
sub-processes corresponding to putting the book into a cart, followed
by a signing-in choice, followed by a method of payment selection. The
signing-in choice process is itself a composite process which offers
the alternatives of signing in as a new user (creating an account) or
using a stored profile instead. Each of these processes is itself
composite, bottoming out in a sequence of atomic processes
corresponding to signing in or creating a new account/profile.  -->

<!-- 
The top level process is a composite process.

It is composed of a sequence whose components are an atomic
process, LocateBook and a composite process CongoBuyBook.

It expects exactly 1 instance of many of its input and output
properties.

Each of the individual processes described in FullCongoBuy are
described later in this document.
-->
<!--###################################################
    Control structure for FullCongoBuy
    ###################################################-->

<daml:Class rdf:ID="FullCongoBuy">   
  <rdfs:subClassOf rdf:resource="&process;#CompositeProcess"/>
  <rdfs:subClassOf>
    <daml:Restriction> 
      <daml:onProperty rdf:resource="&process;#composedOf"/>
      <daml:toClass>
        <daml:Class>
        <daml:intersectionOf rdf:parseType="daml:collection">
          <daml:Class rdf:about="&process;#Sequence"/>
            <daml:Restriction> 
              <daml:onProperty rdf:resource="&process;#components"/>
              <daml:toClass>
                <daml:Class>
                  <process:listOfInstancesOf rdf:parseType="daml:collection">
                    <daml:Class rdf:about="#LocateBook"/>
                    <daml:Class rdf:about="#CongoBuyBook"/>
                  </process:listOfInstancesOf>
                </daml:Class>
              </daml:toClass>
            </daml:Restriction>
          </daml:intersectionOf>
        </daml:Class>
      </daml:toClass>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#fullCongoBuyBookName"/>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#fullCongoBuyBookISBN"/>
    </daml:Restriction>
  </rdfs:subClassOf>
    <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#fullCongoBuyCreditCardNumber"/>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#fullCongoBuyCreditCardType"/>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#fullCongoBuyCreditCardExpirationDate"/>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#fullCongoBuyDeliveryAddress"/>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#fullCongoBuyPackagingSelection"/>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#fullCongoBuyDeliveryTypeSelection"/>
    </daml:Restriction>
  </rdfs:subClassOf>
</daml:Class>


<!-- The following inputs and outputs of FullCongoBuy are derived
from the corresponding inputs and outputs of its atomic subprocesses
(as indicated by their sameValues properties), and will normally
be computed automatically by DAML-S tools.  For example,
FullCongoBuy uses an input, congoBuyBookName, that's the same as
the bookName input to atomic process LocateBook.    What follows
is a partial example of these inputs and outputs.-->

<rdf:Property rdf:ID="fullCongoBuyBookName">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#FullCongoBuy"/>
  <rdfs:range rdf:resource="&xsd;#string"/>
</rdf:Property>

<!--  The book ISBN is a Conditional Output of FullCongoBuy.  
      The ISBN number is output if the book is in Congo's catalogue.
      This is the way that we are creating most of the markup with
      DAML-S version 0.9.  If you look at the locateBookOutput
      property described with the atomic processes at the end of
      this file, you will see one example of how to actually specify
      the contingent truth values of the condition BookInCatalogueP.
      This extra detail was provided for illustrative purposes, and
      is not to be adopted uniformly for version 0.9.
  -->

<daml:Property rdf:ID="fullCongoBuyBookISBNOutput">
  <rdfs:subPropertyOf rdf:resource="&process;#output"/>
  <rdfs:range>
    <daml:Class>
       <rdfs:subClassOf rdf:resource="&process;#ConditionalOutput"/>
       <rdfs:subClassOf>
          <daml:Restriction>
            <daml:onProperty rdf:resource="&process;#coCondition"/>
            <daml:toClass rdf:resource="#BookInCatalogueP"/>
          </daml:Restriction>
       </rdfs:subClassOf>
       <rdfs:subClassOf>
         <daml:Restriction>
           <daml:onProperty rdf:resource="&process;#coOutput"/>
           <daml:toClass rdf:resource="#fullCongoBuyBookISBN"/>
         </daml:Restriction>
      </rdfs:subClassOf>
    </daml:Class>
 </rdfs:range>
</daml:Property>


<rdf:Property rdf:ID="fullCongoBuySignInInfo">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#FullCongoBuy"/>
  <rdfs:range rdf:resource="#SignInData"/>
</rdf:Property>

<rdf:Property rdf:ID="fullCongoBuyCreateAcctInfo">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#FullCongoBuy"/>
  <rdfs:range rdf:resource="#AcctInfo"/>
</rdf:Property>

<rdf:Property rdf:ID="fullCongoBuyCreditCardNumber">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#FullCongoBuy"/>
  <rdfs:range rdf:resource="&xsd;#decimal"/>
</rdf:Property>

<rdf:Property rdf:ID="fullCongoBuyCreditCardType">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#FullCongoBuy"/>
  <rdfs:range rdf:resource="#CreditCardType"/>   
</rdf:Property>

<rdf:Property rdf:ID="fullCongoBuyCreditCardExpirationDate">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#FullCongoBuy"/>
  <rdfs:range rdf:resource="&time;#Instant"/>
</rdf:Property>

<rdf:Property rdf:ID="fullCongoBuyDeliveryAddress">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#FullCongoBuy"/>
  <rdfs:range rdf:resource="&xsd;#string"/>
</rdf:Property>

<rdf:Property rdf:ID="fullCongoBuyPackagingSelection">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#FullCongoBuy"/>
  <rdfs:range rdf:resource="#PackagingType"/>
</rdf:Property>

<rdf:Property rdf:ID="fullCongoBuyDeliveryTypeSelection">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#FullCongoBuy"/>
  <rdfs:range rdf:resource="#DeliveryType"/>
</rdf:Property>

<!-- Here is an example of an *un*conditional output.  -->

<daml:Property rdf:ID="fullCongoBuyCreateAcctOutput">
  <rdfs:subPropertyOf rdf:resource="&process;#output"/>
  <rdfs:domain rdf:resource="#FullCongoBuy"/>
  <rdfs:range>
    <daml:Class>
       <rdfs:subClassOf rdf:resource="&process;#UnConditionalOutput"/>
       <rdfs:subClassOf>
         <daml:Restriction>
           <daml:onProperty rdf:resource="&process;#coOutput"/>
           <daml:toClass rdf:resource="#CreateAcctOutputType"/>
         </daml:Restriction>
      </rdfs:subClassOf>
    </daml:Class>
 </rdfs:range>
</daml:Property>

<!--###################################################
    Control structure for CongoBuyBook
    ###################################################-->

<!-- CongoBuyBook is a sequence whose components are a composite
process, BuySequence, followed by two atomic processes
SpecifyDeliveryDetails, and then FinalizeBuy -->


<daml:Class rdf:ID="CongoBuyBook">           
  <rdfs:subClassOf rdf:resource="&process;#CompositeProcess"/>
  <rdfs:subClassOf>
    <daml:Restriction> 
      <daml:onProperty rdf:resource="&process;#composedOf"/>
      <daml:toClass>
       <daml:Class>
        <daml:intersectionOf rdf:parseType="daml:collection">
          <daml:Class rdf:about="&process;#Sequence"/>
          <daml:Restriction> 
            <daml:onProperty rdf:resource="&process;#components"/>
            <daml:toClass>
             <daml:Class>
              <process:listOfInstancesOf rdf:parseType="daml:collection">
                <daml:Class rdf:about="#BuySequence"/>
                <daml:Class rdf:about="#SpecifyDeliveryDetails"/>
                <daml:Class rdf:about="#FinalizeBuy"/>
              </process:listOfInstancesOf>
             </daml:Class>
            </daml:toClass>
          </daml:Restriction>
        </daml:intersectionOf>
       </daml:Class>
      </daml:toClass>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#congoBuyBookBookISBN"/>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#congoBuyBookCreditCardNumber"/>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#congoBuyBookCreditCardType"/>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#congoBuyBookCreditCardExpirationDate"/>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#congoBuyBookDeliveryAddress"/>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#congoBuyBookPackagingSelection"/>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#congoBuyBookDeliveryTypeSelection"/>
    </daml:Restriction>
  </rdfs:subClassOf>
</daml:Class>

<!-- The following inputs and outputs of CongoBuyBook are derived
from the corresponding inputs and outputs of its atomic subprocesses
be computed automatically by DAML-S tools. -->

<rdf:Property rdf:ID="congoBuyBookBookISBN">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#CongoBuyBook"/>
  <rdfs:range rdf:resource="&xsd;#string"/>
</rdf:Property>

<rdf:Property rdf:ID="congoBuyBookCreateAcctInfo">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#CongoBuyBook"/>
  <rdfs:range rdf:resource="#AcctInfo"/>
</rdf:Property>

<daml:Property rdf:ID="congoBuyBookCreateAcctOutput">
  <rdfs:subPropertyOf rdf:resource="&process;#output"/>
  <rdfs:domain rdf:resource="#CongoBuyBook"/>
  <rdfs:range>
    <daml:Class>
       <rdfs:subClassOf rdf:resource="&process;#UnConditionalOutput"/>
       <rdfs:subClassOf>
         <daml:Restriction>
           <daml:onProperty rdf:resource="&process;#coOutput"/>
           <daml:toClass rdf:resource="#CreateAcctOutputType"/>
         </daml:Restriction>
      </rdfs:subClassOf>
    </daml:Class>
 </rdfs:range>
</daml:Property>


<rdf:Property rdf:ID="congoBuyBookSignInInfo">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#CongoBuyBook"/>
  <rdfs:range rdf:resource="#SignInData"/>
</rdf:Property>


<rdf:Property rdf:ID="congoBuyBookCreditCardNumber">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#CongoBuyBook"/>
  <rdfs:range rdf:resource="&xsd;#string"/>
</rdf:Property>

<rdf:Property rdf:ID="congoBuyBookCreditCardType">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#CongoBuyBook"/>
  <rdfs:range rdf:resource="#CreditCardType"/>   
</rdf:Property>

<rdf:Property rdf:ID="congoBuyBookCreditCardExpirationDate">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#CongoBuyBook"/>
  <rdfs:range rdf:resource="&time;#Instant"/>
</rdf:Property>

<rdf:Property rdf:ID="congoBuyBookDeliveryAddress">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#CongoBuyBook"/>
  <rdfs:range rdf:resource="&xsd;#string"/>
</rdf:Property>

<rdf:Property rdf:ID="congoBuyBookPackagingSelection">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#CongoBuyBook"/>
  <rdfs:range rdf:resource="#PackagingType"/>
</rdf:Property>

<rdf:Property rdf:ID="congoBuyBookDeliveryTypeSelection">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#CongoBuyBook"/>
  <rdfs:range rdf:resource="#DeliveryType"/>
</rdf:Property>

<!--###################################################
    Control structure for BuySequence
    ###################################################-->

<!-- 
BuySequence is a sequence whose components are an atomic
process PutInCart, followed by a composite process SignInAlternatives, followed
by an atomic process SpecifyPaymentMethod 
-->

<daml:Class rdf:ID="BuySequence">           
  <rdfs:subClassOf rdf:resource="&process;#CompositeProcess"/>
  <rdfs:subClassOf>
    <daml:Restriction> 
      <daml:onProperty rdf:resource="&process;#composedOf"/>
      <daml:toClass>
        <daml:Class>
          <daml:intersectionOf rdf:parseType="daml:collection">
            <daml:Class rdf:about="&process;#Sequence"/>
            <daml:Restriction> 
              <daml:onProperty rdf:resource="&process;#components"/>
              <daml:toClass>
                <daml:Class>
                  <process:listOfInstancesOf rdf:parseType="daml:collection">
                    <daml:Class rdf:about="#PutInCart"/>
                    <daml:Class rdf:about="#SignInAlternatives"/>
                    <daml:Class rdf:about="#SpecifyPaymentMethod"/>
                  </process:listOfInstancesOf>
                </daml:Class>
              </daml:toClass>
            </daml:Restriction>
          </daml:intersectionOf>
        </daml:Class>
      </daml:toClass>
    </daml:Restriction> 
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#buySequenceBookISBN"/>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#buySequenceCreditCardNumber"/>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#buySequenceCreditCardType"/>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#buySequenceCreditCardExpirationDate"/>
    </daml:Restriction>
  </rdfs:subClassOf>
</daml:Class>

<!-- The following inputs and outputs of BuySequence are derived
from the corresponding inputs and outputs of its atomic subprocesses
be computed automatically by DAML-S tools. -->

<rdf:Property rdf:ID="buySequenceBookISBN">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#BuySequence"/>
  <rdfs:range rdf:resource="&xsd;#string"/>
</rdf:Property>

<rdf:Property rdf:ID="buySequenceCreateAcctInfo">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#BuySequence"/>
  <rdfs:range rdf:resource="#AcctInfo"/>
</rdf:Property>

<daml:Property rdf:ID="buySequenceCreateAcctOutput">
  <rdfs:subPropertyOf rdf:resource="&process;#output"/>
  <rdfs:domain rdf:resource="#BuySequence"/>
  <rdfs:range>
    <daml:Class>
       <rdfs:subClassOf rdf:resource="&process;#UnConditionalOutput"/>
       <rdfs:subClassOf>
         <daml:Restriction>
           <daml:onProperty rdf:resource="&process;#coOutput"/>
           <daml:toClass rdf:resource="#CreateAcctOutputType"/>
         </daml:Restriction>
      </rdfs:subClassOf>
    </daml:Class>
 </rdfs:range>
</daml:Property>


<rdf:Property rdf:ID="buySequenceSignInInfo">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#BuySequence"/>
  <rdfs:range rdf:resource="#SignInData"/>
</rdf:Property>

<rdf:Property rdf:ID="buySequenceCreditCardNumber">
  <rdfs:comment>NOTE: INTEGER IS NOT SUPPORTED YET IN DAML+OIL </rdfs:comment>
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#BuySequence"/>
  <rdfs:range rdf:resource="&xsd;#decimal"/>
</rdf:Property>

<rdf:Property rdf:ID="buySequenceCreditCardType">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#BuySequence"/>
  <rdfs:range rdf:resource="#CreditCardType"/>   
</rdf:Property>

<rdf:Property rdf:ID="buySequenceCreditCardExpirationDate">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#BuySequence"/>
  <rdfs:range rdf:resource="&time;#Instant"/>
</rdf:Property>

<!-- SignInAlternatives is a choice whose components are a composite
process CreateAcctSequence and a composite process SignInSequence 
-->

<daml:Class rdf:ID="SignInAlternatives">           
  <rdfs:subClassOf rdf:resource="&process;#CompositeProcess"/>
  <rdfs:subClassOf>
    <daml:Restriction> 
      <daml:onProperty rdf:resource="&process;#composedOf"/>
      <daml:toClass>
        <daml:Class>
          <daml:intersectionOf rdf:parseType="daml:collection">
            <daml:Class rdf:about="&process;#Choice"/>
            <daml:Restriction> 
              <daml:onProperty rdf:resource="&process;#components"/>
              <daml:toClass>
                <daml:Class>
                  <process:listOfInstancesOf rdf:parseType="daml:collection">
                    <daml:Class rdf:about="#CreateAcctSequence"/>
                    <daml:Class rdf:about="#SignInSequence"/>
                  </process:listOfInstancesOf>
                </daml:Class>
              </daml:toClass>
            </daml:Restriction>
          </daml:intersectionOf>
        </daml:Class>
      </daml:toClass>
    </daml:Restriction>
  </rdfs:subClassOf>
</daml:Class>

<!-- The following inputs and outputs of SignInAlternatives are derived
from the corresponding inputs and outputs of its atomic subprocesses
be computed automatically by DAML-S tools. -->

<rdf:Property rdf:ID="signInAlternativesCreateAcctInfo">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#SignInAlternatives"/>
  <rdfs:range rdf:resource="#AcctInfo"/>
</rdf:Property>

<daml:Property rdf:ID="signInAlternativesCreateAcctOutput">
  <rdfs:subPropertyOf rdf:resource="&process;#output"/>
  <rdfs:domain rdf:resource="#SignInAlternatives"/>
  <rdfs:range>
    <daml:Class>
       <rdfs:subClassOf rdf:resource="&process;#UnConditionalOutput"/>
       <rdfs:subClassOf>
         <daml:Restriction>
           <daml:onProperty rdf:resource="&process;#coOutput"/>
           <daml:toClass rdf:resource="#CreateAcctOutputType"/>
         </daml:Restriction>
      </rdfs:subClassOf>
    </daml:Class>
 </rdfs:range>
</daml:Property>


<rdf:Property rdf:ID="signInAlternativesSignInInfo">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#SignInAlternatives"/>
  <rdfs:range rdf:resource="#SignInData"/>
</rdf:Property>

<!-- 
SignInSequence is a sequence whose components are an atomic process SignIn
followed by an atomic process LoadProfile 
-->

<daml:Class rdf:ID="SignInSequence">
  <rdfs:subClassOf rdf:resource="&process;#CompositeProcess"/>
  <rdfs:subClassOf>
    <daml:Restriction> 
      <daml:onProperty rdf:resource="&process;#composedOf"/>
      <daml:toClass>
        <daml:Class>
          <daml:intersectionOf rdf:parseType="daml:collection">
            <daml:Class rdf:about="&process;#Sequence"/>
            <daml:Restriction> 
              <daml:onProperty rdf:resource="&process;#components"/>
              <daml:toClass>
                <daml:Class>
                  <process:listOfInstancesOf rdf:parseType="daml:collection">
                    <daml:Class rdf:about="#SignIn"/>
                    <daml:Class rdf:about="#LoadProfile"/>
                  </process:listOfInstancesOf>
                </daml:Class>
              </daml:toClass>
            </daml:Restriction>
          </daml:intersectionOf>
        </daml:Class>
      </daml:toClass>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#signInSequenceSignInInfo"/>
    </daml:Restriction>
  </rdfs:subClassOf>
</daml:Class>

<!-- The following input of SignInSequence are derived
from the corresponding inputs and outputs of its atomic subprocesses
be computed automatically by DAML-S tools. -->

<rdf:Property rdf:ID="signInSequenceSignInInfo">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#SignInSequence"/>
  <rdfs:range rdf:resource="#SignInData"/>
</rdf:Property>

<!-- 

CreateAcctSequence is a sequence whose components are an atomic
process CreateAcct followed by an atomic process CreateProfile and an
atomic process LoadProfile.

-->

<daml:Class rdf:ID="CreateAcctSequence">
  <rdfs:subClassOf rdf:resource="&process;#CompositeProcess"/>
  <rdfs:subClassOf>
    <daml:Restriction> 
      <daml:onProperty rdf:resource="&process;#composedOf"/>
      <daml:toClass>
        <daml:Class>
          <daml:intersectionOf rdf:parseType="daml:collection">
            <daml:Class rdf:about="&process;#Sequence"/>
            <daml:Restriction> 
              <daml:onProperty rdf:resource="&process;#components"/>
              <daml:toClass>
                <daml:Class>
                  <process:listOfInstancesOf rdf:parseType="daml:collection">
                    <daml:Class rdf:about="#CreateAcct"/>
                    <daml:Class rdf:about="#CreateProfile"/>
                    <daml:Class rdf:about="#LoadProfile"/>
                  </process:listOfInstancesOf>
                </daml:Class>
              </daml:toClass>
            </daml:Restriction>
          </daml:intersectionOf>
        </daml:Class>
      </daml:toClass>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#createAcctSequenceCreateAcctInfo"/>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#createAcctSequenceCreateAcctOutput"/>
    </daml:Restriction>
  </rdfs:subClassOf>
</daml:Class>

<!-- The following inputs and outputs of CreateAcctSequence are
derived from the corresponding inputs and outputs of its atomic
will normally be computed automatically by DAML-S tools. -->

<rdf:Property rdf:ID="createAcctSequenceCreateAcctInfo">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#CreateAcctSequence"/>
  <rdfs:range rdf:resource="#AcctInfo"/>
</rdf:Property>

<daml:Property rdf:ID="createAcctSequenceCreateAcctOutput">
  <rdfs:subPropertyOf rdf:resource="&process;#output"/>
  <rdfs:domain rdf:resource="#CreateAcctSequence"/>
  <rdfs:range>
    <daml:Class>
       <rdfs:subClassOf rdf:resource="&process;#UnConditionalOutput"/>
       <rdfs:subClassOf>
         <daml:Restriction>
           <daml:onProperty rdf:resource="&process;#coOutput"/>
           <daml:toClass rdf:resource="#CreateAcctOutputType"/>
         </daml:Restriction>
      </rdfs:subClassOf>
    </daml:Class>
 </rdfs:range>
</daml:Property>

<!--###################################################
    ###################################################
    THE ATOMIC PROCESSES (used by FullCongoBuy)
    ###################################################
    ###################################################-->

<!-- ATOMIC PROCESSES -->


<!-- The following processes are the Web-accessible programs that Congo
Inc. is making available at its web site.  They form the building
blocks for the composite service FullCongoBuy -->


<daml:Class rdf:ID="LocateBook">
  <rdfs:subClassOf rdf:resource="&process;#AtomicProcess"/>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#bookName"/>
    </daml:Restriction>
  </rdfs:subClassOf>
</daml:Class>

<rdf:Property rdf:ID="bookName">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#LocateBook"/>
  <rdfs:range rdf:resource="&xsd;#string"/>
</rdf:Property>

<!-- If the book described by "bookName" is in Congo's catalogue,
  then the output of LocateBook is the description of the book and the
  prices.  If the book is not in Congo's catalogues, then the output is
  a message to this effect.  The output of LocateBook is thus described
  as a conditional output.  We illustrate the notion of a conditional
  output below in terms of the bookDescription.
 -->

<!-- A NOTE ABOUT THE MARKUP BELOW
     The markup to follow illustrates two concepts.  First, in contrast
     to the conditional outputs and effects in ExpressCongoBuy, it creates
     a *named* subclass of the "ConditionalOutput" class, named 
     "LocateBookOutput".  Both are correct, however arguably the 
     named class is not necessary, so the use of anonymous classes as in
     the definition of "congoOrderShippedOutput", is more elegant.

     The second thing to observe in the markup below is that the condition,
     "BookInCatalogueP", is extensively defined.  In general, we do not
     expect this level of detail in DAML-S 0.9 markup, but this illustrates
     how the language can be used to further relate truth values of 
     predicates to DAML-S "Condition" subclasses such as "BookInCatalogueP".
-->

<daml:Property rdf:ID="locateBookOutput">
  <rdfs:subPropertyOf rdf:resource="&process;#output"/>
  <rdfs:domain rdf:resource="#LocateBook"/>
  <rdfs:range rdf:resource="#LocateBookOutput"/>
</daml:Property>

<rdf:Property rdf:ID="condBookInCatalog">
  <rdfs:subPropertyOf rdf:resource="&process;#coCondition"/>
  <rdfs:domain rdf:resource="#LocateBookOutput"/>
  <rdfs:range rdf:resource="#BookInCatalogueP"/>
</rdf:Property>

<!-- The predicate (condition) that a named book (property #nameBookInCatalogue)
  is in the catalogue -->
<daml:Class rdf:ID="BookInCatalogueP">
 <rdfs:subClassOf rdf:resource="&process;#Condition"/>
 <rdfs:subClassOf>
   <daml:Restriction daml:minCardinality="1">
     <daml:onProperty rdf:resource="#nameBookInCatalogue" />
   </daml:Restriction>
 </rdfs:subClassOf>
</daml:Class>

<rdf:Property rdf:ID="nameBookInCatalogue">
  <daml:domain rdf:resource="#BookInCatalogueP"/>
  <daml:range rdf:resource="&xsd;#string"/>
</rdf:Property>

<daml:Class rdf:ID="LocateBookOutput">
  <rdfs:subClassOf rdf:resource="&process;#ConditionalOutput"/>
  <!-- must have a condition of type BookInCatalogueP - either true or false -->
  <daml:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#condBookInCatalog"/>
    </daml:Restriction>
  </daml:subClassOf>
  <daml:disjointUnionOf rdf:parseType="Collection">
    <daml:Class rdf:about="#LocatedBookOutput"/>
    <daml:Class rdf:about="#NotFoundBookOutput"/>
  </daml:disjointUnionOf>
</daml:Class>

<!-- The class of BookInCatalogueP statements that are true -->
<daml:Class rdf:ID="InCatalogueBook">
 <rdfs:subClassOf rdf:resource="#BookInCatalogueP"/>
 <rdfs:subClassOf>
   <daml:Restriction>
     <daml:onProperty rdf:resource="&process;#conditionValue"/>
     <daml:hasValue rdf:resource ="&process;#True"/>
   </daml:Restriction>
 </rdfs:subClassOf>
</daml:Class>

<!-- The class of BookInCatalogueP statements that are False -->
<daml:Class rdf:ID="NotInCatalogueBook">
 <rdfs:subClassOf rdf:resource="#BookInCatalogueP"/>
 <rdfs:subClassOf>
   <daml:Restriction>
     <daml:onProperty rdf:resource="&process;#conditionValue"/>
     <daml:hasValue rdf:resource ="&process;#False"/>
   </daml:Restriction>
 </rdfs:subClassOf>
</daml:Class>


<!-- If the book is in the catalog, then the condition InCatalogBook holds
     and so the conditional Output is LocatedBookOutput -->


<daml:Class rdf:ID="LocatedBookOutput">
  <rdfs:subClassOf rdf:resource="&process;#ConditionalOutput"/>
  </daml:Class>

<rdf:Property rdf:ID="outInCatalogueBookDescription">
  <rdfs:subPropertyOf rdf:resource="&process;#coOutput"/>
  <rdfs:domain rdf:resource="#LocatedBookOutput"/>
  <rdfs:range rdf:resource="&xsd;#string"/>
</rdf:Property>

<rdf:Property rdf:ID="outInCatalogueBookISBN">
  <rdfs:subPropertyOf rdf:resource="&process;#coOutput"/>
  <rdfs:domain rdf:resource="#LocatedBookOutput"/>
  <rdfs:range rdf:resource="&xsd;#string"/>
</rdf:Property>

<!-- If the book is NOT in the catalog, then the condition NotInCatalogBook holds
     and so the conditional Output is NotFoundBookOutput, and the coOutput (message content)
  is just the instantiated predicate with value False -->


<daml:Class rdf:ID="NotFoundBookOutput">
  <rdfs:subClassOf rdf:resource="&process;#ConditionalOutput"/>
  </daml:Class>

<rdf:Property rdf:ID="outNotInCatalogueBookDescription">
  <rdfs:subPropertyOf rdf:resource="&process;#coOutput"/>
  <rdfs:domain rdf:resource="#NotFoundBookOutput"/>
  <rdfs:range rdf:resource="#NotInCatalogueBook"/>
</rdf:Property>




<!-- A very simple version of the put in cart event, in which the
cart is a bag of books (each item being a book). This illustrates
another way of specifying the input, using the anonymous subclass with
a restriction 
-->

<daml:Class rdf:ID="PutInCart">
 <rdfs:subClassOf rdf:resource="&process;#AtomicProcess"/>
 <rdfs:subClassOf>
  <daml:Restriction daml:cardinality="1">
   <daml:onProperty rdf:resource="#putInCartBookISBN"/>
  </daml:Restriction>
 </rdfs:subClassOf>
</daml:Class>

<rdf:Property rdf:ID="putInCartBookISBN">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#PutInCart"/>
  <rdfs:range rdf:resource="&xsd;#string"/>
</rdf:Property>

<!-- Sign in is a process that requires input of signin info -->

<daml:Class rdf:ID="SignIn">
 <rdfs:subClassOf rdf:resource="&process;#AtomicProcess"/>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#signInInfo"/>
    </daml:Restriction>
  </rdfs:subClassOf>
</daml:Class>

<rdf:Property rdf:ID="signInInfo">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#SignIn"/>
  <rdfs:range rdf:resource="#SignInData"/>
</rdf:Property>

<!-- CreateAcct requires input of profile and signin info -->

<daml:Class rdf:ID="CreateAcct">
  <rdfs:subClassOf rdf:resource="&process;#AtomicProcess"/>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#createAcctInfo"/>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#createAcctOutput"/>
    </daml:Restriction>
  </rdfs:subClassOf>
</daml:Class>

<rdf:Property rdf:ID="createAcctInfo">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#CreateAcct"/>
  <rdfs:range rdf:resource="#AcctInfo"/>
</rdf:Property>

<daml:Property rdf:ID="createAcctOutput">
  <rdfs:subPropertyOf rdf:resource="&process;#output"/>
  <rdfs:domain rdf:resource="#CreateAcct"/>
  <rdfs:range>
    <daml:Class>
       <rdfs:subClassOf rdf:resource="&process;#UnConditionalOutput"/>
       <rdfs:subClassOf>
         <daml:Restriction>
           <daml:onProperty rdf:resource="&process;#coOutput"/>
           <daml:toClass rdf:resource="#CreateAcctOutputType"/>
         </daml:Restriction>
      </rdfs:subClassOf>
    </daml:Class>
 </rdfs:range>
</daml:Property>

<!-- 
Load Profile wants to place a restriction that not only 
the account, but the profile exists. This could be a value of
the account exists property. A bit of a kludge, should be
changed 
-->

<daml:Class rdf:ID="LoadProfile">
  <rdfs:subClassOf rdf:resource="&process;#AtomicProcess"/>
   <rdfs:subClassOf>
    <daml:Restriction>
      <daml:onProperty rdf:resource="&process;#precondition"/>
      <daml:toClass rdf:resource ="#ProfileExists"/>
     </daml:Restriction>
   </rdfs:subClassOf>
</daml:Class>

<daml:Class rdf:ID="ProfileExists">
 <rdfs:subClassOf rdf:resource="&process;#Condition"/>
 <rdfs:subClassOf>
   <daml:Restriction>
     <daml:onProperty rdf:resource="&process;#Value"/>
     <daml:hasValue rdf:resource="&process;#True"/>
   </daml:Restriction>
 </rdfs:subClassOf>
</daml:Class>

<!-- SpecifyPaymentMethod -->

<daml:Class rdf:ID="SpecifyPaymentMethod">
  <rdfs:subClassOf rdf:resource="&process;#AtomicProcess"/>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#creditCardNumber"/>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#creditCardType"/>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#creditCardExpirationDate"/>
    </daml:Restriction>
  </rdfs:subClassOf>
</daml:Class>

<rdf:Property rdf:ID="creditCardNumber">
  <rdfs:comment>NOTE: INTEGER IS NOT SUPPORTED YET IN DAML+OIL </rdfs:comment>
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#SpecifyPaymentMethod"/>
  <rdfs:range rdf:resource="&xsd;#decimal"/>
</rdf:Property>

<rdf:Property rdf:ID="creditCardType">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#SpecifyPaymentMethod"/>
  <rdfs:range rdf:resource="#CreditCardType"/>   
</rdf:Property>

<rdf:Property rdf:ID="creditCardExpirationDate">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#SpecifyPaymentMethod"/>
  <rdfs:range rdf:resource="&time;#Instant"/>
</rdf:Property>


<!-- SpecifyDeliveryDetails -->

<daml:Class rdf:ID="SpecifyDeliveryDetails">
  <rdfs:subClassOf rdf:resource="&process;#AtomicProcess"/>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#deliveryAddress"/>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#packagingSelection"/>
    </daml:Restriction>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#deliveryTypeSelection"/>
    </daml:Restriction>
  </rdfs:subClassOf>
</daml:Class>

<!-- ADDRESS IS A LITERAL FOR THE TIME BEING -->

<rdf:Property rdf:ID="deliveryAddress">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#SpecifyDeliveryDetails"/>
  <rdfs:range rdf:resource="&xsd;#string"/>
</rdf:Property>

<rdf:Property rdf:ID="packagingSelection">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#SpecifyDeliveryDetails"/>
  <rdfs:range rdf:resource="#PackagingType"/>
</rdf:Property>

<rdf:Property rdf:ID="deliveryTypeSelection">
  <rdfs:subPropertyOf rdf:resource="&process;#input"/>
  <rdfs:domain rdf:resource="#SpecifyDeliveryDetails"/>
  <rdfs:range rdf:resource="#DeliveryType"/>
</rdf:Property>

<!-- FinalizeBuy -->

<daml:Class rdf:ID="FinalizeBuy">
  <rdfs:subClassOf rdf:resource="&process;#AtomicProcess"/>
</daml:Class>


<!--###################################################
    ###################################################
    SIMPLE PROCESS AbstractCongoBuy 
    ###################################################
    ###################################################-->

<!-- For some applications it is useful to have an abstract
     version of a composite process that is not executable.  
     Such a process, known as a simple process, expands to
     either a CompositeProcess or an AtomicProcess.  Such
     an abstraction may be useful for hiding certain details
     of a process model that may be either irrelevant for
     certain purposes, or confidential.  

     Below, we provide a rudimentary example of a simple 
     process AbstractCongoBuy
-->
     
<daml:Class rdf:ID="AbstractCongoBuy">
  <rdfs:subClassOf rdf:resource="&process;#SimpleProcess"/>
</daml:Class>

<!-- AbstractCongoBuy expands to FullCongoBuy -->

<daml:Class rdf:about="#AbstractCongoBuy">
  <rdfs:subClassOf>
    <daml:Restriction>
      <daml:onProperty rdf:resource="&process;#expandsTo"/>
      <daml:toClass rdf:resource="#FullCongoBuy"/>
    </daml:Restriction>
  </rdfs:subClassOf>
</daml:Class>
 
<!-- Likewise, FullCongoBuy collapsesTo AbstractCongoBuy -->

<daml:Class rdf:about="#FullCongoBuy">
  <rdfs:subClassOf>
    <daml:Restriction>
      <daml:onProperty rdf:resource="&process;#collapsesTo"/>
        <daml:toClass rdf:resource="#AbstractCongoBuy"/>
        </daml:Restriction>
  </rdfs:subClassOf>
</daml:Class>


<!-- The inputs, outputs, preconditions and conditional effects
     of an abstract process are defined by the user to suit
     the specific representational needs ofa situation.  We
     leave them out in this example.
--> 

</rdf:RDF>

