%:- module Shp. :- include 'upper-onto.ncl'. :- sorts Slot >> Item; Slot >> ShipAddress; Slot >> ShipOption; Slot >> ShipperQuote; Slot >> SenderQuote; Role >> Sender; Role >> Shipper; Role >> Receiver. :- objects shipInfo(Receiver,Sender,ShipAddress) :: Message; reqForShipOptions(Sender,Shipper,ShipAddress,Item) :: Message; shipperOptionQuote(Shipper,Sender,ShipOption,ShipperQuote) :: Message; senderOptionQuote(Sender,Receiver,ShipOption,SenderQuote) :: Message; chooseOption(Receiver,Sender,ShipOption,SenderQuote) :: Message; shipOrder(Sender,Shipper,Item,ShipOption,ShipperQuote) :: Message; shipment(Shipper,Receiver,Item) :: Message; payShipping :: Condition; shipping(Item) :: Condition; payShippingCharge :: Condition; shipping(Item) :: Condition; Se :: Sender; Sh :: Shipper; Re :: Receiver; myItem :: Item; myShipAddress :: ShipAddress; myShipOption :: ShipOption; myShipperQuote :: ShipperQuote; mySenderQuote :: SenderQuote. :- variables item :: Item; shipAddress :: ShipAddress; shipOption :: ShipOption; shipperQuote :: ShipperQuote; senderQuote :: SenderQuote. nonexecutable act(shipInfo(Re,Se,shipAddress)) if fl(shipInfo(Re,Se,shipAddress)). nonexecutable act(reqForShipOptions(Se,Sh,shipAddress,item)) if -fl(shipInfo(Re,Se,shipAddress)) ++ fl(reqForShipOptions(Se,Sh,shipAddress,item)). nonexecutable act(shipperOptionQuote(Sh,Se,shipOption,shipperQuote)) if -fl(reqForShipOptions(Se,Sh,shipAddress,item)) ++ fl(shipperOptionQuote(Sh,Se,shipOption,shipperQuote)). act(shipperOptionQuote(Sh,Se,shipOption,shipperQuote)) causes create(cc(Sh,Se,payShipping,shipping(item))). nonexecutable act(senderOptionQuote(Se,Re,shipOption,senderQuote)) if -fl(shipperOptionQuote(Sh,Se,shipOption,shipperQuote)) ++ fl(senderOptionQuote(Se,Re,shipOption,senderQuote)). act(senderOptionQuote(Se,Re,shipOption,senderQuote)) causes create(cc(Sh,Se,payShippingCharge,shipping(item))). nonexecutable act(chooseOption(Re,Se,shipOption,senderQuote)) if -fl(senderOptionQuote(Se,Re,shipOption,senderQuote)) ++ fl(chooseOption(Re,Se,shipOption,senderQuote)). act(chooseOption(Re,Se,shipOption,senderQuote)) causes create(cc(Re,Se,shipping(item),payShippingCharge)). nonexecutable act(shipOrder(Se,Sh,item,shipOption,shipperQuote)) if -fl(chooseOption(Re,Se,shipOption,senderQuote)) ++ fl(shipOrder(Se,Sh,item,shipOption,shipperQuote)). act(shipOrder(Se,Sh,item,shipOption,shipperQuote)) causes create(cc(Se,Sh,shipping(item),payShipping)). nonexecutable act(shipment(Sh,Re,item)) if -fl(shipOrder(Se,Sh,item,shipOption,shipperQuote)) ++ fl(shipment(Sh,Re,item)). act(shipment(Sh,Re,item)) causes cond(shipping(item)). :- query label :: 5; maxstep :: 7; 0: initial; maxstep: fl(shipment(Sh,Re,item)).