---------------------------------------------------------------------------------- ---------------------------------------------------------------------------------- -- *** Web Service Algebra: Business Trip Example *** -- *** (c) December 2007 by Peter Höfner and Florian Lautenbacher *** ---------------------------------------------------------------------------------- ---------------------------------------------------------------------------------- import WebService -- Knowledge set for the example d1 = "date of arrival" d2 = "date of departure" dep = "departure" des = "destination" cc = "credit card" ff = "frequent flier card" etix1 = "e-ticket1" etix2 = "e-ticket2" resnrh = "reservation number for the hotel" cat = "room's category" kind = "amount of stars of the hotel" smt = "something different" resnrc = "reservation number for the car" insurenr = "insurance number" -- whole knowledge set -------------------------- k = set [d1,dep,des,cc,etix1,d2,ff,etix2,smt,resnrh,resnrc,cat,kind,insurenr] ---------------------------------------------------------------------------------- ---------------------------------------------------------------------------------- -- *** basic features *** flight_base :: Rel [String] flight_base = set [(set [d1,dep,des,cc], set [d1,dep,des,cc,etix1]), (set [d1,dep,des,ff], set [d1,dep,des,ff,etix1]), (set [d2,dep,des,cc], set [d2,dep,des,cc,etix2]), (set [d2,dep,des,ff], set [d2,dep,des,ff,etix2])] flight = blow flight_base hotel_base :: Rel [String] hotel_base = set [(set [d1,d2,des,kind,cat,cc], set [d1,d2,des,kind,cat,cc,resnrh])] hotel = blow hotel_base car_base :: Rel [String] car_base = set [(set [d1,d2,des,cc],set [d1,d2,des,cc,resnrc])] car = blow car_base insure_base :: Rel [String] insure_base = set [(set [resnrc, cc], set[insurenr])] insure = blow insure_base ---------------------------------------------------------------------------------- ---------------------------------------------------------------------------------- -- *** Tests *** t1 = blowt [etix1] t2 = blowt [etix2] t3 = blowt [resnrh] t4 = blowt [resnrc] t5 = blowt [insurenr] t6=t1##t2##t3##t4##t5 t8 = neg(t1\/t2\/t3\/t4\/t5) ---------------------------------------------------------------------------------- ---------------------------------------------------------------------------------- -- *** Overall example *** -- choice of several web services choice = (flight \/ hotel \/ car \/ insure) tmp1 = t8!#(star choice) startparam = fd tmp1 t6 -- |startparam|=4 {kind, cc, d1, d2, dep, des, cat} as well as every -- recombination of {ff,smt} -- planing web services... flightplan_base = buildplan ((neg (t1\/t2))##(fd (star flight) (t1##t2))) --looking initially at the result then blowing the plan does not make too --much sense, since there are then all t1 and t2 back again... --only the flightplan_base is interesting and leads to 6 results for --k = [d1,d2,dep,des,cc,ff,etix1,etix2,smt] flightplan_including_diamond = buildplan ((neg (t1\/t2))##(fd (star flight) (fb (star flight) (t1##t2)))) --another test is not(etix+etix2); |flight*> |flight*] (etix;etix2) --which we try in flightplan_including_diamond flightplan = blow flightplan_base --planning the star of the hotel to receive the resnrh hotelplan_base = buildplan ((neg t3)##(fd (star hotel) t3)) hotelplan = blow hotelplan_base --easyflight_base :: Rel [String] --easyflight_base = set [(set [d1,dep,des, cc], set [d1, dep, des, cc, etix1])] -- (set [d1,dep,des, ff], set [d1, dep, des, ff, etix1])] --easyflight = blow easyflight_base --easyflightplan_base = buildplan ((neg t1)##(fd (star easyflight) (t1))) ----------------------