OWL-S can be used to describe Web Services. This post will introduce a very simple example that may be useful for understanding Web Service assembly. This service assembles and executes existing web services, so you do not need to publish your own web services. You need to install the protege and OWL-S editor plug-ins, I use the former version is 3.1 beta build 191, the latter is build 15, they run well together.
The Web Service is used to encode the specified string in Digest (MD5, sha1, etc.). The latter checks whether a string (hashstring) is the encoding result of another string (originstring) based on the specified encoding method. We will assemble these two methods into a service, encode the input encoding method and the string to be encoded first, and then check whether the encoding result is correct. If the encoding result is correct, true is returned, otherwise, false is returned. The following is the Assembly step. The complete project is downloaded here.
1. confirm that your OWL-S editor has been installed in protege, start protege, create a new owl file type project, check the owls option in the menu project-> config, after you press OK, A OWL-S editor page appears on the protege main interface.
2. Go to the OWL-S editor page, press the WSDL button in the upper left corner, enter the address of the web service in the dialog box that appears.
Figure 1 dialog box for importing WSDL
3. Because only one operation can be imported at a time, select hashstring and press the import button in the lower right corner. The system will prompt you to generate the owls file (the extension is. you can select any location.
4. Use the same method to import the checkhash method, so that we have two Web services that can be assembled. If you want to, you can run it separately by selecting a service and then pressing the green execution button.
Figure 2 two imported services
5. start assembling them now. For this reason, we create a service instance (by pressing the create Service button), a profile instance, A compositeprocess instance, and a wsdlgrounding instance, respectively named myservice, myprofile, myprocess, and mygrounding.
6. Connect them. First, select myservice and set its describedby attribute to myprocess, presents attribute to myprofile, and supports attribute to mygrounding.
7. Now you are editing myprocess, And the OWL-S Editor provides a visual editor that allows you to easily define the steps of compositeprocess. Select myprocess and switch to visual editor on the right. Here are some pink buttons for customizing the process. We first create a sequence (indicating execution in order), then select this sequence, and create two performs and one produce. Each perform indicates that a Web Service is called, the function of produce is to get the return value at the end. At this time, the image on the right should be like the following, because we have not customized the perform and produce.
Figure 3 process diagram with three useful nodes
8. Click on the graph's perform/produce node to modify its attributes. First, modify the first one. Click the first rectangular node (the first perform) and set the process attribute to wi1: hashstringprocess in the dialog box (Note: if the prefix is changed when the WSDL is imported, it is not wi1 here ), for ease of reading, change the name attribute to hashperform. Similarly, the process attribute of the second rectangular node should be wi2: checkhashprocess, and the name should be changed to checkperform. For a unique produce node, the name should be changed to produce. The figure on the right is as follows.
Figure 4 Process Diagram after renaming
9. Now switch from visual editor to the properties page, where the input and output parameters are defined for myprocess. Its input should be wi1: hashtype and wi1: STR, and the output should be wi2: checkhashresult. That is to say, for the Web service we assemble, the input is the encoding type and the string to be encoded, and the output is the verification result.
10. We have defined the parameters owned by myprocess above and will use them now. Switch back to visual editor. Select the first perform (hashperform) in the tree list and switch to the properties page on the right. The toparameter attribute is still blank, we need to map the input of myprocess to this perform, so press the Add button to add two input parameters (wi1: hashtype and wi1: Str) to toparameter. Select one of them. You can see the bindingtype option on the right. The default value is valuesource. You can use it. In the fromperform drop-down box below, there is only one option theparentperform and select it. In the bottom fromparameter, select the option that is the same as the toparameter item you selected (wi1: hashtype-> wi1: hashtype, wi1: str-> wi1: Str ).
Figure 5 "Data Stream" generated through parameter transfer"
11. For checkperform, it has three input parameters. We want hashtype and hashperform to have the same value, so its settings are the same as those of hashtype in the previous step; the setting of originalstring is the same as that of STR in the previous step. The hashstring attribute is the result obtained in the previous step, so the fromperform attribute should be hashperform, And the fromparameter attribute is wi1: hashstringresult.
12. The setting of produce is very simple. Add the expected result wi2: checkhashresult in the toparameter attribute, select checkperform from fromperform, and select wi2: checkhashresult from fromparameter. The process diagram corresponding to myprocess is as follows.
Figure 6 shows the service structure
13. The setting of myprocess is over, and the most difficult part is completed. The rest of the work is very simple and obvious. Select mygrounding and add wi1: hashstringatomicprocessgrounding and wi2: checkhashatomicprocessgrounding to its hasatomicprocessgrounding attribute.
14. Now myservice can be executed (some information can be added to myprofile to describe this service ). Select "myservice" and press the "execute" button. In the displayed dialog box, set "hashtype" to "MD5", "str" to "test" (any string can be used), and press "execute" to view the result. Of course, no matter what string you enter, this service will get the true value. You don't have to say that.
Figure 7 service after assembly