Research Article

An Approach for Composing Services Based on Environment Ontology

Algorithm 6

Decomposition algorithm based on the key state.
DecByState(Req, ks, ReqSet)// input Req which can be represented by a finite state machine and ks, output ReqSet
(1) if((Req.State-(From(ks) To(ks))) = ⌀) //Req.State is a set of the states in Req
(2)  From(ks):= From(ks)-{ks}; //From(ks) is a set of the states which ks can reach
(3)  To(ks):= To(ks)-{ks}; //To(ks) is a set of the states which can reach ks
(4) end if
(5) Req1 = create(Req.State-(From(ks) To(ks)), Req);
(6) Req2:= create(From(ks)-To(ks), Req);
(7) Req3:= create(To(ks)-From(ks), Req);
(8) Req4:= create(From(ks) To(ks), Req);
(9) ReqSet:= Req1 Req2 Req3 Req4;