150 likes | 283 Views
How to Pay in License Script. C. N. Chong , S. Etalle, and P. Hartel Universiteit Twente, The Netherlands chong@cs.utwente.nl. Overview. Introduction Motivation License Script Language License Script Wallet Payment Policies Examples Conclusions and Future Work. Introduction.
E N D
How to Pay in LicenseScript C. N. Chong, S. Etalle, and P. Hartel Universiteit Twente, The Netherlands chong@cs.utwente.nl
Overview • Introduction • Motivation • LicenseScript Language • LicenseScript Wallet • Payment Policies • Examples • Conclusions and Future Work
Introduction • Most rights expression languages (RELs) specify rights, terms and conditions. • But, they are not designed to capture payment management. • We have proposed LicenseScript. • We have modeled payment with a simple wallet in our previous work, but: • It is unrealistic. • It is inflexible.
Motivation • To investigate another application domain of LicenseScript. • Thereby, to show the flexibility of the LicenseScript. • To model the payment from the user’s perspective.
Motivation (cont’d) • We model the payment with LicenseScript. • This is useful to verify the payment policies designed. • How the payment is made, i.e., the underlying implementation details are abstracted by using primitives at the moment.
License Clause Binding Rule LicenseScript Language • License consists of three parts: content, clauses, and bindings. • Clauseis a Prolog program to decide if the operation is allowed. • Bindings store license data. • Rule can be thought of as firmware of a system.
Wallet takes the following form: Γ is a set of Prolog clauses. B is a set of bindings. wallet canload(B1,B2,A):- get_value(B1,money,M), set_value(B1,money,M+A,B2), cantransfer(B1,B2,P,A):- get_value(B1,money,M), get_value(B1,bankcharge,C), C+A<=M, transfer(P,A), set_value(B1,money,M-(A+C),B2) type=bankaccount, money=1500, currency=euro, interest=0.5, bankcharge=1 Wallet
Wallet (cont’d) • We gather all the wallets of a user in a wallet manager. • Ψ contains clauses that operate over wallets, for instance add_wallet and remove_wallet. • L is the list of wallets.
Payment Policies • The payment policies aid in deciding how to perform the payments. • We need a weightpredicate, s.t. weight is a real number in {0,1} inclusive, i.e., p(wallet,weight). • Given the list of wallets L from wm(Ψ,L), we say that payment policy policy selects wallet wallet(Γ,B) for payment if predicate p(wallet(Γ,B),W) and W is a maximum weight.
Brief Implementation Procedure • Weight predicate p(Wallet,Weight)assigns weight Weight to wallet Wallet. • Clause select(List,Charge,Wallet) will select wallet Wallet with maximum weight according to predicate p that has enough money to pay Charge, from List.
Examples • We can model various payment policies for different scenarios. • We can define the predicate p how to assign the weight according to different scenarios. • Example 1: Minimum bank charge. • Example 2: Paying with loyalty points (e.g. air-miles, money coupon, and bank account).
Conclusions and Future Work • We have proposed a technique to model and specify payment policies to optimize payment strategies from user’s perspective in LicenseScript. • We believe this technique blends smoothly with the LicenseScript framework, demonstrating its flexibility. • Future Work: • To modify select clause. • To specify selection policy.
Implementation I select(L,C,W):- map(L,L’), sort(L’,L”), choose(L”,C,W). • map(L,L’) – returns L’ s.t. L’={(w,weight)|w in L ^ p(w,weight)} • sort(L’,L”) – sorts list L’ in L”, s.t. L”={(w1,weight1),…,(wn,weightn)}, where weighti >= weighti+1, for i=1,…,n
Implementation II • choose([H|T],C,H) :- H = wallet(_,B), get_value(B,money,M), M >= C. choose([H|T],C,Y) :- choose(T,C,Y). Choose the 1st wallet in the list that has enough money (in W’s money binding) to pay C.