Research Article

An Approach for Composing Services Based on Environment Ontology

Algorithm 8

Composition algorithm based on environment ontology.
Input: Req //the requirement description based on environment ontology
Output: Ser //the composition service
(1) ReqSet:= {Req}; //ReqSet is a set of the requirement needing to be implemented by the services;
(2) while(ReqSet ⌀)
(3)  for(each req in ReqSet)
(4)   ser:= discovery(req, SerSet);
(5)   if(ser ⌀){//discovery(req, SerSet) successes
(6)    LabReq:= LabReq label(req, ser); //label the req using the ser
(7)    continue;
(8)   end if
(9)   ReqSet:= ReqSet dec(req, rule)-{req}; // dec() is used to decomposition the requirement
(10) end for
(11)end while
(12)Ser.{name, Ents, Deps, EntDes}:= req{name, Ents, Deps, EntDes}
(13)determin the Sers and Funcs of the Ser according to the req and LabReq;
(14)for(each ent in LabReq.Ent)
(15) if(ent.type = C&& > 1)
(16)  for(each fsm in rhsm)
(17)    if( > 1&&hasproced(subFsm(fsm)))
(18)     adjust the Sers and Funcs of the Ser using the rule 9–14;
(19)     adjust the Sers and Funcs of the Ser using the rule 5–8;
(20)    end if
(21)   end for
(22)  end if
(23)  adjust the Sers and Funcs of the Ser using the rule 1–4;
(24)end for
(25)generateCDL(Ser);//generate the description in WS-CDL of the ser