• Ei tuloksia

5. Application Experiments

5.6 Application Example of OWL-S Generation

This section exemplifies the application of the OWL-S derivation approach proposed in Section 3.5.

The current implementation of the Service Monitor web service has been tested both on PC-based web services implemented with Java and on web services im-plemented on RTUs controlling the actual system described in Section 5.1.4. The system is modeled by the OWL model described at the beginning of Section 5.5.

The OWL model contains individuals representing the system components, such as the individual cells, robots, and conveyors.

Listing 5.9 shows the WSDL document describing the robot 2 service. The list-ing has been abbreviated so that it only contains the most relevant parts, and some parts and namespace URIs have been substituted with three dots. The WSDL op-eration replacePaper, which is present only in the robot 1 WSDL document and

5. Application Experiments 124

8 <xs:attribute name = "currentState" use = "required" type="tns:DeviceState" />

9 <xs:attribute name = "previousState" use = "required" type="tns:DeviceState" />...

10 </xs:complexType>

35 <wsdl:part name="Request" element="tns:DrawMsg" sawsdl:modelReference="...#operation" />

36 </wsdl:message>

55 <!−−This embedded OWL document imports the actual OWL model that contains 56 the concepts referenced in the SAWSDL annotations.−−>

57<rdf:RDF ...>

Listing 5.9: The WSDL operations of the robot service contain several SAWSDL model references to SWRL rules.

5. Application Experiments 125 Table 5.6: The Robot service WSDL operations are linked to SWRL rules through SAWSDL annotations.

Operation Name SAWSDL Model Reference

Draw (not robot 1) robotOperationRule

replacePaper (only robot 1) palletLoadRule, palletUnloadRule EquipmentChangeState (robot 1) assemblyLoadedRule,

assemblyUnloadedRule EquipmentChangeState (not robot 1) operationStartedRule,

operationCompletedRule

is therefore absent from the listing, includes model references to two SWRL rules:

palletLoadRule and palletUnloadRule. The former rule applies to the case that the pallet is initially blank and the latter to the case that the pallet already carries an assembly, which is then replaced. Therefore, Service Monitor generates two results for the corresponding OWL-S process. The results represent the two alternative consequences of the replacePaper operation, namely the placement and the replace-ment of a paper. The WSDL operationDraw on line 46 in Listing 5.9 only contains a model reference to the SWRL rule robotOperationRule, and hence Service Mon-itor only generates one result for the process, which corresponds to the event that the selected operation is performed on the assembly carried by the pallet occupy-ing the robot processoccupy-ing location. Table 5.6 shows the SAWSDL model references attached to the robot service operations, and Table 5.7 lists the three SWRL rules referred to by the invokable operations. The WSDL notification operations refer to four somewhat different SWRL rules, from which Service Monitor extracts domain model update rules.

The generated OWL-S results include condition and effect expressions, which Service Monitor derives from the corresponding SWRL rules. However, Service Monitor applies the variable value bindings defined in the OWL model embedded in the service WSDL file. For example, the OWL model in Listing 5.9 contains one variable binding, RobotVariableBinding2, on lines 61-67. It specifies that the SWRL variable robot should be substituted with the OWL individualrobot2 in the condition and effect expressions derived. Because the WSDL port type containing the aforementioned operations includes an SAWSDL model reference to thebinding on line 44, thebindingwill be applied in deriving the condition and effect expressions for the results in all of the OWL-S processes.

The conditions for the generated results are derived by copying all atoms from the rule antecedents and applying the specified variable substitutions. For exam-ple,RobotVariableBinding2 would be applied by substituting each occurrence of the variable robot in Table 5.7 with the OWL individual robot2. In addition, SWRL

5. Application Experiments 126 Table 5.7: The Fastory domain ontology defines three SWRL rules representing the tasks carried out by robots.

Rule Name Rule Expression

palletLoadRule hasP rocessingLocation(?robot,?zone) ∧ hasInputStorage(?robot,?storage) ∧

stores(?storage,?assembly) ∧

isOnT opOf(?assembly,?newT op) ∧

isT opOf(?assembly,?storage) ∧

hasP allet(?zone,?pallet) ∧

canP erf ormOperation(?robot,?operation) ∧ P alletM oveOperation(?operation) ∧ swrlb : noV alue(?pallet, carriesP roduct) ⇒ swrlb : remove(2) ∧ swrlb : remove(3) ∧ swrlb : remove(4) ∧ carriesP roduct(?pallet,?assembly) ∧ isT opOf(?newT op,?storage) isT opOf(?oldInputT op,?inputStack) ∧ isOnT opOf(?oldInputT op,?newInputT op) ∧ stores(?inputStack,?oldInputT op) ∧ hasOutputStorage(?robot,?storage) ∧

isT opOf(?oldT op,?storage) ∧

P alletM oveOperation(?operation) ⇒ swrlb : remove(1) ∧ swrlb : remove(5) ∧ swrlb : remove(6) ∧ swrlb : remove(7) ∧ swrlb : remove(9) ∧ stores(?storage,?assembly) ∧

isT opOf(?assembly,?storage) ∧

isOnT opOf(?assembly,?oldT op) ∧

carriesP roduct(?pallet,?oldInputT op) ∧ isT opOf(?newInputT op,?inputStack)

robotOperationRule hasRobot(?cell,?robot)∧hasRobotStatus(?robot, blocked)∧

hasP rocessingLocation(?robot,?zone) ∧ hasP allet(?zone,?pallet)∧hasRf idT ag(?pallet,?rf id)∧ carriesP roduct(?pallet,?assembly) ∧ canP erf ormOperation(?robot,?operation) ∧ insertsComponent(?operation,?component) ∧ swrlb : noV alue(?assembly, hasComponent,?component) ⇒ hasComponent(?assembly,?component)

variables are substituted with the generated OWL-S process input or output pa-rameters if the corresponding WSDL message parts contain model references to the

5. Application Experiments 127 variables. For example, on line 35 in Listing 5.9, the input message part of theDraw operation contains a model reference to the SWRL variable operation. Therefore, the variable is substituted with the generated OWL-S input parameter when copy-ing the conditions from the SWRL rulerobotOperationRule to the generated OWL-S result. The effects are derived by applying the same variable substitutions to the atoms in the SWRL rule consequents.

The WSDL files of the other robot services contain similar SAWSDL annota-tions referring to the same SWRL rules. However, the embedded OWL documents contain different variable substitutions. For example, the WSDL file of the service corresponding to robot 3 contains an OWL document that substitutes the SWRL variable robot with the OWL individual robot3. The parts that need to be altered for the different instances of the robot service appear in bold font in Listing 5.9.

Listing 5.10 shows the abbreviated XML code for the OWL-S process generated from the robot 2Draw operation. For example, Service Monitor generates the XSLT script for the XML schema element DrawMsg defined on line 25 in Listing 5.9 and inserts the script on line 43 in Listing 5.10. However, the XSLT script, as well as the SWRL condition expression of the process result, are quite verbose and therefore omitted in the listing. The SWRL effect expression of the process result is less verbose than the condition, since it only specifies that executing the process will cause a new component to be attached the assembly carried by the pallet at the robot 2 processing location. The effect is defined on lines 5-14 in Listing 5.10.

In the example presented in this section, Service Monitor generated condition and effect expressions in SWRL. Alternatively, Service Monitor could be configured to use SPARQL as the expression language, which might result in more human-readable derivation results. When Service Monitor is configured to use SPARQL, the OWL-S derivation process is otherwise identical except that the condition and effect expressions in the generated OWL-S processes are different.

5.7 Application Example of SWRL-based Semantic Web