of the local composition policies. From the global PESM diagrams at the service layer, it is possible to derive a number of local PESM diagrams, one for each composite role governed by the policy. The transition is made by traversing the global PESM diagram by focusing on one composite role at a time. The collaboration uses, which the composite role par- ticipate in, are replaced by the corresponding role state machine, while collaboration PDP2 Rule1 PDP2 P Rule1 PDP2 R Rule1 T: ? (Request registration, T: ? (Request registration, T: ? (RoleReq (callee) External, assisted caller) External, Assisted caller, assisted caller) Reg assister) C: True, assisted C: True, NeedsAssistance, C: onDuty aller.NeedsAssistance, reg assister.onDuty reg assister. onDuty A. pcr (caller -> assisted caller, A: ! (RoleReq (callee), A: PlayRole (callee) callee-reg assister) : call assisted caller, Reg assister), PlayRole (caller) G: assisted caller. TalkedTo (Callee) G: TalkedTo (Callee) G: TalkedTo (Caller) Reg assister. TalkedTo (Caller) Figure 5.12 Example of deriving local policy rules. How to Model Dynamic Service Composition Using UML 2.x uses that do not involve the composite role are removed from the diagram along with the preceding PDP. For the tele-consultation service shown in Figure 5.2, four local PESM diagrams may be derived from the global PESM diagram for the PatientT, Doctor T, ReceptionistT, and TeleSvcDsk composite roles, respectively by applying the transformation rules as explained above. The local PESM diagram for the PatientT composite role is shown in Figure 5.13, annotated with policy rules for each of the PDPs. Policy rules for each of the PDP are shown alongside the dia- gram, for clarity. The hierarchical structure of the global PESM is preserved when deriving the local PESM diagrams. The nested local PESM and local policies for the assisted caller subcomposite role are derived from the aided Registration PESM and policies by applying the transformation rules recur- sively. Similarly, the nested local PESM a