Another abandoned server code base... this is kind of an ancestor of taskrambler.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

2515 lines
126 KiB

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD
XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Semantic Annotations for WSDL and XML Schema &mdash; Usage Guide</title>
<style type="text/css">
/*<![CDATA[*/ pre {
background:#D5DEE3;
margin-left: 0!important;
} div.body dt {
font-weight: normal;
padding-top: 1ex;
} /*
*/
]]>
</style>
<link rel="stylesheet" type="text/css"
href="http://www.w3.org/StyleSheets/TR/W3C-WG-NOTE.css" />
</head>
<body>
<div class="head">
<p><a href="http://www.w3.org/"><img src="http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width="72"/></a></p>
<h1><a id="title" name="title">Semantic Annotations for WSDL and XML Schema
&mdash; Usage Guide</a></h1>
<h2><a id="w3c-doctype" name="w3c-doctype">W3C Working Group Note 28 August 2007</a></h2>
<dl>
<dt>This version:</dt>
<dd><a
href="http://www.w3.org/TR/2007/NOTE-sawsdl-guide-20070828/">http://www.w3.org/TR/2007/NOTE-sawsdl-guide-20070828/</a></dd>
<dt>Latest version:</dt>
<dd><a
href="http://www.w3.org/TR/sawsdl-guide/">http://www.w3.org/TR/sawsdl-guide/</a></dd>
<dt>Previous version:</dt>
<dd><a href="http://www.w3.org/TR/2007/WD-sawsdl-guide-20070126/">http://www.w3.org/TR/2007/WD-sawsdl-guide-20070126/</a></dd>
<dt>Editors:</dt>
<dd>Rama Akkiraju, IBM Research, New York</dd>
<dd>Brahmananda Sapkota, DERI Galway</dd>
</dl>
<p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> &copy; 2007 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>&reg;</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>, <a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.</p>
</div>
<hr />
<h2><a name="abstract" id="abstract">Abstract</a></h2>
<p>Web services provide a standards-based foundation for exchanging
information between distributed software systems. The W3C Recommendation Web
Services Description Language (WSDL) specifies a standard way to describe the
interfaces of a Web Service at a syntactic level and how to invoke it. While
the syntactic descriptions provide information about the structure of input
and output messages of an interface and about how to invoke the service, semantics are
needed to describe what a Web service actual does. These semantics, when
expressed in formal languages, disambiguate the description of Web services
interfaces, paving the way for automatic discovery, composition and
integration of software components. WSDL does not explicitly provide
mechanisms to specify the semantics of a Web service. Semantic Annotations
for WSDL and XML Schema (SAWSDL) defines mechanisms by
which semantic annotations can be added to WSDL components. This usage guide is an accompanying document to SAWSDL specification. It
presents examples illustrating how to associate semantic annotations with a
Web service. These annotations could be used for classifying, discovering, matching,
composing, and invoking Web services.</p>
<p>Some of the examples illustrated in this document use RDF and OWL Web Ontology Language
for representing ontologies. Some knowledge of RDF and OWL is useful for
understanding this document, but not essential.</p>
<h2><a name="status" id="status">Status of this Document</a></h2>
<p><em>This section describes the status of this document at the time
of its publication. Other documents may supersede this document.
A list of current W3C publications and the latest
revision of this technical report can be found in the <a href="http://www.w3.org/TR/">W3C technical reports index</a> at http://www.w3.org/TR/.</em></p>
<p>This is a <a href= "http://www.w3.org/2005/10/Process-20051014/tr.html#WGNote">W3C Working Group Note</a> of Semantic Annotations for WSDL and XML Schema &mdash; Usage Guide.
It has been produced by the <a href="http://www.w3.org/2002/ws/sawsdl/">Semantic Annotations for WSDL Working Group</a>, which is part of the <a href="http://www.w3.org/2002/ws/Activity">W3C Web Services Activity</a>. This Working group Note reflects the consensus of the Working Group, who produces it for the convenience of the community.</p>
<p>Please send comments about this document to the public <a href="mailto:public-ws-semann-comments@w3.org">public-ws-semann-comments@w3.org</a> mailing list (<a href="http://lists.w3.org/Archives/Public/public-ws-semann-comments/">public archive</a>).</p>
<p>A <a href="sawsdl-guide-diff.html">diff-marked version against the previous version of this document</a> is available.</p>
<p> This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent Policy</a>. W3C maintains a <a rel="disclosure" href="http://www.w3.org/2004/01/pp-impl/39001/status">public list of any patent disclosures</a> made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</a>. </p>
<p>Publication as a Working Group Note does not imply endorsement
by the W3C Membership. This is a draft document and may be updated, replaced or
obsoleted by other documents at any time. It is inappropriate to cite this
document as other than work in progress.</p>
<p>A list of current <a href="http://www.w3.org/TR/">W3C Recommendations and
other technical reports</a> can be found at <a href="http://www.w3.org/TR">http://www.w3.org/TR</a>.</p>
<div class="toc" id="toc">
<h2><a name="contents" id="contents">Table of Contents</a></h2>
<ul class="toc">
<li><a href="#introduction">1. Introduction</a>
<ul class="toc">
<li><a href="#namespace">1.1 Namespaces</a></li>
<li><a href="#examples">1.2 Running Examples</a></li>
</ul>
</li>
<li><a href="#registries">2. Defining Annotations to Publish a Web
Service</a>
<ul class="toc">
<li><a href="#PredefinedTaxonomy">2.1 Adding Categorization Information
with Category URIs</a></li>
<li><a href="#UserdefinedTaxonomy">2.2 Adding Categorization
Information with Category Identifiers</a></li>
<li><a href="#UDDI">2.3 Using Categorization Annotations to Publish a
Service in a UDDI Registry</a></li>
</ul>
</li>
<li><a href="#matchmaking">3. Defining Annotations for Use in Matching
and Composing Web services</a>
<ul class="toc">
<li><a href="#sharedOnt">3.1 Matching Web Service Interfaces using a
Shared Ontology</a></li>
<li><a href="#ontMediation">3.2 Matching Web Service Interfaces with
Ontology Mediation</a></li>
<li><a href="#composition">3.3 Composing Web Services - A Simple
Example</a></li>
<li><a href="#reasoning">3.4 Composing Web Services using Ontology
Reasoning</a></li>
<li><a href="#multiple">3.5 Matching Using Multiple Annotations</a></li>
<li><a href="#complex">3.6 Matching Using Complex Type
Annotations</a></li>
<li><a href="#conditions">3.7 Representing Conditions</a></li>
</ul>
</li>
<li><a href="#invocation">4. Defining Schema Mappings to Enable Web Service
Invocation</a>
<ul class="toc">
<li><a href="#lifting">4.1 Lifting Schema Mapping</a></li>
<li><a href="#lowering">4.2 Lowering Schema Mapping</a></li>
</ul>
</li>
<li><a href="#conclusions">5. Conclusions</a></li>
<li><a href="#references">6. References</a></li>
</ul>
<h3 id="Appendices"><a name="appendix" id="appendix">Appendices</a></h3>
<ul class="toc">
<li><a href="#conditionlistings">A. Condition Expression Listings</a></li>
<li><a href="#acknowledgements">B. Acknowledgements</a></li>
</ul>
</div>
<div class="body">
<h2 id="Introduction"><a name="introduction" id="introduction"></a>1.
Introduction</h2>
<p>As the set of available Web Services expands, it becomes increasingly
important to have automated tools to help identify services that match a
requester's requirements. Finding suitable Web services automatically depends
on the facilities available for service providers to describe the
capabilities of their services and for service requesters to describe their
requirements in an unambiguous and ideally, machine-interpretable form.
Adding semantics to represent the requirements and capabilities of Web
services is essential for achieving this clarity and
machine-interpretability.</p>
<p>Semantics play an important role in all aspects of the lifecycle of Web
services. During development, a service provider can explicate the intended
semantics by annotating the appropriate parts of the Web service with
concepts from a richer semantic model. Since semantic models provide
agreement on the terms and intended use of terms, and may provide formal and
informal definitions of the entities, there will be less ambiguity in the
intended semantics of the provider. During discovery, a service requestor can
describe the service requirements using terms from the semantic model.
Reasoning techniques can be used to find service descriptions that match the
request. During composition, these annotations can be used to aggregate the
functionality of multiple services to create useful service compositions.
Also, semantics based schema mappings can facilitate data transformations
from which mediation code can be generated to enable Web services invocation.
Therefore, once represented, semantics can be leveraged by tools to automate
service discovery, mediation, composition and monitoring.</p>
<p>The W3C Recommendation Web Services Description
Language (WSDL) specifies a standard way to describe the interfaces of a Web
Service at a syntactic level and how to invoke it. However, WSDL does not
explicitly provide mechanisms to specify the semantics of a Web service.
Semantic Annotations for WSDL and XML Schema (<a href="#SAWSDL">SAWSDL</a>)
defines mechanisms by which semantic annotations can be added to WSDL
components. This usage guide is an accompanying document to SAWSDL
specification. Many of the
concepts in SAWSDL are based on an earlier effort WSDL-S [<a
href="#WSDL-S">WSDL-S</a>], a W3C submission. It presents examples illustrating how to associate semantic
annotations with a Web service. These annotations could be used for classifying,
discovering, matching, composing, and invoking Web services.</p>
<p>The sections in this document are organized to show how to associate
semantic annotations with a WSDL document for use in service classification,
discovery, matching, composition and invocation in that order.</p>
<h3 id="Namespaces"><a name="namespace" id="namespace"></a>1.1 Namespaces</h3>
<p>The XML namespace name <!-- [<a href="#XMLNamespace">XMLNamespace</a>] -->
URIs <!-- [<a href="#URI">URI</a>] -->
used by this specification are as follows:</p>
<table border="1" cellpadding="5">
<thead>
<tr>
<th>Prefix</th>
<th>Namespace name</th>
</tr>
</thead>
<tbody>
<tr>
<td>xs</td>
<td><a
href="http://www.w3.org/2001/XMLSchema#">http://www.w3.org/2001/XMLSchema#</a></td>
</tr>
<tr>
<td>xsd</td>
<td><a
href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a></td>
</tr>
<tr>
<td>sawsdl</td>
<td><a
href="http://www.w3.org/ns/sawsdl">http://www.w3.org/ns/sawsdl</a></td>
</tr>
<tr>
<td>wsdl</td>
<td><a
href="http://www.w3.org/ns/wsdl">http://www.w3.org/ns/wsdl</a></td>
</tr>
<tr>
<td>rdf</td>
<td><a
href="http://www.w3.org/1999/02/22-rdf-syntax-ns">http://www.w3.org/1999/02/22-rdf-syntax-ns</a></td>
</tr>
<tr>
<td>rdfs</td>
<td><a
href="http://www.w3.org/2000/01/rdf-schema">http://www.w3.org/2000/01/rdf-schema</a></td>
</tr>
<tr>
<td>owl</td>
<td><a
href="http://www.w3.org/2002/07/owl#">http://www.w3.org/2002/07/owl</a></td>
</tr>
</tbody>
</table>
<h3><a name="examples" id="examples"></a>1.2 Running Examples</h3>
<p>Throughout this document, we use two Web services and several variations
on these Web services to illustrate how semantic annotations on a WSDL can be
used to do Web service interface matching and composition. One of these two
Web services is presented as a request of a desirable Web service while the
other is used as an advertisement or a service being offered by a service
provider. Some readers may be new to the concept of representing the
requirements of a client as a Web service - WSDL. While there may be
different ways of representing the requirements of a client, in this
document, for illustrative purposes we adopted the notion of a request WSDL
where the requirements of a client are modeled as a Web service - WSDL. The
inputs and outputs of this request WSDL codify the available inputs that a
client can provide and the expected outputs from a service respectively. We
then use the concepts of annotating a request similar to the way that one can
annotate a service provider's WSDL and illustrate how a request WSDL
interface can be matched, composed and transformed to invoke a service
provider's advertised service.</p>
<p>We present these two Web services here so as to allow the reader to get
familiarized with the examples used in the rest of the document. These are
'vanilla' WSDL files with no semantic annotations. In the following sections,
these WSDLs are shown with suitable semantic annotations that suit the
specific illustration. First a WSDL representation of a request WSDL is given
followed by a service provider's advertisement WSDL.</p>
<pre>&lt;wsdl:description
targetNamespace="http://org1.example.com/wsdl/CheckAvailabilityRequestService/"
xmlns="http://org1.example.com/wsdl/CheckAvailabilityRequestService/"
xmlns:wsdl="http://www.w3.org/ns/wsdl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;wsdl:types&gt;
&lt;xsd:schema targetNamespace="http://org1.example.com/wsdl/CheckAvailabilityRequestService"&gt;
&lt;xsd:element name="CheckAvailabilityRequestServiceRequest"&gt;
&lt;xsd:complexType&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element name="itemCode" type="xsd:string"/&gt;
&lt;xsd:element name="date" type="xsd:string"/&gt;
&lt;xsd:element name="qty" type="xsd:float"/&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;/xsd:element&gt;
&lt;xsd:element name="CheckAvailabilityRequestServiceResponse" type="itemConfirmation"/&gt;
&lt;xsd:simpleType name="itemConfirmation"&gt; <strong></strong>
&lt;xsd:restriction base="xsd:boolean"/&gt;
&lt;/xsd:simpleType&gt;
&lt;/xsd:schema&gt;
&lt;/wsdl:types&gt;
&lt;wsdl:interface name="CheckAvailabilityRequestService"&gt;
&lt;wsdl:operation name="CheckAvailabilityRequestOperation" pattern="http://www.w3.org/ns/wsdl/in-out"&gt;
&lt;wsdl:input element="CheckAvailabilityRequestServiceRequest"/&gt;
&lt;wsdl:output element="CheckAvailabilityRequestServiceResponse"/&gt;
&lt;/wsdl:operation&gt;
&lt;/wsdl:interface&gt;
&lt;/wsdl:description&gt;</pre>
<p><strong>Listing 1.2-1</strong>: A WSDL sample for CheckAvailabilityRequest
service. This example is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/CheckAvailabilityRequestService.wsdl">http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/CheckAvailabilityRequestService.wsdl</a>.</p>
<p></p>
<pre>&lt;wsdl:description
targetNamespace="http://org2.example.com/wsdl/CheckInventoryService/"
xmlns="http://org2.example.com/wsdl/CheckInventoryService/"
xmlns:wsdl="http://www.w3.org/ns/wsdl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;wsdl:types&gt;
&lt;xsd:schema targetNamespace="http://org2.example.com/wsdl/CheckInventoryService"&gt;
&lt;xsd:element name="CheckInventoryServiceRequest"&gt;
&lt;xsd:complexType&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element name="SKU" type="xsd:string"/&gt;
&lt;xsd:element name="deliveryDate" type="xsd:string"/&gt;
&lt;xsd:element name="numBundles" type="xsd:float"/&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;/xsd:element&gt;
&lt;xsd:element name="CheckInventoryServiceResponse"&gt;
&lt;xsd:complexType&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element name="conf" type="xsd:boolean"/&gt;
&lt;xsd:element name="numBundles_available" type="xsd:string"/&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;/xsd:element&gt;
&lt;/xsd:schema&gt;
&lt;/wsdl:types&gt;
&lt;wsdl:interface name="CheckInventoryService"&gt;
&lt;wsdl:operation name="checkInventoryService" pattern="http://www.w3.org/ns/wsdl/in-out"&gt;
&lt;wsdl:input element="CheckInventoryServiceRequest"/&gt;
&lt;wsdl:output element="CheckInventoryServiceResponse"/&gt;
&lt;/wsdl:operation&gt;
&lt;/wsdl:interface&gt;
&lt;/wsdl:description&gt;</pre>
<p><strong>Listing 1.2-2</strong>: A WSDL sample for CheckInventoryService.
This example is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/CheckInventoryService.wsdl">http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/CheckInventoryService.wsdl</a>.</p>
<h2 id="Registries11"><a name="registries" id="registries">2. Defining
Annotations to Publish a Web Service</a></h2>
<p>A Web service can be semantically annotated to carry categorization
information that could be used to publish it for instance in a service
registry. The SAWSDL extension mechanism <em>modelReference</em> can be used to
add this categorization information to Web services. This categorization
information could be used when automatically publishing services in
registries such as UDDI [<a href="#UDDI1">UDDI</a>]. Below, we illustrate a
couple of ways in which categorization information can be associated with a
Web service.</p>
<h3><a name="PredefinedTaxonomy" id="PredefinedTaxonomy">2.1 Adding
Categorization Information with Category URIs</a></h3>
<p>If a categorization semantic model already exists (for example a
taxonomy), then a <em>modelReference</em> element could be defined either on
an interface or on an operation of a Web service to point to a particular
category in the taxonomy. For example, if a purchase order taxonomy was
created as shown in Listing 2.1-1 below (shown in RDF Turtle [<a
href="#RDFTurtle">Turtle]</a> format for readability), then the interface of
an item availability check Web service (introduced in Listing 1.2-1) could be
annotated with taxonomy information as shown in Listing 2.1-2.</p>
<pre>@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
@prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; .
@prefix owl: &lt;http://www.w3.org/2002/07/owl#&gt; .
@prefix : &lt;http://www.w3.org/2002/ws/sawsdl/spec/examples/taxonomy/POServiceClassification#&gt; .
&lt;http://www.w3.org/2002/ws/sawsdl/spec/examples/taxonomy/POServiceClassification#&gt; rdf:type owl:Ontology .
:PurchaseOrderServices rdf:type owl:Class .
:OrderModification rdf:type owl:Class;
rdfs:subClassOf :PurchaseOrderServices .
:ItemAvailabilityCheck rdf:type owl:Class;
rdfs:subClassOf :PurchaseOrderServices .
:OrderPlacement rdf:type owl:Class;
rdfs:subClassOf :PurchaseOrderServices .
:ProductInfoInquiry rdf:type owl:Class;
rdfs:subClassOf :PurchaseOrderServices .
:OrderTracking rdf:type owl:Class;
rdfs:subClassOf :PurchaseOrderServices .</pre>
<p><strong>Listing 2.1-1</strong>: A taxonomy to organize Web services
related to checking, placing, and tracking purchase orders. This taxonomy is
also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/taxonomy/POServiceClassification.n3">http://www.w3.org/2002/ws/sawsdl/spec/examples/taxonomy/POServiceClassification.n3</a>.</p>
<pre> ...
&lt;wsdl:interface name="CheckItemAvailabilityRequestService"
<strong>sawsdl:modelReference="http://www.w3.org/2002/ws/sawsdl/spec/examples/taxonomy/POServiceClassification#ItemAvailabilityCheck"</strong>&gt;
...
&lt;/wsdl:interface&gt;
...</pre>
<p><strong>Listing 2.1-2</strong>: Shows how a WSDL interface could be
annotated with categorization information that could be used in publishing a
Web service (for example, into a service registry)</p>
<h3><a name="UserdefinedTaxonomy" id="UserdefinedTaxonomy">2.2 Adding
Categorization Information with Category Identifiers</a></h3>
<p>Some taxonomies may not provide direct URIs for their categories and may
require multiple pieces of information to identify the categories.In such a
case, users can define such information as per the requirements and associate
a <em>modelReference</em> to point to such user-defined taxonomic
information. For example, if a particular taxonomy specifies two pieces of
information namely, an identifier of the taxonomy
and a unique non-URI code for every specific category in that taxonomy, then it can be defined as
follows.</p>
<pre>@prefix categorization: &lt;http://www.w3.org/2002/ws/sawsdl/spec/examples/taxonomy/Categorization#&gt; .
@prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; .
@prefix xs: &lt;http://www.w3.org/2001/XMLSchema#&gt; .
@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
categorization:Category rdf:type rdfs:Class .
categorization:hasValue rdf:type rdf:Property;
rdfs:domain categorization:Category;
rdf:range rdfs:Literal .
categorization:usesTaxonomy rdf:type rdfs:Property;
rdfs:domain categorization:Category;
rdf:range rdfs:Resource .</pre>
<p><strong>Listing 2.2-1</strong>: Schema for defining a taxonomy with
specific properties. This schema is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/taxonomy/Categorization.n3">http://www.w3.org/2002/ws/sawsdl/spec/examples/taxonomy/Categorization.n3</a>.</p>
<p>Then, an instance such as the one below in Listing 2.2-2 that adheres to
the above schema in Listing 2.2-1 can be defined and either imported or
inserted into the WSDL file whose interface (or operation) is to be
annotated.</p>
<pre>@prefix categorization: &lt;http://www.w3.org/2002/ws/sawsdl/spec/examples/taxonomy/Categorization#&gt; .
@prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; .
@prefix xs: &lt;http://www.w3.org/2001/XMLSchema#&gt; .
@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
@prefix ex: &lt;http://example.org/Categorization#&gt; .
ex:Electronics rdf:type categorization:Category ;
categorization:hasValue "443112" ;
categorization:usesTaxonomy &lt;http://naics.com/&gt; .</pre>
<p><strong>Listing 2.2-2</strong>: An instance of a taxonomy defined using
the schema defined in Listing 2.2-1.</p>
<p>The annotation can be associated with the interface of a Web service as
follows.</p>
<pre>&lt;wsdl:interface name="CheckAvailabilityRequestService"
<strong>sawsdl:modelReference="http://example.org/Categorization#Electronics"</strong>&gt;
...
&lt;/wsdl:interface&gt;</pre>
<p><strong>Listing 2.2-3</strong>: A WSDL sample showing how a
<em>wsdl:interface</em> could be annotated with taxonomy information
defined in Listing 2.2-2.</p>
<p>Using similar <em>modelReference</em> annotation operations within an
interface can also be annotated. SAWSDL does not specify any relationship
between the categorization information specified at the level of an interface
and the one that is specified on an operation that is contained within that
interface. The example in Listing 2.2-4 below shows how an operation within a
Web service interface could be annotated using the same 'categorization'
scheme.</p>
<pre>&lt;wsdl:operation name="CheckAvailabilityRequestOperation"
<strong>sawsdl:modelReference="http://www.w3.org/2002/ws/sawsdl/spec/examples/taxonomy/Categorization#Electronics"</strong>
...
&lt;/wsdl:operation&gt;</pre>
<p><strong>Listing 2.2-4</strong>: A WSDL sample showing how a
<em>wsdl:operation</em> could be annotated with taxonomy information from Listing 2.2-2.</p>
<h3><a name="UDDI" id="UDDI">2.3 Using Categorization Annotations to Publish
a Service in a UDDI Registry</a></h3>
<p>In this subsection, we discuss how one can use the categorization
annotation information defined by using the mechanisms described in Section 2
to publish Web services in a UDDI registry. This is provided as an example
for illustrative purpose. One can use similar mechanisms to publish the Web
services in registries or repositories other than UDDI.</p>
<p>Following the example in Listing 2.2-2, one can define taxonomy references
to point to a specific category, for example, defined in NAICS [<a
href="#NAICS">NAICS</a>] taxonomy that is registered in a UDDI registry as
shown in Listing 2.3-1. This information can then be reused when a service
(such as the CheckItemAvailability Service whose interface definition is
shown in Listing 2.2-3) is published in the UDDI registry. In the following
example we use the NAICS taxonomy registered in UDDI.</p>
<pre>@prefix categorization: &lt;http://www.w3.org/2002/ws/sawsdl/spec/examples/taxonomy/Categorization#&gt; .
@prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; .
@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
ex:Electronics rdf:type categorization:Category ;
categorization:hasValue "443112" ;
categorization:usesTaxonomy &lt;uddi:uddi.org:ubr:categorization:naics:2002&gt; .</pre>
<p><strong>Listing 2.3-1</strong>: An instance of a taxonomy defined using
the schema defined in Listing 2.2-1 that refers to NAICS taxonomy registered
in UDDI registry.</p>
<p>To publish a Web service that is represented in SAWSDL in a UDDI registry,
an automatic Web service publishing engine can dereference the taxonomy
information from its interface and use that information to determine the correct
category of a related taxonomy in the registry to publish the service to. For
example, when publishing the service in UDDI V3, a category bag can be
created to classify the service using this information. Listing 2.3-2 below
shows the UDDI categoryBag structure that could be created from the
categorization information in Listing 2.3-1.</p>
<pre>&lt;categoryBag&gt;
&lt;keyedReference
tModelKey="uddi:uddi.org:ubr:categorization:naics:2002"
keyName="Electronics"
keyValue="443112"/&gt;
&lt;/categoryBag&gt;</pre>
<p><strong>Listing 2.3-2:</strong> UDDI Category bag structure derived from
the taxonomy instance in Listing 2.3-1.</p>
<p>In this section we have discussed the usage of <em>modelReference</em>
concepts on an interface and operation for associating categorization
relation information for illustrative purposes. Users may choose to use
<em>modelReferences</em> on interfaces and operations for associating other, for instance behavioral,
aspects with a service.</p>
<h2 id="Matchmaking"><a name="matchmaking" id="matchmaking">3. Defining
Annotations for use in Matching and Composing Web services</a></h2>
<p>One of the main motivations for SAWSDL specification is to provide
mechanisms using which semantic annotations can be added to WSDL documents so
that these semantics can be used to help automate the matching and
composition of Web services. In this section we present some examples to show
how to add such annotations for use during Web service interface matching and
composition. First we present an example to illustrate the use of annotations
in Web service interface matching.</p>
<h3><a name="sharedOnt" id="sharedOnt">3.1 Matching Web Service Interfaces
using a Shared Ontology</a></h3>
<p>Consider the the following scenario. A requestor
submits a request to verify the availability of an item from a preferred
supplier. This request is represented as a CheckAvailabilityRequest
WSDL (introduced in Listing 1.2-1). A service provider has
a service to offer that enables the requesters to check for the availability
of items it offers. This is called CheckInventoryService and is also
represented as WSDL with the same name (also introduced in Listing 1.2-2).
The <a href="http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/CheckAvailability-req-sem.wsdl">request
WSDL</a> codifies the inputs it can supply and the outputs it expects of an
item availability check service by the service provider. The <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/CheckInventory-sem.wsdl">service WSDL</a> specifies the interface
of a service that allows requesters to check for the availability of an
inventory item by exposing the inputs it requires in order to provide item
availability confirmation. At a high level the service offered by the service
provider should match the request. However, the differences in the vocabulary
used by the two services to represent their interfaces may prevent
making a match. For example, the term <em>itemCode</em> used by the requester
and the term <em>SKU</em> (Stock Keeping Unit) used by the provider are
meant to uniquely identify the item in question. Also, the requester term <em>qty</em>
and the provider term <em>numBundles</em> in this context may refer to the number of items (for the requester, it is the
number of items being requested and for the provider, it is the number of
items being offered). A matching engine may not have sufficient
information to identify them as related terms unless explicitly specified.
Semantic annotations, in cases such as these, could be significant. A
simple case, if there were to be a common semantic model that can be used to
annotate the WSDLs of the requester and the service provider as shown below
(in Listings 3.1-1 and 3.1-2), then a semantic engine could use this
information to match the two Web services. In this example, annotation is
done using <em>modelReference</em> extensibility attribute defined in
SAWSDL.</p>
<p>The WSDL sample shown below in Listing 3.1-1 represents one of the ways
of semantically annotating WSDL document of the request for checking item
availability.</p>
<pre>&lt;wsdl:description
targetNamespace="http://org1.example.com/wsdl/CheckAvailabilityRequestService/"
xmlns="http://org1.example.com/wsdl/CheckAvailabilityRequestService/"
xmlns:wsdl="http://www.w3.org/ns/wsdl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sawsdl="http://www.w3.org/ns/sawsdl"&gt;
&lt;wsdl:types&gt;
&lt;xsd:schema targetNamespace="http://org1.example.com/wsdl/CheckAvailabilityRequestService"&gt;
&lt;xsd:element name="CheckAvailabilityRequestServiceRequest"&gt;
&lt;xsd:complexType&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element name="itemCode" type="xsd:string"
<strong>sawsdl:modelReference="http://org1.example.com/ontologies/SampleOntology#PartNumber"</strong>/&gt;
&lt;xsd:element name="date" type="xsd:string"
<strong>sawsdl:modelReference="http://org1.example.com/ontologies/SampleOntology#DueDate"</strong>/&gt;
&lt;xsd:element name="qty" type="xsd:float"
<strong>sawsdl:modelReference="http://org1.example.com/ontologies/SampleOntology#Quantity"</strong>/&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;/xsd:element&gt;
&lt;xsd:element name="CheckAvailabilityRequestServiceResponse" type="itemConfirmation"/&gt;
&lt;xsd:simpleType name="itemConfirmation"
<strong>sawsdl:modelReference="http://org1.example.com/ontologies/SampleOntology#AvailabilityConfirmation"</strong>&gt;
&lt;xsd:restriction base="xsd:boolean"/&gt;
&lt;/xsd:simpleType&gt;
&lt;/xsd:schema&gt;
&lt;/wsdl:types&gt;
&lt;wsdl:interface name="CheckAvailabilityRequestService"&gt;
&lt;wsdl:operation name="checkAvailabilityRequestOperation" pattern="http://www.w3.org/ns/wsdl/in-out"&gt;
&lt;wsdl:input element="CheckAvailabilityRequestServiceRequest"/&gt;
&lt;wsdl:output element="CheckAvailabilityRequestServiceResponse"/&gt;
&lt;/wsdl:operation&gt;
&lt;/wsdl:interface&gt;
&lt;/wsdl:description&gt;</pre>
<p><strong>Listing 3.1-1</strong>: A WSDL sample of a semantically annotated
service request that shows the usage of <em>modelReference</em>. This WSDL sample is
also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/SemannCheckAvailabilityRequestService.wsdl">http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/SemannCheckAvailabilityRequestService.wsdl</a>.</p>
<p>The WSDL sample in Listing 3.1-2 represents a way of semantically
annotating the WSDL document of the service offered by the service provider
for checking item availability.</p>
<pre>&lt;wsdl:description
targetNamespace="http://org2.example.com/wsdl/CheckInventoryService/"
xmlns="http://org2.example.com/wsdl/CheckInventoryService/"
xmlns:wsdl="http://www.w3.org/ns/wsdl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sawsdl="http://www.w3.org/ns/sawsdl"&gt;
&lt;wsdl:types&gt;
&lt;xsd:schema targetNamespace="http://org2.example.com/wsdl/CheckInventoryService"&gt;
&lt;xsd:element name="CheckInventoryServiceRequest"&gt;
&lt;xsd:complexType&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element name="SKU" type="xsd:string"
<strong>sawsdl:modelReference="http://org1.example.com/ontologies/SampleOntology#SKU"</strong>/&gt;
&lt;xsd:element name="deliveryDate" type="xsd:string"
<strong>sawsdl:modelReference="http://org1.example.com/ontologies/SampleOntology#DueDate"</strong>/&gt;
&lt;xsd:element name="numBundles" type="xsd:float"
<strong>sawsdl:modelReference="http://org1.example.com/ontologies/SampleOntology#Quantity"</strong>/&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;/xsd:element&gt;
&lt;xsd:element name="CheckInventoryServiceResponse"&gt;
&lt;xsd:complexType&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element name="conf" type="xsd:boolean"
<strong>sawsdl:modelReference="http://org1.example.com/ontologies/SampleOntology#AvailabilityConfirmation"</strong>/&gt;
&lt;xsd:element name="numBundles_available" type="xsd:string"
<strong>sawsdl:modelReference="http://org1.example.com/ontologies/SampleOntology#Quantity"</strong>/&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;/xsd:element&gt;
&lt;/xsd:schema&gt;
&lt;/wsdl:types&gt;
&lt;wsdl:interface name="CheckInventoryService"&gt;
&lt;wsdl:operation name="checkInventoryOperation" pattern="http://www.w3.org/ns/wsdl/in-out"&gt;
&lt;wsdl:input element="CheckInventoryServiceRequest"/&gt;
&lt;wsdl:output element="CheckInventoryServiceResponse"/&gt;
&lt;/wsdl:operation&gt;
&lt;/wsdl:interface&gt;
&lt;/wsdl:description&gt;</pre>
<p><strong>Listing 3.1-2</strong>: A WSDL sample of a semantically annotated
service (advertisement) that shows the usage of <em>modelReference</em>. This
WSDL sample is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/SemannCheckInventoryService.wsdl">http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/SemannCheckInventoryService.wsdl</a>.</p>
<p>In this example both WSDL documents are
annotated with concepts from the same semantic model <em>SampleOntology</em>
(shown in Listing 3.1-3). The ontology contains the
relationship between the concepts PartNumber and SKU i.e., a SKU Code is a
subClassOf PartNumber. A semantic engine can use this relationship during
Web service interface matching by parsing and reasoning over this semantic
model. Therefore, the WSDL elements 'itemCode' in the request WSDL and the
'SKU' in the service WSDL match with one another. In the case of the other
input elements namely 'qty' vs 'numBundles' and 'date' vs 'deliveryDate',
since both these sets of elements are annotated with shared semantic concepts
namely 'Quantity' and 'DueDate' respectively the semantic ambiguity can be
resolved by direct matching of semantic annotations. The same applies to
matching outputs as well. The ontology that represents the subClassOf
relationship between the two concepts PartNumber and SKU can be modeled in
OWL as follows.</p>
<pre>@prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; .
@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
@prefix: &lt;http://org1.example.com/ontologies/SampleOntology#&gt; .
@prefix owl: &lt;http://www.w3.org/2002/07/owl#&gt; .
&lt;http://org1.example.com/ontologies/SampleOntology#&gt; rdf:type owl:Ontology .
:PartNumber rdf:type owl:Class .
:SKU rdf:type owl:Class;
rdfs:subClassOf :PartNumber .
:Quantity rdf:type owl:Class .
:DueDate rdf:type owl:Class .
:AvailabilityConfirmation rdf:type owl:Class .</pre>
<p><strong>Listing 3.1-3</strong>: A simple SampleOntology that captures the
subClassOf relationship between PartNumber and SKU concepts. This sample
ontology is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/ontologies/SampleOntology.n3">http://www.w3.org/2002/ws/sawsdl/spec/examples/ontologies/SampleOntology.n3</a>.</p>
<h3><a name="ontMediation" id="ontMediation">3.2 Matching Web Service
Interfaces with Ontology Mediation</a></h3>
<p>In Section 3.1 we made a shared ontology assumption between the requester
and service provider domains. This assumption may not always hold good. The
vocabulary differences may result in two different ontologies one for each
side albeit for the same domain. In such a case one can create a mapping
ontology by capturing the relationships between the concepts used in the
different ontologies. Below we annotate the same two request and advertisement
WSDLs using concepts from different ontologies. When a mapping ontology such
as the one shown in Listing 3.2-5 is available, then the semantic annotations
extracted from the request and the advertisement WSDL can be matched using
such a mapping ontology.</p>
<p>The WSDL sample shown below in Listing 3.2-1 represents one of the ways
of semantically annotating WSDL document of the request for checking item
availability.</p>
<pre>&lt;wsdl:description
targetNamespace="http://org1.example.com/wsdl/CheckAvailabilityRequestService/"&gt;
&lt;wsdl:types&gt;
&lt;xsd:schema targetNamespace="http://org1.example.com/wsdl/CheckAvailabilityRequestService"&gt;
&lt;xsd:element name="CheckAvailabilityRequestServiceRequest"&gt;
&lt;xsd:complexType&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element name="itemCode" type="xsd:string"
<strong>sawsdl:modelReference="http://org1.example.com/ontologies/SampleOntologyOrg1#PartNumber"</strong>/&gt;
&lt;xsd:element name="date" type="xsd:string"
<strong>sawsdl:modelReference="http://org1.example.com/ontologies/SampleOntologyOrg1#DueDate"</strong>/&gt;
&lt;xsd:element name="qty" type="xsd:float"
<strong>sawsdl:modelReference="http://org1.example.com/ontologies/SampleOntologyOrg1#Quantity"</strong>/&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;/xsd:element&gt;
&lt;xsd:element name="CheckAvailabilityRequestServiceResponse type="itemConfirmation"/&gt;
&lt;xsd:simpleType name="itemConfirmation"
<strong>sawsdl:modelReference="http://org1.example.com/ontologies/SampleOntologyOrg1#AvailabilityConfirmation"</strong>
&lt;xsd:restriction base:"xsd:boolean"/&gt;
&lt;/xsd:simpleType&gt;
&lt;/xsd:schema&gt;
&lt;/wsdl:types&gt;
&lt;wsdl:interface name="CheckAvailabilityRequestService"&gt;
&lt;wsdl:operation name="checkAvailabilityRequestOperation" pattern="http://www.w3.org/ns/wsdl/in-out"&gt;
&lt;wsdl:input element="CheckAvailabilityRequestServiceRequest"/&gt;
&lt;wsdl:output element="CheckAvailabilityRequestServiceResponse"/&gt;
&lt;/wsdl:operation&gt;
&lt;/wsdl:interface&gt;
&lt;/wsdl:description&gt;</pre>
<p><strong>Listing 3.2-1</strong>: A WSDL sample of a semantically annotated
service request that shows the usage of <em>modelReference</em>. This WSDL sample is
also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/SemannCheckAvailabilityRequestService2.wsdl">http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/SemannCheckAvailabilityRequestService2.wsdl</a>.</p>
<p>The WSDL sample shown below in Listing 3.2-2 represents a way of
semantically annotating the WSDL document of the service offered by the
service provider for checking item availability.</p>
<pre>&lt;wsdl:description
targetNamespace="http://org2.example.com/wsdl/CheckInventoryService/"&gt;
&lt;wsdl:types&gt;
&lt;xsd:schema targetNamespace="http://org2.example.com/wsdl/CheckInventoryService"&gt;
&lt;xsd:element name="CheckInventoryServiceRequest"&gt;
&lt;xsd:complexType&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element name="SKU" type="xsd:string"
<strong>sawsdl:modelReference="http://org2.example.com/ontologies/SampleOntologyOrg2#SKU"</strong>/&gt;
&lt;xsd:element name="deliveryDate" type="xsd:string"
<strong>sawsdl:modelReference="http://org2.example.com/ontologies/SampleOntologyOrg2#DeliveryDate"</strong>/&gt;
&lt;xsd:element name="numBundles" type="xsd:float"
<strong>sawsdl:modelReference="http://org2.example.com/ontologies/SampleOntologyOrg2#NumBundles</strong>/&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;/xsd:element&gt;
&lt;xsd:element name="CheckInventoryServiceResponse"&gt;
&lt;xsd:complexType&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element name="conf" type="xsd:boolean"
<strong>sawsdl:modelReference="http://org2.example.com/ontologies/SampleOntologyOrg2#AvailabilityConfirmation"</strong>/&gt;
&lt;xsd:element name="numBundles_available" type="xsd:string"
<strong>sawsdl:modelReference="http://org2.example.com/ontologies/SampleOntologyOrg2#NumBundles"</strong>/&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;/xsd:element&gt;
&lt;/xsd:schema&gt;
&lt;/wsdl:types&gt;
&lt;wsdl:interface name="CheckInventoryService"&gt;
&lt;wsdl:operation name="checkInventoryOperation" pattern="http://www.w3.org/ns/wsdl/in-out"&gt;
&lt;wsdl:input element="CheckInventoryServiceRequest"/&gt;
&lt;wsdl:output element="CheckInventoryServiceResponse"/&gt;
&lt;/wsdl:operation&gt;
&lt;/wsdl:interface&gt;
&lt;/wsdl:description&gt;</pre>
<p><strong>Listing 3.2-2</strong>: A WSDL sample of a semantically annotated
service (advertisement) that shows the usage of <em>modelReference</em>. This
WSDL sample is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/SemannCheckInventoryService2.wsdl">http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/SemannCheckInventoryService2.wsdl</a>.</p>
<p>As noted, in this case the concepts originating from different ontologies
represented in the two WSDLs shown above are mapped in a mapping ontology
such as the one shown below in Listing 3.2-5. It contains relationships
between concepts such as Quantity &amp; NumBundles and Due Date &amp;
DeliveryDate and PartNumber &amp; SKU. Just as in the example in Section 3.1,
a semantic matching engine can now be applied to reason over these
relationships during Web service interface matching. The relationships
between the concepts in this mapping ontology are shown pictorially in <a
href="#Figure1">Figure 1</a> below.</p>
<p>Below, we list the three ontologies that are used in matching the
checkAvailabilityRequest() request WSDL with the checkInventoryService()
advertisement WSDL. The first ontology shown in Listing 3.2-3 is the one used
by the requesting organization (referred to using the namespace
http://org1.example.com/ontologies/SampleOntology)
that defined the checkAvailabilityRequest() request WSDL. The second ontology
shown in Listing 3.2-4 is the one used by the service advertising
organization (referred to using the namespace http://org2.example.com/ontologies/SampleOntologyOrg2) that defined the
checkInventoryService() advertisement WSDL. The third one shown in Listing
3.2-5 is the mapping ontology defined by a third organization (could possibly
be defined by either of the first two organizations as well) that relates the
concepts from the two ontologies defined by org1 and org2.</p>
<pre>@prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; .
@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
@prefix: &lt;http://org1.example.com/ontologies/SampleOntologyOrg1#&gt; .
@prefix owl: &lt;http://www.w3.org/2002/07/owl#&gt; .
&lt;http://org1.example.com/ontologies/SampleOntologyOrg1#&gt; rdf:type owl:Ontology .
:PartNumber rdf:type owl:Class .
:DueDate rdf:type owl:Class .
:Quantity rdf:type owl:Class .
:AvailabilityConfirmation rdf:type owl:Class .</pre>
<p><strong>Listing 3.2-3:</strong>Sample Ontology used
by the organization that defined checkAvailabilityRequest() request WSDL.
This ontology is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/ontologies/SampleOntologyOrg1.n3">http://www.w3.org/2002/ws/sawsdl/spec/examples/ontologies/SampleOntologyOrg1.n3</a>.</p>
<p></p>
<pre>@prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; .
@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
@prefix: &lt;http://org2.example.com/ontologies/SampleOntologyOrg2#&gt; .
@prefix owl: &lt;http://www.w3.org/2002/07/owl#&gt; .
&lt;http://org2.example.com/ontologies/SampleOntologyOrg2#&gt; rdf:type owl:Ontology .
:SKU rdf:type owl:Class .
:DeliveryDate rdf:type owl:Class .
:NumBundles rdf:type owl:Class .
:AvailabilityConfirmation rdf:type owl:Class .
</pre>
<p><strong>Listing 3.2-4:</strong>Sample Ontology used by
the organization that defined checkInventoryService() advertisement WSDL.
This ontology is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/ontologies/SampleOntologyOrg2.n3">http://www.w3.org/2002/ws/sawsdl/spec/examples/ontologies/SampleOntologyOrg2.n3</a>.</p>
<pre>@prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; .
@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
@prefix: &lt;http://org3.example.com/ontologies/MappingOntology#&gt; .
@prefix Org1Ont: &lt;http://org1.example.com/ontologies/SampleOntologyOrg1#&gt; .
@prefix Org2Ont: &lt;http://org2.example.com/ontologies/SampleOntologyOrg2#&gt; .
@prefix owl: &lt;http://www.w3.org/2002/07/owl#&gt; .
&lt;http://org3.example.com/ontologies/MappingOntology#&gt; rdf:type owl:Ontology .
Org2Ont:SKU rdfs:subClassOf Org1Ont:PartNumber .
Org2Ont:NumBundles owl:equivalentClass Org1Ont:Quantity .
Org2Ont:DeliveryDate owl:equivalentClass Org1Ont:DueDate .
Org2Ont:AvailabilityConfirmation owl:equivalentClass Org1Ont:AvailabilityConfirmation .</pre>
<p><strong>Listing 3.2-5</strong>: Sample Ontology showing the mapping
ontology mapping concepts from ontologies in Listings 3.2-3 and 3.2-4. This
mapping ontology is used to match the request WSDL in Listing 3.2-1 with the
advertisement WSDL in Listing 3.2-2. This ontology is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/ontologies/MappingOntology.n3">http://www.w3.org/2002/ws/sawsdl/spec/examples/ontologies/MappingOntology.n3</a>.</p>
<div id="Figure1" style="text-align: center">
<p><img src="img/sampleRetailOntology.png" alt="sampleRetailOntology"
title="Figure 1: A Simple Sample Ontology used to annotate item availability request WSDL"
/></p>
<p><strong>Figure 1</strong>: A pictorial representation of a sample mapping
ontology that can be used to match the request WSDL in Listing 3.2-1 with the
advertisement WSDL in Listing 3.2-2</p>
</div>
<p>It is to be noted that SAWSDL specifies mechanisms to annotate WSDLs but
does not say anything about how these annotations are generated. These
annotations can either be created manually or by tools that can infer
relationships between the terms used in the WSDLs and those that are given in
a semantic model. Also, SAWSDL does not say anything about how the semantic
models themselves are created. Just like the creation of annotations, these
semantic models can either be created manually by a human expert or generated
automatically using ontology learning tools or by a combination of both.</p>
<p>In the next section, we extend the above item availability check example
to show how semantic annotations added to a WSDL can be used to compose Web
services.</p>
<h3><a name="composition" id="composition">3.3 Composing Web Services - A
Simple Example</a></h3>
<p>This section illustrates how semantic annotations can be used to compose
Web services. The request and advertisement WSDLs to be considered in this
scenario are the same as the ones shown in Listings 3.2-1 and 3.2-2
respectively. However, we introduce a variation to the mapping ontology from
Section 3.2. Suppose that in the item availability checking scenario that we
have been discussing so far, the <em>subClassOf</em> relationship between the concepts
PartNumber and SKU is unspecified in the ontology. In this case, the request
checkAvailabilityRequest() would not match with the service
checkInventoryService() because there is no relationship between PartNumber
and SKU. Also, suppose that there is another Web service called
PartNumber2SKULookup() that can take a PartNumber as input and produce SKU
as output (Listing 3.3-1). Say that a matching engine would be able to find
this service in the appropriate category in a registry - in this case it
would be in 'Utilities/LookupServices' category (because the modelReference
on the operation of this service contains the categorization information.
Presumably a publishing agent/program would have placed this service in the
appropriate category that is referred to by the <em>modelReference</em> URI).
Also, a mapping ontology such as the one shown in Listing 3.3-2 is
available for the matching engine. The service PartNumber2SKULookup()
can be composed with checkInventoryService() to match the request
checkAvailabilityRequest() as shown in <a href="#Figure2">Figure 2</a>. This
can be achieved by simply extracting the semantic annotations from the
request, and all the advertisement WSDLs and using the relationships in the
mapping ontology to match the corresponding concepts. A simple Web service
composition using the semantics annotations on the request and advertisement
services is illustrated in <a href="#Figure2">Figure 2</a>.</p>
<pre>&lt;wsdl:description
targetNamespace="http://org3.example.com/wsdl/PartNumber2SKULookupService/"
xmlns="http://org3.example.com/wsdl/PartNumber2SKULookupService/"
xmlns:wsdl="http://www.w3.org/ns/wsdl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sawsdl="http://www.w3.org/ns/sawsdl"&gt;
&lt;wsdl:types&gt;
&lt;xsd:schema targetNamespace="http://org3.example.com/wsdl/PartNumber2SKULookupService"&gt;
&lt;xsd:element name="PartNumber2SKULookupServiceRequest" type="partNum"/&gt;
&lt;xsd:simpleType name="partNum"
<strong>sawsdl:modelReference="http://org3.example.com/ontologies/SampleOntologyOrg3#PartNumber</strong>"&gt;
&lt;xsd:restriction base="xsd:string"/&gt;
&lt;/xsd:simpleType&gt;
&lt;xsd:element name="PartNumber2SKULookupServiceResponse" type="SKU"/&gt;
&lt;xsd:simpleType name="SKU"
<strong>sawsdl:modelReference="http://org3.example.com/ontologies/SampleOntologyOrg3#SKU</strong>"&gt;
&lt;xsd:restriction base="xsd:string"/&gt;
&lt;/xsd:simpleType&gt;
&lt;/xsd:schema&gt;
&lt;/wsdl:types&gt;
&lt;wsdl:interface name="PartNumber2SKULookupService"&gt;
&lt;wsdl:operation name="PartNumber2SKULookupService" pattern="http://www.w3.org/ns/wsdl/in-out"
<strong>sawsdl:modelReference="http://org3.example.com/taxonomies/Utilities#LookupServices</strong>"&gt;
&lt;wsdl:input element="PartNumber2SKULookupServiceRequest"/&gt;
&lt;wsdl:output element="PartNumber2SKULookupServiceResponse"/&gt;
&lt;/wsdl:operation&gt;
&lt;/wsdl:interface&gt;
&lt;/wsdl:description&gt;</pre>
<p><strong>Listing 3.3-1</strong>: A WSDL sample representing
PartNumber2SKULookup service. This WSDL sample is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/PartNumber2SKULookupService.wsdl">http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/PartNumber2SKULookupService.wsdl</a>.</p>
<p>Listing 3.3-2 below shows the variation on the mapping ontology discussed
in Section 3.2. As noted, this ontology does not contain any relationship
between PartNumber and SKU concepts. The additional differences from Listing
3.2-5 are shown below in bold font style. In this example, we assume that the
same organization that provides the PartNumber2SKULookupService() provides
the mapping ontology. In practice, this does not have to be the case. Any of
the three organizations (org1, org2, and org3 referred to in the namespaces)
or an entirely new organization (org4) can provide a mapping ontology. The
namespaces, in such a case, should reflect the change accordingly. The
ontologies that are used to annotate the request WSDL
checkAvailabilityRequest() and the advertisement WSDL checkInventoryService()
are unchanged from those presented in Listing 3.2-3 and 3.2-4.</p>
<pre>@prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; .
@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
@prefix: &lt;http://org1.example.com/ontologies/MappingOntology#&gt; .
@prefix Org1Ont: &lt;http://org1.example.com/ontologies/SampleOntologyOrg1#&gt; .
@prefix Org2Ont: &lt;http://org2.example.com/ontologies/SampleOntologyOrg2#&gt; .
@prefix Org3Ont: &lt;http://org3.example.com/ontologies/SampleOntologyOrg3#&gt; .
@prefix owl: &lt;http://www.w3.org/2002/07/owl#&gt; .
&lt;http://org3.example.com/ontologies/MappingOntology#&gt; rdf:type owl:Ontology .
Org2Ont:NumBundles rdf:type owl:Class;
owl:equivalentClass Org1Ont:Quantity .
Org2Ont:DeliveryDate rdf:type owl:Class;
owl:equivalentClass Org1Ont:DueDate .
Org2Ont:AvailabilityConfirmation rdf:type owl:Class;
owl:equivalentClass Org1Ont:AvailabilityConfirmation .
<strong>Org3Ont:PartNumber rdf:type owl:Class;
owl:equivalentClass Org1Ont:PartNumber .
Org3Ont:SKU rdf:type owl:Class;
owl:equivalentClass Org2Ont:SKU .</strong>
</pre>
<p><strong>Listing 3.3-2</strong>: Revised Mapping Ontology that contains
relationships between concepts from three different ontologies. This ontology
is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/ontologies/RevisedMappingOntology.n3">http://www.w3.org/2002/ws/sawsdl/spec/examples/ontologies/RevisedMappingOntology.n3</a>.</p>
<div id="Figure2" style="text-align: center">
<p><img src="img/ontologyMediation-V2.png" alt="A Possible Composition Scenario"
title="Figure 2: A Possible Web Service Composition Scenario" /></p>
<p><strong>Figure 2</strong>. Simple Web service composition using the
semantic annotations on the request and advertisement services.</p>
</div>
<h3><a name="reasoning" id="reasoning">3.4 Composing Web Services using
Ontology Reasoning</a></h3>
<p>We introduce three variations to our item availability checking scenario
in this section to illustrate how one can use semantic annotations to compose
Web services with ontology reasoning. First, suppose that we have a
checkInventoryService() that takes an UPC as input inplace of SKU (as
introduced in Listing 1.2-2 but with semantic annotations as in Listing 3.4-1
below). This service will not match the request
checkAvailabilityRequest() (unchanged from Listing 3.2-1) because there is no
relationship between the concepts PartNumber and UPC in the mapping ontology.
Even semantic annotations will not be able to help in matching the
request checkAvailabilityRequest() and the advertisement
checkInventoryService(). Second, say that there is another Web service
<em>called SKU2UPCLookup</em>() that can take an <em>SKU</em> as input and
produce <em>UPC</em> (Universal Product Code) as output (Listing 3.4-2).
Third, the original mapping ontology introduced in Listing 3.2-3 has an
addition of UPC concept. But it is to be noted that the ontology does not
specify any relationship between SKU and UPC codes. <a href="#Figure3">Figure
3</a> summarizes the relationships between the concepts PartNumber, SKU, and
UPC in SampleOntology. Now with these three variations, we have enough
information to see how a semantic engine can compose Web services to match
the request checkAvailabilityRequest() with checkInventoryService().</p>
<pre>&lt;wsdl:description
targetNamespace="http://org2.example.com/wsdl/CheckInventoryService/"&gt;
&lt;wsdl:types&gt;
&lt;xsd:schema targetNamespace="http://org2.example.com/wsdl/CheckInventoryService"&gt;
&lt;xsd:element name="CheckInventoryServiceRequest"&gt;
&lt;xsd:complexType&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element name="UPC" type="xsd:string"
<strong>sawsdl:modelReference="http://org2.example.com/ontologies/SampleOntologyOrg2#UPC</strong>"/&gt;
&lt;xsd:element name="deliveryDate" type="xsd:string"
<strong>sawsdl:modelReference="http://org2.example.com/ontologies/SampleOntologyOrg2#DeliveryDate</strong>"/&gt;
&lt;xsd:element name="numBundles" type="xsd:float"
<strong>sawsdl:modelReference="http://org2.example.com/ontologies/SampleOntologyOrg2#NumBundles</strong>"/&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;/xsd:element&gt;
&lt;xsd:element name="CheckInventoryServiceResponse"&gt;
&lt;xsd:complexType&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element name="conf" type="xsd:boolean"
<strong>sawsdl:modelReference="http://org2.example.com/ontologies/SampleOntologyOrg2#AvailabilityConfirmation</strong>"/&gt;
&lt;xsd:element name="numBundles_available" type="xsd:string"
<strong>sawsdl:modelReference="http://org2.example.com/ontologies/SampleOntologyOrg2#NumBundles</strong>"/&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;/xsd:element&gt;
&lt;/xsd:schema&gt;
&lt;/wsdl:types&gt;
&lt;wsdl:interface name="CheckInventoryService"&gt;
&lt;wsdl:operation name="checkInventoryOperation" pattern="http://www.w3.org/ns/wsdl/in-out"&gt;
&lt;wsdl:input element="CheckInventoryServiceRequest"/&gt;
&lt;wsdl:output element="CheckInventoryServiceResponse"/&gt;
&lt;/wsdl:operation&gt;
&lt;/wsdl:interface&gt;
&lt;/wsdl:description&gt;</pre>
<p><strong>Listing 3.4-1</strong>: CheckInventoryService() WSDL sample with
a variation where the input SKU is replaced by UPC for the purpose of
illustrating Web service composition with ontology reasoning. This WSDL sample is
also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/SemannCheckInventoryService2.V2.wsdl">http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/SemannCheckInventoryService2.V2.wsdl</a>.</p>
<p>A WSDL sample of SKU2UPCLookupService() is shown below.</p>
<pre>&lt;wsdl:description
targetNamespace="http://org3.example/com/wsdl/SKU2UPCLookupService/"&gt;
&lt;wsdl:types&gt;
&lt;xsd:schema targetNamespace="http://org3.example.com/wsdl/SKU2UPCLookupService"&gt;
&lt;xsd:element name="SKU2UPCLookupServiceRequest" type="SKU"/&gt;
&lt;xsd:simpleType name="SKU"&gt;
<strong>sawsdl:modelReference="http://org3.example.com/ontologies/SampleOntologyOrg3#SKU</strong>"&gt;
&lt;xsd:restriction base="xsd:string"/&gt;
&lt;/xsd:simpleType&gt;
&lt;xsd:element name="SKU2UPCLookupServiceResponse" type="UPC"/&gt;
&lt;xsd:simpleType name="UPC"&gt;
<strong>sawsdl:modelReference="http://org3.example.com/ontologies/SampleOntologyOrg3#UPC</strong>"&gt;
&lt;xsd:restriction base="xsd:string"/&gt;
&lt;/xsd:simpleType&gt;
&lt;/xsd:schema&gt;
&lt;/wsdl:types&gt;
&lt;wsdl:interface name="SKU2UPCLookupService"&gt;
&lt;wsdl:operation name="SKU2UPCLookupService" pattern="http://www.w3.org/ns/wsdl/in-out"
<strong>sawsdl:modelReference="http://org3.example.com/taxonomies/Utilities#LookupServices</strong>"&gt;
&lt;wsdl:input element="SKU2UPCLookupServiceRequest"/&gt;
&lt;wsdl:output element="SKU2UPCLookupServiceResponse"/&gt;
&lt;/wsdl:operation&gt;
&lt;/wsdl:interface&gt;
&lt;/wsdl:description&gt;</pre>
<p><strong>Listing 3.4-2</strong>: A WSDL sample representing SKU2UPCLookup
service. This WSDL is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/SKU2UPCLookupService.wsdl">http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/SKU2UPCLookupService.wsdl</a>.</p>
<p>Below, we list the three ontologies that are used in matching the
checkAvailabilityRequest() request WSDL with the checkInventoryService()
advertisement WSDL according to the scenario described in this section. The
first ontology shown in Listing 3.4-3 is the one used by the requesting
organization (referred to using the namespace
http://org1.example.com/ontologies/SampleOntologyOrg1)
that defined the checkAvailabilityRequest() request WSDL. Please note that
this differs from the Listing in 3.2-3 because this ontology contains the
'subClassOf' relationship between SKU and PartNumber concepts. The second
ontology shown in Listing 3.4-4 is the one used by the service advertising
organization (referred to using the namespace http://org2.example.com/ontologies/SampleOntologyOrg2) that defined the
checkInventoryService() advertisement WSDL. Please note that this differs
from the Listing in 3.2-4 because this contains the concept UPC instead of
SKU. The third one shown in Listing 3.2-5 is the mapping ontology defined by
a third organization (could possibly be defined by either of the first two
organizations as well) that relates the concepts from the two ontologies
defined by org1 and org2.</p>
<pre>@prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; .
@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
@prefix: &lt;http://org1.example.com/ontologies/SampleOntologyOrg1.V2#&gt; .
@prefix owl: &lt;http://www.w3.org/2002/07/owl#&gt; .
&lt;http://org1.example.com/ontologies/SampleOntologyOrg1.V2#&gt; rdf:type owl:Ontology .
:PartNumber rdf:type owl:Class .
:SKU rdf:type owl:Class;
rdfs:subClassOf :PartNumber .
:DueDate rdf:type owl:Class .
:Quantity rdf:type owl:Class .
:AvailabilityConfirmation rdf:type owl:Class .</pre>
<p><strong>Listing 3.4-3:</strong>Sample Ontology used
by the organization that defined checkAvailabilityRequest() request WSDL.
This ontology is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/ontologies/SampleOntologyOrg1.V2.n3">http://www.w3.org/2002/ws/sawsdl/spec/examples/ontologies/SampleOntologyOrg1.V2.n3</a>.</p>
<pre>@prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; .
@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
@prefix: &lt;http://org2.example.com/ontologies/SampleOntologyOrg2.V2#&gt; .
@prefix owl: &lt;http://www.w3.org/2002/07/owl#&gt; .
&lt;http://org2.example.com/ontologies/SampleOntologyOrg2.V2#&gt; rdf:type owl:Ontology .
:UPC rdf:type owl:Class;
:DeliveryDate rdf:type owl:Class .
:NumBundles rdf:type owl:Class .
:AvailabilityConfirmation rdf:type owl:Class .
</pre>
<p><strong>Listing 3.4-4</strong>: Sample Ontology used by
the organization that defined checkInventoryService() advertisement WSDL.
This ontology is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/ontologies/SampleOntologyOrg2.V2.n3">http://www.w3.org/2002/ws/sawsdl/spec/examples/ontologies/SampleOntologyOrg2.V2.n3</a>.</p>
<p>Listing 3.4-5 represents the updated sample ontology that enables
composition in this example. It relates the concepts in the ontologies shown
in Listings 3.4-3 and 3.4-4. Note that the ontology as such does not specify
any relationship between SKU and UPC. Given a SKU, its corresponding UPC
code is retrieved by the Web service SKU2UPCLookup(). Here also, we assume
that the organization that is providing the SKU2UPCLookupService() is
providing the mapping ontology as well. As mentioned earlier in Section 3.3,
this does not always have to be the case.</p>
<pre>@prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; .
@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
@prefix: &lt;http://org1.example.com/ontologies/RevisedMappingOntology.V2#&gt; .
@prefix Org1Ont: &lt;http://org1.example.com/ontologies/SampleOntologyOrg1#&gt; .
@prefix Org2Ont: &lt;http://org2.example.com/ontologies/SampleOntologyOrg2#&gt; .
@prefix Org3Ont: &lt;http://org3.example.com/ontologies/SampleOntologyOrg3#&gt; .
@prefix owl: &lt;http://www.w3.org/2002/07/owl#&gt; .
&lt;http://org3.example.com/ontologies/RevisedMappingOntology.V2#&gt; rdf:type owl:Ontology .
Org2Ont:NumBundles owl:equivalentClass Org1Ont:Quantity .
Org2Ont:DeliveryDate owl:equivalentClass Org1Ont:DueDate .
Org2Ont:AvailabilityConfirmation owl:equivalentClass Org1Ont:AvailabilityConfirmation .
<strong>Org3Ont:SKU rdf:type owl:Class;
owl:equivalentClass Org1Ont:SKU .
Org3Ont:UPC rdf:type owl:Class;
owl:equivalentClass Org2Ont:UPC .</strong> </pre>
<p><strong>Listing 3.4-5</strong>: Revised Mapping Ontology that contains
relationships between concepts PartNumber, SKU, and UPC among other things
that is used in this section to illustrate Web service composition using
ontology reasoning. This ontology is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/ontologies/RevisedMappingOntology.V2.n3">http://www.w3.org/2002/ws/sawsdl/spec/examples/ontologies/RevisedMappingOntology.V2.n3</a>.</p>
<p>Figure 3 represents an altered version of the ontology that enables
composition in this example.</p>
<div id="Figure3" style="text-align: center">
<p><img src="img/sampleRetailOntology-Mediation.png"
alt="asampleRetailOntology-Mediation"
title="Figure 3: An altered version of the simple sample retail ontology that enables composition"
/></p>
<p><strong>Figure 3</strong>: An altered version of the simple sample retail
ontology that enables composition</p>
</div>
<p>Figure 4 shows how Web service composition can be achieved by using the
semantic annotations in the WSDL files discussed in this example. As can be
noted, in this scenario, a semantic engine retrieves the semantic annotations
from checkAvailabilityRequest() for element itemCode namely PartNumber and
for the element SKU in SKU2UPCLookup() service namely SKU. The annotation
PartNumber does not match lexically with the concept SKU. So, the semantic
engine could then consult the MappingOntology to see if there is any
relationship between PartNumber and SKU. The ontology reasoner can return the
existence of 'subClassOf' relationship between SKU and PartNumber. This
information can then be used in composing SKU2UPCLookup() with
CheckInventoryService() as shown in <a href="#Figure4">Figure 4</a> to match
the request CheckAvailabilityRequest(). Again, as mentioned earlier in
Section 3.3, a matching engine would be able to find a utility service such
as SKU2UPCLookup() in the appropriate category in a registry - in this case
it would be in 'Utilities/LookupServices' category because the modelReference
on the operation of this service contains the categorization information. So,
presumably a publishing agent/program would have placed this service in the
appropriate category that is referred to by the <em>modelReference</em>
URI.</p>
<div id="Figure4" style="text-align: center">
<p><img src="img/ItemAvailabilityComposition.png"
alt="sampleRetailOntology-Mediation"
title="Figure 4: A Web Service Composition Scenario with Possible Ontology Reasoning"
/></p>
<p><strong>Figure 4</strong>: A Web Service Composition Scenario with
Ontology Reasoning</p>
</div>
<p>The example presented in this section was a variation of the one discussed
in Section 3.4. It illustrated how Web service composition can be achieved
using the relationships between concepts in an ontology even when the semantic
annotations on the services don't match directly.</p>
<h3><a name="multiple" id="multiple">3.5 Matching Using Multiple
Annotations</a></h3>
<p>SAWSDL allows multiple annotations to be associated with those WSDL
elements that can have a <em>modelReference</em> extension. These annotations
could be pointing to different concepts from the same semantic model or from
different models altogether. For example, a WSDL element with the name
<em>itemCode</em> can be associated with <em>SampleOntology#PartNumber</em>
and <em>SampleOntology#SKU</em> concepts. SAWSDL does not specify any
relationship between these multiple annotations other than saying that they
all apply. It is up to the consumers of these annotated WSDLs to use the ones
that are relevant to them or to figure out the relationship between the
concepts, if they so choose, by consulting the ontology that defines them.
The following example in Listing 3.5-1 shows the annotation of
<em>itemCode</em> with multiple annotations. If a requesting WSDL is
annotated with multiple concepts like shown in Listing 3.5-1, this increases
the likelihood of matching this request with other advertisement/service
WSDLs. Similarly, if a service WSDL is annotated with multiple concepts,
possibly more request WSDLs will match it.</p>
<pre> ...
&lt;xsd:simpleType name="itemCode"
<strong>sawsdl:modelReference="http://org3.example.com/ontologies/SampleOntologyOrg3#PartNumber
http://org3.example.com/ontologies/SampleOntologyOrg3#SKU"</strong>/&gt;
&lt;xsd:restriction base="xsd:string"/&gt;
&lt;/xsd:simpleType&gt;
...</pre>
<p><strong>Listing 3.5-1</strong>: A WSDL sample showing multiple
annotations to a simple type</p>
<p>The example given in this section so far illustrated multiple annotations
that come from the same ontology. It is possible for elements to be annotated
with concepts from different ontologies as well. The mechanism for doing so
is exactly the same as the one employed in Listing 3.5-1 except in the latter
case, the namespaces for the concepts coming from different ontolgies would
be different.</p>
<h3><a name="complex" id="complex">3.6 Matching Using Complex Type
Annotations</a></h3>
<p>In the examples that we discussed so far, all annotations are added at the
member element levels of a complex type. SAWSDL allows annotations to be
added either at the complex type level (top level) or at the member element
level (bottom level) or both. In cases where both complex type and the member
elements have annotations, SAWSDL does not specify any relationship between
the <em>modelReferences</em> on a complex type and those on the elements
contained within a complex type. The listing below (Listing 3.6-1)
illustrates the usage of <em>modelReference</em> for annotating the complex
type 'ItemRequest' as well as the member elements.</p>
<pre>&lt;wsdl:types&gt;
...
&lt;xsd:element name="ItemRequest"
<strong>sawsdl:modelReference="http://org3.example.com/ontologies/SampleOntologyOrg3#OrderItem"</strong>&gt;
&lt;xsd:complexType&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element name="itemCode" type="xsd:string"/&gt;
&lt;xsd:element name="date" type="xsd:string"/&gt;
&lt;xsd:element name="qty" type="xsd:string"/&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;/xsd:element&gt;
...
&lt;/wsdl:types&gt;</pre>
<p><strong>Listing 3.6-1</strong>: A WSDL sample from
CheckAvailabilityRequest() showing the annotation of a
<em>complexType</em>.</p>
<p>Here is one possible way in which the annotation on a complex type can be
used. The annotation on the complex type 'itemRequest' such as the one in
Listing 3.6-1 which is part of checkAvailabilityRequest() can be used to
match another complex type such as the one in checkInventoryService() shown
in Listing 3.6-2 below. The annotation on a complex type can be used a first
level of matching in structure matching i.e., a semantic matching engine
could use these annotations to see if two complex types have any relationship
at all. If they do, perhaps spending more time on matching the member
elements of complex types may be worth the time. If not, perhaps there is no
need to do detailed matching of complex structures. Therefore, the
annotations on complex types can be used for first level of structure
matching.</p>
<pre> &lt;wsdl:types&gt;
...
&lt;xsd:element name="Item"
<strong>sawsdl:modelReference="http://org3.example.com/ontologies/SampleOntologyOrg3#OrderItem"</strong>&gt;
&lt;xsd:complexType&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element name="SKU" type="xsd:string"/&gt;
&lt;xsd:element name="deliveryDate" type="xsd:string"/&gt;
&lt;xsd:element name="numBundles" type="xsd:float"/&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;/xsd:element&gt;
...
&lt;/wsdl:types&gt;</pre>
<p><strong>Listing 3.6-2</strong>: A WSDL sample from CheckInventoryService()
showing the annotation of a compex type.</p>
<h3><a name="conditions" id="conditions">3.7 Representing Conditions</a></h3>
<p>The <em>modelReference</em> attribute can be used to represent behavioral
constraints related with services. For example, in the purchase order
scenario, if we were to add the following "inputRule" constraints related to shipping
details, they can be represented in SAWSDL using <em>modelReferences</em> as
shown in Listing 3.7-1.</p>
<ul>
<li>Only packages weighing 50 lbs or less can be shipped</li>
<li>Shipping is possible only in North America, and Europe.</li>
<li>Delivery is possible only between 7am and 8pm.</li>
<li>Delivery has to be ordered at least 2 working days in advance.</li>
</ul>
<p>We would like to represent the following effects on the outputs of a purchase order service.</p>
<ul>
<li>If more than 50lbs was ordered, order is taken only for 50lbs
("outputRule1").</li>
<li>ItemConfirmation # can be tracked only for 30 days after the order was
placed ("outputRule2").</li>
<li>If the order does not arrive the shipping location within the required
date, no charge will be made to the account ("outputRule3").</li>
</ul>
<p><a href="#conditionlistings">Appendix A</a> contains listings that attempt
to formalize these rules.</p>
<pre>&lt;wsdl:description
targetNamespace="http://org1.example.com/wsdl/CheckAvailabilityRequestService/"
xmlns="http://org1.example.com/wsdl/CheckAvailabilityRequestService/"
xmlns:wsdl="http://www.w3.org/ns/wsdl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;wsdl:types&gt;
&lt;xsd:schema targetNamespace=http://org1.example.com/wsdl/CheckAvailabilityRequestService"&gt;
&lt;xsd:element name="CheckAvailabilityRequestServiceRequest"&gt;
&lt;xsd:complexType&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element name="itemCode" type="xsd:string"/&gt;
&lt;xsd:element name="date" type="xsd:string"/&gt;
&lt;xsd:element name="qty" type="xsd:float"/&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;/xsd:element&gt;
&lt;xsd:element name="CheckAvailabilityRequestServiceResponse" type="itemConfirmation"/&gt;
&lt;xsd:simpleType name="itemConfirmation"&gt;
&lt;xsd:restriction base="xsd:boolean"/&gt;
&lt;/xsd:simpleType&gt;
&lt;/xsd:schema&gt;
&lt;/wsdl:types&gt;
&lt;wsdl:interface name="CheckAvailabilityRequestService"&gt;
&lt;wsdl:operation name="CheckAvailabilityRequestOperation" pattern="http://www.w3.org/ns/wsdl/in-out"&gt;
&lt;wsdl:input element="CheckAvailabilityRequestServiceRequest"
<strong>sawsdl:modelReference="http://org1.example.com/rules#inputRule"</strong>/&gt;
&lt;wsdl:output element="CheckAvailabilityRequestServiceResponse"
<strong>sawsdl:modelReference="http://org1.example.com/rules#outputRule1
http://org1.example.com/rules#outputRule2
http://org1.example.com/rules#outputRule3"</strong>/&gt;
&lt;/wsdl:operation&gt;
&lt;/wsdl:interface&gt;
&lt;/wsdl:description&gt;</pre>
<p>Listing 3.7-1: An example showing the usage of modelReference to represent conditions</p>
<p>We have discussed how to annotate WSDL documents with semantic
concepts for use in Web service discovery, matching and composition.These
annotations that can be added to a WSDL using modelReferences are meant to
add semantic clarity to WSDL elements by pointing to concepts in a semantic
model that describes the larger context. They help understand whether a
service matches clients' requests at a semantic level. However, there may
still be mismatches at the data level that would need to be addressed and
captured to enable the invocation of a Web service. In the following section,
we discuss the mechanisms defined in SAWSDL to capture such data
transformation maps (known as schema mappings) to enable Web service
invocation.</p>
<h2><a name="invocation" id="invocation">4. Defining Schema Mappings to
Enable Web Service Invocation</a></h2>
<p>Consider the example where a client/requester may have a 'first name' and
'last name' among its data as shown in Listing 4-1 and the advertisement
service requires a 'full name' as shown in Listing 4-2. In this case, when
the client invokes the Web service of the service provider, the data values
of <em>firstName</em> and <em>lastName</em> need to be concatenated in the
message to the advertisement Web service to pass the correct values for the
<em>Name</em> element.</p>
<pre>..
&lt;xsd:element name="firstName" type="xsd:string"/&gt;
&lt;xsd:element name="lastName" type="xsd:string"/&gt;
..</pre>
<p><strong>Listing 4-1</strong>: An XML sample showing two elements
<em>firstName</em> and <em>lastName</em>.</p>
<pre>..
&lt;xsd:element name="Name" type="xsd:string"/&gt;
..</pre>
<p><a name="OrderRequest"></a><strong>Listing 4-2</strong>: An XML sample showing an element
<em>Name</em>.</p>
<p>To facilitate the association of such types of data transformations with
Web services, SAWSDL provides a mechanism called <em>Schema mapping</em>. A
<em>Schema mapping</em> allows the specification of
transformation functions on the WSDL elements to map instance data defined by
that XML schema document to the semantic data of the concepts in a semantic
model. It also allows the specification of transformation functions
that map the semantic data of ontological concepts to the instance data
values that adhere to the XML schema document that is being annotated. In
the former case, the transformation functions are referred to using the
extensibility attribute <em>liftingSchemaMapping</em> and in the latter case
it is called <em>loweringSchemaMapping</em>. These kinds of mappings are
useful in general when the structure of the XML instance data does not correspond
directly to the organization of the semantic data. Also, these types of
mappings can be used to generate mediation code to support invocation of a
Web service.</p>
<p>In the remaining part of this section, we illustrate these lifting and
lowering schema mappings in the context of a purchase order scenario. We use
XSLT [XSLT] as the mapping language for illustrative purposes. SAWSDL
specification by itself does not prescribe any specific mapping language.
Users can choose a mapping language of their choice. The purchase order
scenario is very similar to the check availability scenario we have been
discussing throughout this document so far.</p>
<h2><a name="lifting" id="lifting">4.1 Lifting Schema Mapping</a></h2>
<p>A liftingSchemaMapping takes as input XML data (that adheres to a given
XML schema) and produces semantic data (that adheres to a semantic model, in our case an RDF ontology) as
output. Let us consider purchase order scenario. Listing 4.1-1 shows samples
of a WSDL that has OrderRequest, item and OrderResponse complex types. Say
that we would like to specify a lifting schema mapping notion on OrderRequest
complex type so that an XML instance of an OrderRequest complex type can be
mapped with the semantic data in the RDF graph shown in Listing 4.1-2. Then,
we would specify OrderRequest2Ont.xslt as a lifting schema mapping notion on
OrderRequest concept as shown in Listing 4.1-1 below.</p>
<pre>&lt;wsdl:description&gt;
...
&lt;wsdl:types&gt;
&lt;xsd:schema
targetNamespace="http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/PurchaseOrderService#" elementFormDefault="qualified"&gt;
&lt;xsd:element name="OrderRequest"&gt;
&lt;xsd:complexType <strong>sawsdl:liftingSchemaMapping="http://www.w3.org/2002/ws/sawsdl/spec/examples/mapping/OrderRequest2Ont.xslt"</strong>&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element name="firstName" type="xsd:string"/&gt;
&lt;xsd:element name="lastName" type="xsd:string"/&gt;
&lt;xsd:element name="item" type="item" minOccurs="1" maxOccurs="unbounded" /&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;/xsd:element&gt;
&lt;xsd:complexType name="item"&gt;
&lt;xsd:all&gt;
&lt;xsd:element name="itemCode" type="xsd:string"/&gt;
&lt;xsd:element name="quantity" type="xsd:float"/&gt;
&lt;xsd:element name="dueDate" type="xsd:string"/&gt;
&lt;xsd:element name="billingInfo" type="xsd:POBilling"/&gt;
&lt;/xsd:all&gt;
&lt;/xsd:complexType&gt;
&lt;xsd:element name="OrderResponse" type="Confirmation"/&gt;
&lt;xsd:simpleType name="Confirmation"&gt;
&lt;xsd:restriction base="xsd:string"&gt;
&lt;xsd:enumeration value="Confirmed"/&gt;
&lt;xsd:enumeration value="Pending"/&gt;
&lt;xsd:enumeration value="Rejected"/&gt;
&lt;/xsd:restriction&gt;
&lt;/xsd:simpleType&gt;
&lt;/xsd:schema&gt;
&lt;/wsdl:types&gt;
&lt;wsdl:interface name="Order"&gt;
&lt;wsdl:operation name="order" pattern="http://www.w3.org/ns/wsdl/in-out"&gt;
&lt;wsdl:input element="OrderRequest"/&gt;
&lt;wsdl:output element="OrderResponse"/&gt;
&lt;/wsdl:operation&gt;
&lt;/wsdl:interface&gt;
&lt;/wsdl:description&gt;
...</pre>
<p><strong>Listing 4.1-1</strong>: A WSDL sample showing
<em>liftingSchemaMapping</em> notion. This example is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/PurchaseOrderService.wsdl">http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/PurchaseOrderService.wsdl</a>.</p>
<p>Listing 4.1-1 refers to
http://www.w3.org/2002/ws/sawsdl/spec/examples/mapping/OrderRequest2Ont.xslt.
This XSLT maps the elements of OrderRequest complex type with the
corresponding ones in the ontology shown in 4.1-2.</p>
<pre>@prefix xs: &lt;http://www.w3.org/2001/XMLSchema#&gt; .
@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
@prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; .
@prefix owl: &lt;http://www.w3.org/2002/07/owl#&gt; .
@prefix : &lt;http://org1.example.com/ontologies/PurchaseOrder#&gt; .
&lt;http://org1.example.com/ontologies/PurchaseOrder#&gt; rdf:type owl:Ontology .
:OrderRequest rdf:type owl:Class .
:hasLineItems rdf:type owl:ObjectProperty ;
rdfs:domain :OrderRequest ;
rdfs:range :LineItem .
:LineItem rdf:type owl:Class .
:hasPart rdf:type owl:ObjectProperty , owl:FunctionalProperty ;
rdfs:domain :LineItem ;
rdfs:range :Part .
:Part rdf:type owl:Class .
:hasPartCode rdf:type owl:ObjectProperty ;
rdfs:domain :Part ;
rdfs:range :PartNum .
:PartNum rdf:type owl:Class .
:hasLexicalRespresentation rdf:type owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain
[ rdf:type owl:Class ;
owl:unionOf (:Name :PartNum :Date)
] ;
rdfs:range xs:string .
:hasDueDate rdf:type owl:ObjectProperty ;
rdfs:domain :LineItem ;
rdfs:range :Date .
:Date rdf:type owl:Class .
:hasQuantity rdf:type owl:DatatypeProperty ;
rdfs:domain :LineItem ;
rdfs:range xs:float .
:hasBillingInfo rdf:type owl:DatatypeProperty ;
rdfs:domain :LineItem ;
rdfs:range xs:billingInfo .
:hasCustomer rdf:type owl:ObjectProperty , owl:FunctionalProperty ;
rdfs:domain :OrderRequest ;
rdfs:range :Customer .
:Customer rdf:type owl:Class .
:hasCustomerName rdf:type owl:ObjectProperty ;
rdfs:domain :Customer ;
rdfs:range :Name .
:Name rdf:type owl:Class .</pre>
<p><strong>Listing 4.1-2</strong>: A PurchaseOrder ontology. This ontology is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/ontologies/PurchaseOrder.n3">http://www.w3.org/2002/ws/sawsdl/spec/examples/ontologies/PurchaseOrder.n3</a>.</p>
<p>Given a OrderRequest message (as shown in Listing 4.1-3) which corresponds
to the schema in Listing 4.1-1, the part where an XSLT would be of most value
in this example is where the values of firstName and lastName are
concatenated to match with the semantic data of the concept 'Name' in the
PurchaseOrder Ontology. A sample of such a transformation in XSLT is shown
in Listing 4.1-4 below.</p>
<pre>&lt;OrderRequest
xmlns="http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/PurchaseOrderService#"&gt;
&lt;firstName&gt;John&lt;/firstName&gt;
&lt;lastName&gt;Smith&lt;/lastName&gt;
&lt;item&gt;
&lt;itemCode&gt;052053811&lt;/itemCode&gt;
&lt;quantity&gt;12.0&lt;/quantity&gt;
&lt;dueDate&gt;20061114&lt;/dueDate&gt;
&lt;billingInfo&gt;88 Park Road, Lower Dangan, Galway, Ireland&lt;/billingInfo&gt;
&lt;/item&gt;
&lt;item&gt;
&lt;itemCode&gt;45001113&lt;/itemCode&gt;
&lt;quantity&gt;10.0&lt;/quantity&gt;
&lt;dueDate&gt;20061224&lt;/dueDate&gt;
&lt;billingInfo&gt;70 Sandyhill Road, Shalthill, Galway, Ireland&lt;/billingInfo&gt;
&lt;/item&gt;
&lt;/OrderRequest&gt;</pre>
<p><strong>Listing 4.1-3</strong>: A sample XML data that adheres to
the WSDL in Listing 4.1-1. </p>
<pre>&lt;!DOCTYPE rdf:RDF
[&lt;!ENTITY xs "http://www.w3.org/2001/XMLSchema#"&gt;
]
&gt;
&lt;xsl:transform version="2.0"
xmlns:order="http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/PurchaseOrderService#"
xmlns:po="http://org1.example.com/ontologies/PurchaseOrder#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:owl="http://www.w3.org/2002/07/owl#"&gt;
&lt;xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes" /&gt;
&lt;xsl:template match="/order:OrderRequest"&gt;
&lt;rdf:RDF&gt;
&lt;owl:Ontology/&gt;
&lt;po:OrderRequest&gt;
&lt;po:hasCustomer&gt;
&lt;po:Customer&gt;
&lt;po:hasCustomerName&gt;
&lt;po:Name&gt;
&lt;po:hasLexicalRepresentation&gt;
&lt;xsl:value-of select="concat(
order:firstName,
' ',
order:lastName)"/&gt;
&lt;/po:hasLexicalRepresentation&gt;
&lt;/po:Name&gt;
&lt;/po:hasCustomerName&gt;
&lt;/po:Customer&gt;
&lt;/po:hasCustomer&gt;
&lt;po:hasLineItems&gt;
&lt;po:LineItem&gt;
&lt;po:hasPart&gt;
&lt;po:Part&gt;
&lt;po:hasPartCode&gt;
&lt;po:PartNum&gt;
&lt;po:hasLexicalRepresentation&gt;
&lt;xsl:value-of select="order:item/order:itemCode"/&gt;
&lt;/po:hasLexicalRepresentation&gt;
&lt;/po:PartNum&gt;
&lt;/po:hasPartCode&gt;
&lt;/po:Part&gt;
&lt;/po:hasPart&gt;
&lt;po:hasDueDate&gt;
&lt;po:Date&gt;
&lt;po:hasLexicalRepresentation&gt;
&lt;xsl:value-of select="order:item/order:dueDate"/&gt;
&lt;/po:hasLexicalRepresentation&gt;
&lt;/po:Date&gt;
&lt;/po:hasDueDate&gt;
&lt;po:hasQuantity rdf:datatype="&amp;xs;float"&gt;
&lt;xsl:value-of select="order:item/order:quantity"/&gt;
&lt;/po:hasQuantity&gt;
&lt;po:hasBillingInfo rdf:datatype="&amp;xs;POBilling"&gt;
&lt;xsl:value-of select="order:item/order:billingInfo"/&gt;
&lt;/po:hasBillingInfo&gt;
&lt;/po:LineItem&gt;
&lt;xsl:apply-templates select="order:OrderRequest" /&gt;
&lt;/po:hasLineItems&gt;
&lt;/po:OrderRequest&gt;
&lt;/rdf:RDF&gt;
&lt;/xsl:template&gt;
&lt;/xsl:transform&gt; </pre>
<p><strong>Listing 4.1-4</strong>: An XSLT sample that concatenates the
values of firstName and lastName elements to form the semantic data of the
concept Name in the ontology. This example is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/mapping/OrderRequest2Ont.xslt">http://www.w3.org/2002/ws/sawsdl/spec/examples/mapping/OrderRequest2Ont.xslt</a>.</p>
<p>A sample semantic data that is obtained by applying XSLT in Listing 4.1-4
to WSDL in Listing 4.1-3 is shown in Listing 4.1-5.</p>
<pre>&lt;!DOCTYPE rdf:RDF[
&lt;!ENTITY xs "http://www.w3.org/2001/XMLSchema#" &gt;
]
&gt; &lt;rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns="http://org1.example.com/ontologies/PurchaseOrder#"
xml:base="http://org1.example.com/ontologies/PurchaseOrder#"&gt;
&lt;owl:Ontology /&gt;
&lt;OrderRequest&gt;
&lt;hasLineItems&gt;
&lt;LineItem&gt;
&lt;hasPart&gt;
&lt;part&gt;
&lt;hasPartCode&gt;
&lt;partNum&gt;
&lt;hasLexicalRespresentation&gt;052053811&lt;/hasLexicalRespresentation&gt;
&lt;/partNum&gt;
&lt;/hasPartCode&gt;
&lt;/part&gt;
&lt;/hasPart&gt;
&lt;hasDueDate&gt;
&lt;date&gt;
&lt;hasLexicalRespresentation&gt;20061114&lt;/hasLexicalRespresentation&gt;
&lt;/date&gt;
&lt;/hasDueDate&gt;
&lt;hasQuantity rdf:datatype="&amp;xs;float"&gt;12.0&lt;/hasQuantity&gt;
&lt;hasBillingInfo rdf:datatype="&amp;xs;POBilling"&gt;88 Park Road, Lower Dangan, Galway, Ireland&lt;/hasBillingInfo&gt;
&lt;/LineItem&gt;
&lt;/hasLineItems&gt;
&lt;hasCustomer&gt;
&lt;Customer&gt;
&lt;hasCustomerName&gt;
&lt;Name&gt;
&lt;hasLexicalRespresentation&gt;John Smith&lt;/hasLexicalRespresentation&gt;
&lt;/Name&gt;
&lt;/hasCustomerName&gt;
&lt;/Customer&gt;
&lt;/hasCustomer&gt;
&lt;/OrderRequest&gt;
&lt;/rdf:RDF&gt; </pre>
<p><strong>Listing 4.1-5</strong>: A result semantic data that adheres
to the PurchaseOrder ontology. This example is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/ontologies/OrderRequest.rdf">http://www.w3.org/2002/ws/sawsdl/spec/examples/ontologies/OrderRequest.rdf</a>.</p>
</div>
<p>In this section, we have discussed how we can specify a
liftingSchemaMapping notion for the OrderRequest schema in Listing 4.1-1 to
generate an RDF instance as shown in 4.1-5. We can specify a
loweringSchemaMapping notion for the same OrderRequest schema as well. One
may want to specify both lifting and lowering schema mappings on a given
schema to ensure that the same schema can be used to represent both
requirements as well as capabilities. For example if the WSDL in 4.1-1 is
used to represent a clients' requirements, then a lifting schema mapping can
help translate the XML instances that correspond to OrderRequest schema into
the RDF data in Listing 4.1-2. Where as if the WSDL in 4.1-1 is used as an
advertisement, a lowering schema mapping would be useful because it can
enable a client (that has already translated its XML instance into the common
RDF semantic data using a liftingSchemaMapping) to map to its XML data.
Below, we illustrate two scenarios:</p>
<ul>
<li><strong>Roundtripping scenario</strong>: A scenario where both lifting
and lowering schema mappings are specified on the same WSDL schema (we
use Listing 4.1-1 for this)</li>
<li><strong>Web Service Invocation scenario</strong>: Second, where we
assume the WSDL in Listing 4.1-1 is that of a client/requester and
demonstrate how a loweringSchemaMapping when specified on another service
(advertisement) that shares the same ontology as the client could help
the client in Listing 4.1-1 to invoke this service.</li>
</ul>
<h2><a name="lowering" id="lowering">4.2 Lowering Schema Mapping</a></h2>
<p>As discussed, lowering schema mapping notion is used to map from RDF data
to XML data. First, we present adding loweringSchemaMapping to the same
OrderRequest XML schema discussed in Listing 4.1-1 (roundtripping scenario).
Sample of Listing 4.1-1 is shown below with an addition of
<em>loweringSchemaMapping</em>.</p>
<pre>&lt;xsd:element name="OrderRequest"&gt;
&lt;xsd:complexType <strong>sawsdl:liftingSchemaMapping="http://www.w3.org/2002/ws/sawsdl/spec/examples/mapping/OrderRequest2Ont.xslt
sawsdl:loweringSchemaMapping="http://www.w3.org/2002/ws/sawsdl/spec/examples/mapping/Ont2OrderRequest.lowering"</strong>&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element name="firstName" type="xsd:integer"&gt;John&lt;/xsd:element&gt;
&lt;xsd:element name="lastName" type="xsd:integer"&gt;Smith&lt;/xsd:element&gt;
&lt;xsd:element name="item" type="item" minOccurs="1" maxOccurs="unbounded" /&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;/xsd:element&gt;</pre>
<p><strong>Listing 4.2-1</strong>: A sample of OrderRequest complex type
from Listing 4.1-1 with loweringSchemaMapping added.</p>
<p>Below, we discuss what such a lowering schema mapping would look like. But
before that we have to introduce one more concept.</p>
<p>When specifying a <em>liftingSchemaMapping</em>, an XSLT transform can
create a specific XML that can be treated as the representation of semantic
data for an RDF/OWL ontology. While specifying
<em>loweringSchemaMapping</em>, on the other hand, it may not be clear what
format the semantic data of the ontology is expressed in (since there are
many variations of RDF semantic data representations in RDF/XML). To overcome this, one could use SPARQL language to query the
semantic data of the ontology to obtain a specific XML format for the
semantic data of the ontology so that it can then be used to formulate an
XSLT transform to obtain an XML that could correspond with the instance of a
Web service. A sample SPARQL query that could be used in
loweringSchemaMapping is shown in Listing 4.2-2 below.</p>
<pre>&lt;lowering&gt;
&lt;sparqlQuery&gt;
PREFIX po: &lt;http://org1.example.com/ontologies/PurchaseOrder#&gt;
SELECT ?name ?partNum ?quantity ?dueDate ?billingInfo
WHERE {
?order po:hasCustomer ?customer .
?customer po:hasCustomerName ?custName .
?custName po:hasLexicalRespresentation ?name .
?order po:hasLineItems ?item .
?item po:hasQuantity ?quantity .
?item po:hasBillingInfo ?billingInfo .
?item po:hasDueDate ?Date .
?date po:hasLexicalRepresentation ?dueDate .
?item po:hasPart ?part .
?part po:hasPartCode ?code .
?code po:hasLexicalRespresentation ?partNum }
&lt;/sparqlQuery&gt; </pre>
<p><strong>Listing 4.2-2</strong>: A SPARQL query on the semantic data (of an
ontology) to obtain an XML that could be used to specify XSLT transform in
loweringSchemaMapping</p>
<p>When SPARQL [<a href="#SPARQL">SPARQL</a>] is applied to the RDF graph in
Listing 4.1-5, the following XML will be generated as query answer.</p>
<pre>&lt;sparql xmlns="http://www.w3.org/2005/sparql-results#"&gt;
&lt;head&gt;
&lt;variable name="quantity" /&gt;
&lt;variable name="partNum" /&gt;
&lt;variable name="name" /&gt;
&lt;variable name="dueDate" /&gt;
&lt;variable name="billingInfo" /&gt;
&lt;/head&gt;
&lt;results&gt;
&lt;result&gt;
&lt;binding name="quantity"&gt;
&lt;literal&gt;12.0&lt;/literal&gt;
&lt;/binding&gt;
&lt;binding name="partNum"&gt;
&lt;literal&gt;052053811&lt;/literal&gt;
&lt;/binding&gt;
&lt;binding name="name"&gt;
&lt;literal&gt;John Smith&lt;/literal&gt;
&lt;/binding&gt;
&lt;binding name="billingInfo"&gt;
&lt;literal&gt;88 Park Road, Lower Dangan, Galway, Ireland&lt;/literal&gt;
&lt;/binding&gt;
&lt;binding name="dueDate"&gt;
&lt;literal&gt;20061114&lt;/literal&gt;
&lt;/binding&gt;
&lt;/result&gt;
&lt;/results&gt;
&lt;/sparql&gt;</pre>
<p><strong>Listing 4.2-3</strong>: Result of applying SPARQL from Listing
4.2-2 to RDF in Listing 4.1-5.</p>
<p>Once an XML is obtained from SPARQL query an XSLT transform can be
created. Listing 4.2-4 shows such an XSLT transform.</p>
<pre> &lt;xsl:transform version="2.0"
xmlns:po="http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/PurchaseOrderService#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sp="http://www.w3.org/2005/sparql-results#"&gt;
&lt;xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes" /&gt;
&lt;xsl:template match="/sp:sparql"&gt;
&lt;po:OrderRequest&gt;
&lt;xsl:variable name="fullName"&gt;
&lt;xsl:value-of select="sp:results/sp:result[position()=1]/sp:binding[@name='name']/sp:literal"/&gt;
&lt;/xsl:variable&gt;
&lt;po:firstName&gt;
&lt;xsl:value-of select="substring-before($fullName,' ')" /&gt;
&lt;/po:firstName&gt;
&lt;po:lastName&gt;
&lt;xsl:value-of select="substring-after($fullName,' ')" /&gt;
&lt;/po:lastName&gt;
&lt;xsl:apply-templates select="sp:results/sp:result" /&gt;
&lt;/po:OrderRequest&gt;
&lt;/xsl:template&gt;
&lt;xsl:template match="sp:result"&gt;
&lt;po:"item"&gt;
&lt;po:itemCode&gt;
&lt;xsl:value-of select="sp:binding[@name='partNum']/sp:literal" /&gt;
&lt;/po:itemCode&gt;
&lt;po:quantity&gt;
&lt;xsl:value-of select="sp:binding[@name='quantity']/sp:literal" /&gt;
&lt;/po:quantity&gt;
&lt;po:dueDate&gt;
&lt;xsl:value-of select="sp:binding[@name='dueDate']/sp:literal" /&gt;
&lt;/po:dueDate&gt;
&lt;po:billingInfo&gt;
&lt;xsl:value-of select="sp:binding[@name='billingInfo']/sp:literal" /&gt;
&lt;/po:billingInfo&gt;
&lt;/po:item&gt;
&lt;/xsl:template&gt;
&lt;/xsl:transform&gt;
&lt;/lowering&gt;</pre>
<p><strong>Listing 4.2-4</strong>: An XSLT sample that shows
loweringSchemaMapping notion. This example is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/mapping/Ont2OrderRequest.lowering">http://www.w3.org/2002/ws/sawsdl/spec/examples/mapping/Ont2OrderRequest.lowering</a>.</p>
<p>The result of executing the above XSLT (in Listing 4.2-4) is shown below
in Listing 4.2-5. As can be noted, this XML corresponds to the OrderRequest
complex type schema. With this, we have completed a full cycle of lifting and
lowering on the same schema to and from an RDF data.</p>
<pre>&lt;po:OrderRequest
xmlns:po="http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/PurchaseOrderService#"
xmlns:sp="http://www.w3.org/2005/sparql-results#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;po:firstName&gt;John&lt;/po:firstName&gt;
&lt;po:lastName&gt;Smith&lt;/po:lastName&gt;
&lt;po:item&gt;
&lt;po:itemCode&gt;052053811&lt;/po:itemCode&gt;
&lt;po:quantity&gt;12.0&lt;/po:quantity&gt;
&lt;po:dueDate&gt;20061114&lt;/po:dueDate&gt;
&lt;po:billingInfo&gt;88 Park Road, Lower Dangan, Galway, Ireland&lt;/po:billingInfo&gt;
&lt;/po:item&gt;
&lt;/po:OrderRequest&gt; </pre>
<p><strong>Listing 4.2-5</strong>: Result of applying XSLT from Listing 4.2-4
to SPARQL result of Listing 4.2-3.</p>
<p>In the remaining part of this section, we will illustrate the second
scenario (Web service invocation scenario). In this scenario, we will use
another service/WSDL as the advertised service that the client in Listing
4.1-1 is trying to invoke. Such an advertisement service is shown below in
Listing 4.2-6. As you can notice, the difference between this service and the
client in Listing 4.1-1 is that in this service in MyOrderRequest schema, the
format for the names is different from the one provided by the client. The
client can supply a 'firstName' and 'lastName' where as this advertisement
service only requires an initial for firstName and a last name- which
requires an additional level of data translation/manipulation.</p>
<pre>&lt;wsdl:description&gt;
...
&lt;wsdl:types&gt;
&lt;xsd:schema
targetNamespace="http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/MyPurchaseOrder#" elementFormDefault="qualified"&gt;
&lt;xsd:element name="MyOrderRequest"&gt;
&lt;xsd:complexType
<strong>sawsdl:loweringSchemaMapping="http://www.w3.org/2002/ws/sawsdl/spec/examples/mapping/Ont2MyOrderRequest.lowering"</strong>&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element name="firstinitial" type="xsd:string"/&gt;
&lt;xsd:element name="lastName" type="xsd:string"/&gt;
&lt;xsd:element name="item" type="item" minOccurs="1" maxOccurs="unbounded" /&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;/xsd:element&gt;
&lt;xsd:complexType name="item"&gt;
&lt;xsd:all&gt;
&lt;xsd:element name="itemCode" type="xsd:string"/&gt;
&lt;xsd:element name="quantity" type="xsd:float"/&gt;
&lt;xsd:element name="dueDate" type="xsd:string"/&gt;
&lt;xsd:element name="billingInfo" type="xsd:POBilling"/&gt;
&lt;/xsd:all&gt;
&lt;/xsd:complexType&gt;
&lt;xsd:element name="OrderResponse" type="Confirmation"/&gt;
&lt;xsd:simpleType name="Confirmation"&gt;
&lt;xsd:restriction base="xsd:string"&gt;
&lt;xsd:enumeration value="Confirmed"/&gt;
&lt;xsd:enumeration value="Pending"/&gt;
&lt;xsd:enumeration value="Rejected"/&gt;
&lt;/xsd:restriction&gt;
&lt;/xsd:simpleType&gt;
&lt;/xsd:schema&gt;
&lt;/wsdl:types&gt;
&lt;wsdl:interface name="Order"&gt;
&lt;wsdl:operation name="order" pattern="http://www.w3.org/ns/wsdl/in-out"&gt;
&lt;wsdl:input element="MyOrderRequest"/&gt;
&lt;wsdl:output element="OrderResponse"/&gt;
&lt;/wsdl:operation&gt;
&lt;/wsdl:interface&gt;
&lt;/wsdl:description&gt;
...</pre>
<p><strong>Listing 4.2-6</strong>: A WSDL sample of an advertisement service
with loweringSchemaMapping notion. This example is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/MyPurchaseOrder.wsdl">http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/MyPurchaseOrder.wsdl</a>.</p>
<p>To specify the lowering schema mapping for the schema in Listing 4.2-6 we
could use the same SPARQL query as presented in Listing 4.2-2 to obtain the
same result as in Listing 4.2-3. However, we need to supply a slightly
altered version of a XSLT transform to extract only the first initial from
the firstName. The modified XSLT transform for Ont2MyOrderRequest.xslt is
shown below in Listing 4.2-7.</p>
<pre> &lt;xsl:transform version="2.0"
xmlns:po="http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/PurchaseOrderService#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sp="http://www.w3.org/2005/sparql-results#"&gt;
&lt;xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes" /&gt;
&lt;xsl:template match="/sp:sparql"&gt;
&lt;po:OrderRequest&gt;
&lt;xsl:variable name="fullName"&gt;
&lt;xsl:value-of select="sp:results/sp:result[position()=1]/sp:binding[@name='name']/sp:literal"/&gt;
&lt;/xsl:variable&gt;
&lt;po:firstinitial&gt;
&lt;xsl:value-of select="substring(substring-before($fullName,' '),1,1)" /&gt;
&lt;/po:firstinitial&gt;
&lt;po:lastName&gt;
&lt;xsl:value-of select="substring-after($fullName,' ')" /&gt;
&lt;/po:lastName&gt;
&lt;xsl:apply-templates select="sp:results/sp:result" /&gt;
&lt;/po:OrderRequest&gt;
&lt;/xsl:template&gt;
&lt;xsl:template match="sp:result"&gt;
&lt;po:item&gt;
&lt;po:itemCode&gt;
&lt;xsl:value-of select="sp:binding[@name='partNum']/sp:literal" /&gt;
&lt;/po:itemCode&gt;
&lt;po:quantity&gt;
&lt;xsl:value-of select="sp:binding[@name='quantity']/sp:literal" /&gt;
&lt;/po:quantity&gt;
&lt;po:dueDate&gt;
&lt;xsl:value-of select="sp:binding[@name='dueDate']/sp:literal" /&gt;
&lt;/po:dueDate&gt;
&lt;po:billingInfo&gt;
&lt;xsl:value-of select="sp:binding[@name='billingInfo']/sp:literal" /&gt;
&lt;/po:billingInfo&gt;
&lt;/po:item&gt;
&lt;/xsl:template&gt;
&lt;/xsl:transform&gt;
&lt;/lowering&gt;</pre>
<p><strong>Listing 4.2-7</strong>: An XSLT sample that shows
loweringSchemaMapping notion for an XML instance that adheres to
MyOrderRequest schema in Listing 4.2-6. This example is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/mapping/Ont2MyOrderRequest.xslt">http://www.w3.org/2002/ws/sawsdl/spec/examples/mapping/Ont2MyOrderRequest.xslt</a>.</p>
<p>The corresponding XML data that can be obtained by executing the transform
in Listing 4.2-7 is shown in Listing 4.2-8.</p>
<pre>&lt;po:OrderRequest
xmlns:po="http://www.w3.org/2002/ws/sawsdl/spec/examples/wsdl/PurchaseOrderService#"
xmlns:sp="http://www.w3.org/2005/sparql-results#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;po:firstinitial&gt;J&lt;/po:firstinitial&gt;
&lt;po:lastName&gt;Smith&lt;/po:lastName&gt;
&lt;po:item&gt;
&lt;po:itemCode&gt;052053811&lt;/po:itemCode&gt;
&lt;po:quantity&gt;12.0&lt;/po:quantity&gt;
&lt;po:dueDate&gt;20061114&lt;/po:dueDate&gt;
&lt;po:billingInfo&gt;88 Park Road, Lower Dangan, Galway, Ireland&lt;/po:billingInfo&gt;
&lt;/po:item&gt;
&lt;/po:OrderRequest&gt; </pre>
<p><strong>Listing 4.2-8</strong>: Result of applying XSLT from Listing 4.2-7
to SPARQL result of Listing 4.2-3.</p>
<p>In summary, the lifting and lower schema mapping notions together enable
the transformation of data between Web services which can be an important
part of enabling the invocation of Web services.</p>
<p>Just as multiple annotations can be associated using modelReference
concept, multiple schema mappings can be associated with elements as well.
When multiple URIs are specified on liftingSchemaMapping or
loweringSchemaMapping, SAWSDL specifies that the schema mappings they
reference are to be treated as alternatives, i.e. the client processor should
choose one of them to apply, and the choice is fully at the client
processor's discretion. For example, a mapping can be selected based on what
mapping language the processor supports (different alternatives can use
different languages), based on the availability of the mapping document, or
by other preferences.Just as SAWSDL does not prescribe any particular
ontology representation language for specifying modelReferences, it does not
prescribe any particular schema mapping representation language. In this user
guide XSLT and SPARQL are used for illustrative purposes. Users are welcome to use
transformation language of their choice to specify lifting and lowering
schema mappings. Appendix B presents another example of such a language and
additional examples using that language.</p>
<h2><a name="conclusions" id="conclusions">5. Conclusions</a></h2>
<p>The SAWSDL Usage Guide is an accompanying document to <a
href="http://www.w3.org/TR/sawsdl/">SAWSDL</a> specification. This guide
presented examples to illustrate how to associate semantic annotations to a
Web service (represented in SAWSDL format) and how to use these annotations
for classifying, discovering, matching, composing, and invoking Web services.
Arguably, this usage guide presents only some of the ways in which the
annotations that can be associated with a WSDL document can be used.</p>
<h2><a name="references" id="references">6. References</a></h2>
<dl>
<dt>[<a name="NAICS" id="NAICS">NAICS</a>]</dt>
<dd><a href="http://www.census.gov/epcd/www/naics.html"><cite>North
American Industry Classification System.</cite></a> Available at
http://www.census.gov/epcd/www/naics.html.</dd>
<dt><a name="OWL" id="OWL">[OWL]</a></dt>
<dd><a href="http://www.w3.org/TR/2004/REC-owl-ref-20040210/"><cite>OWL
Web Ontology Language Reference</cite></a>, Mike Dean and Guus
Schreiber, Editors. W3C Recommendation, 10 February
2004,http://www.w3.org/TR/2004/REC-owl-ref-20040210/.<br />
<a href="http://www.w3.org/TR/owl-ref/">Latest version</a> available at
http://www.w3.org/TR/owl-ref/.</dd>
<dt>[<a name="RDF" id="RDF">RDF</a>]</dt>
<dd><a href="http://www.w3.org/TR/rdf-syntax-grammar/"><cite>Resource
Description Framework</cite></a>, Dave Beckett, Editor. World Wide Web
Consortium, 10th February 2004. This version is
http://www.w3.org/TR/rdf-syntax-grammar/</dd>
<dt>[<a name="RDFTurtle" id="RDFTurtle">RDF Turtle</a>]</dt>
<dd><a href="http://www.dajobe.org/2004/01/turtle/"><cite>Terse RDF
Triple Language</cite></a>, Dave Beckett, Editor. World Wide Web
Consortium, 4th April 2004. This version is
http://www.dajobe.org/2004/01/turtle/</dd>
<dt>[<a name="SAWSDL" id="SAWSDL">SAWSDL</a>]</dt>
<dd><a
href="http://www.w3.org/TR/2006/WD-sawsdl-20060928/"><cite>Semantic
Annotations for WSDL</cite></a>, Joel Farrell and Holger Lauson,
Editors. World Wide Web Consortium, 28th Sept 2006. This version is
http://www.w3.org/TR/2006/WD-sawsdl-20060928/.</dd>
<dt>[<a name="SPARQL" id="SPARQL">SPARQL</a>]</dt>
<dd><a href="http://www.w3.org/TR/rdf-sparql-query/"><cite>SPARQL Query
Language for RDF</cite></a>, Eric Prud'hommeaux and Andy Seaborne,
Editors. World Wide Web Consortium, 6 April 2006. This version is
http://www.w3.org/TR/2006/CR-rdf-sparql-query-20060406/. The <a
href="http://www.w3.org/TR/rdf-sparql-query/">latest version</a> is
available at http://www.w3.org/TR/rdf-sparql-query/.</dd>
<dt>[<a name="SWRL" id="SWRL">SWRL</a>]</dt>
<dd><a href="http://www.w3.org/Submission/SWRL/"><cite>SWRL: A Semantic Web Rule Language Combining OWL and RuleML</cite></a>, Ian Horrocks, Peter F. Patel-Schneider, Harold Boley, Said Tabet, Benjamin Grosof, Mike Dean, Authors. World Wide Web Consortium, 21 May 2004. This version is http://www.w3.org/Submission/SWRL/.</dd>
<dt>[<a name="UDDI1" id="UDDI1">UDDI</a>]</dt>
<dd><a href="http://uddi.org/pubs/uddi_v3.htm"><cite>UDDI Version
3.0.2</cite></a>, Luc Clement, Andrew Hately, Claus von Riegen, and
Tony Rogers, Editors. Organization for the Advancement of Structured
Information Standards (OASIS). Available at
http://uddi.org/pubs/uddi_v3.htm.</dd>
<dt>[<a name="WSDL2" id="WSDL2">WSDL 2.0</a>]</dt>
<dd><cite><a href="http://www.w3.org/TR/2006/CR-wsdl20-20060327/">Web
Services Description Language (WSDL) Version 2.0 Part 1: Core
Language</a></cite>, R. Chinnici, J-J. Moreau, A. Ryman, S.
Weerawarana, Editors. World Wide Web Consortium, 27 March 2006. This
version of the "Web Services Description Language (WSDL) Version 2.0
Part 1: Core Language" Specification is available is available at
http://www.w3.org/TR/2006/CR-wsdl20-20060327. The <a
href="http://www.w3.org/TR/wsdl20/">latest version of "Web Services
Description Language (WSDL) Version 2.0 Part 1: Core Language"</a> is
available at http://www.w3.org/TR/wsdl20.</dd>
<dt>[<a name="WSDL-S" id="WSDL-S">WSDL-S</a>]</dt>
<dd><cite><a href="http://www.w3.org/Submission/WSDL-S/">Web Service Semantics - WSDL-S</a></cite>, Rama Akkiraju,
Joel Farrell, John Miller, Meenakshi Nagarajan, Marc-Thomas Schmidt,
Amit Sheth, and Kunal Verma, Authors. World Wide Web Consortium, 7
November 2005. This version is http://www.w3.org/Submission/WSDL-S/.</dd>
<dt>[<a name="WSML" id="WSML">WSML</a>]</dt>
<dd><a href="http://www.w3.org/Submission/WSML/"><cite>Web Service Modeling Language (WSML)</cite></a>, Jos de Bruijn, Holger Lausen, Editors. World Wide Web Consortium, 3 June 2005. This version is http://www.w3.org/Submission/WSML/.</dd>
<dt>[<a name="XSLT" id="XSLT">XSLT</a>]</dt>
<dd><a href="http://www.w3.org/TR/xslt20/"><cite>XSL Transformations
(XSLT) Version 2.0</cite></a>, Michael Kay, Editor. World Wide Web
Consortium, 3 Nov 2005. This version is
http://www.w3.org/TR/2005/CR-xslt20-20051103/. The <a
href="http://www.w3.org/TR/xslt20/">latest version</a> is available at
http://www.w3.org/TR/xslt20/.</dd>
</dl>
<h2><a name="conditionlistings" id="conditionlistings">A. Condition
Expression Listings</a></h2>
<p>This appendix contains listings that formalize the rules from <a
href="#conditions">Section 3.7</a>. However, we do not guarantee validity or
correctness of these particular listings; they are provided here only for
illustration.</p>
<p> Listing A-1 captures the shipment conditions ("inputRule") in <a href="#SWRL">SWRL</a>
abstract syntax. Listing A-2 presents the same rule in human-readable syntax
and Listing A-3 encodes it, together with the output rules, in XML concrete syntax. The listing also
contains an OWL ontology which represents the concepts such as 'shipment',
'deliveryContinent', 'country' etc. that are used in the rule. Listing A-4 presents
the same input rule in <a href="#WSML">WSML</a> syntax. Finally listings A-5 and
A-6 capture the output rules in SWRL abstract syntax and in a human-readable
syntax.</p>
<pre>
; rule inputRule
Implies (
Antecedent
(
swrlb:subtractDayTimeDurations(D-variable(orderedSince) D-variable(deliveryDay) D-variable(orderDay))
swrlb:greaterThanOrEqual(D-variable(orderedSince) 2)
swrlb:greaterThanOrEqual(D-variable(deliveryHour) 7)
swrlb:lessThanOrEqual(D-variable(deliveryHour) 20)
swrlb:member(I-variable(deliveryContinent) (http://en.wikipedia.org/wiki/North_america http://en.wikipedia.org/wiki/Europe))
swrlb:lessThanOrEqual(D-variable(packageWeight) 50)
)
Consequent(shipment(I-variable(package))))
</pre>
<p>Listing A-1: A SWRL abstract syntax representation of the inputRule. This example is also available at: <a href="http://www.w3.org/2002/ws/sawsdl/spec/examples/rule/shipmentRuleAbstract.swrlx">http://www.w3.org/2002/ws/sawsdl/spec/examples/rule/shipmentRuleAbstract.swrlx</a>.
</p>
<pre>
; rule inputRule
(swrlb:subtractDayTimeDurations(?orderedSince, ?deliveryDay, ?orderDay) ^
swrlb:greaterThanOrEqual(?orderedSince, 2) ^
swrlb:greaterThanOrEqual(?deliveryHour, 7) ^
swrlb:lessThanOrEqual(?deliveryHour, 20) ^
swrlb:member(?deliveryContinent, (http://en.wikipedia.org/wiki/North_america http://en.wikipedia.org/wiki/Europe)) ^
swrlb:lessThanOrEqual(?packageWeight, 50)) => shippment(?package)
</pre>
<p>Listing A-2: A SWRL human-readable syntax representation of the rule as described above. This example is also available at: <a href="http://www.w3.org/2002/ws/sawsdl/spec/examples/rule/shipmentRuleHR.swrlx">http://www.w3.org/2002/ws/sawsdl/spec/examples/rule/shipmentRuleHR.swrlx</a>.
</p>
<pre>
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- <i>background knowledge about shipment </i> --&gt;
&lt;rdf:RDF&gt;
&lt;owl:Class rdf:ID="shipment"/>
&lt;owl:Class rdf:ID="order"/>
&lt;owl:Class rdf:ID="package"/>
&lt;owl:Class rdf:ID="deliveryContinent"/>
&lt;owl:Class rdf:ID="memberCountries">
&lt;rdfs:subClassOf rdf:resource="#deliveryContinent"&gt;
&lt;/owl:Class&gt;
&lt;owl:DatatypeProperty rdf:ID="orderDay"&gt;
&lt;rdfs:domain rdf:resource="#shipment"/&gt;
&lt;rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#date"/&gt;
&lt;/owl:DatatypeProperty&gt;
&lt;owl:DatatypeProperty rdf:ID="deliveryDay"&gt;
&lt;rdfs:domain rdf:resource="#shipment"/&gt;
&lt;rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#date"/&gt;
&lt;/owl:DatatypeProperty&gt;
&lt;owl:DatatypeProperty rdf:ID="packageWeight"&gt;
&lt;rdfs:domain rdf:resource="#shipment"/&gt;
&lt;rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#int"/&gt;
&lt;/owl:DatatypeProperty&gt;
&lt;owl:DatatypeProperty rdf:ID="deliveryHour"&gt;
&lt;rdfs:domain rdf:resource="#shipment"/&gt;
&lt;rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#dateTime"/&gt;
&lt;/owl:DatatypeProperty&gt;
&lt;owl:ObjectProperty rdf:ID="deliveryContinent"&gt;
&lt;rdfs:domain rdf:resource="#shipment"/&gt;
&lt;rdfs:range rdf:resource="#country"/&gt;
&lt;/owl:ObjectProperty&gt;
&lt;owl:ObjectProperty rdf:ID="hasOrder"&gt;
&lt;rdfs:domain rdf:resource="#package"/&gt;
&lt;rdfs:range rdf:resource="#order"/&gt;
&lt;/owl:ObjectProperty&gt;
&lt;ruleml:imp rdf:ID="inputRule"&gt;
&lt;ruleml:_rlab ruleml:href="#inputRule"/&gt;
&lt;owlx:Annotation&gt;
&lt;owlx:Documentation&gt;
Only packages weighing 50 lbs or less can be shipped.
Shipping is possible only in North America, and Europe.
Delivery is possible only between 7am and 8pm.
Delivery has to be ordered at least 2 working days in advance.
&lt;/owlx:Documentation&gt;
&lt;/owlx:Annotation&gt;
&lt;ruleml:_body&gt;
&lt;!-- <i>compute waiting time: diff of deliveryDate and orderDate</i> --&gt;
&lt;swrlx:builtinAtom swrlx:builtin="swrlb:subtractDates"&gt;
&lt;ruleml:var&gt;orderedSince&lt;/ruleml:var&gt;
&lt;ruleml:var&gt;deliveryDay&lt;/ruleml:var&gt;
&lt;ruleml:var&gt;orderDay&lt;/ruleml:var&gt;
&lt;/swrlx:builtinAtom&gt;
&lt;!-- <i>waiting time should be greater-than 2</i> --&gt;
&lt;swrlx:builtinAtom swrlx:builtin="swrlb:greaterThanOrEqual"&gt;
&lt;ruleml:var&gt;orderedSince&lt;/ruleml:var&gt;
&lt;owlx:DataValue owlx:datatype="xsd:int"&gt;2&lt;/owlx:DataValue&gt;
&lt;/swrlx:builtinAtom&gt;
&lt;!-- <i>only delivery between 07:00-20:00</i> --&gt;
&lt;swrlx:builtinAtom swrlx:builtin="swrlb:greaterThanOrEqual"&gt;
&lt;ruleml:var&gt;deliveryHour&lt;/ruleml:var&gt;
&lt;owlx:DataValue owlx:datatype="xsd:time"&gt;T7H&lt;/owlx:DataValue&gt;
&lt;/swrlx:builtinAtom&gt;
&lt;swrlx:builtinAtom swrlx:builtin="swrlb:lessThanOrEqual"&gt;
&lt;ruleml:var&gt;deliveryHour&lt;/ruleml:var&gt;
&lt;owlx:DataValue owlx:datatype="xsd:time"&gt;T20H&lt;/owlx:DataValue&gt;
&lt;/swrlx:builtinAtom&gt;
&lt;!-- <i>only deliver things below 50 pounds</i> --&gt;
&lt;swrlx:builtinAtom swrlx:builtin="swrlb:lessThanOrEqual"&gt;
&lt;ruleml:var&gt;packageWeight&lt;/ruleml:var&gt;
&lt;owlx:DataValue owlx:datatype="xsd:int"&gt;50&lt;/owlx:DataValue&gt;
&lt;/swrlx:builtinAtom&gt;
&lt;!-- <i>compute places where package can be delivered</i> --&gt;
&lt;swrlx:builtinAtom swrlx:builtin="swrlb:listConcate"&gt;
&lt;ruleml:var&gt;memberCountries&lt;/ruleml:var&gt;
&lt;owlx:DataValue owlx:datatype="rdf:list"&gt;http://en.wikipedia.org/wiki/North_america&lt;/owlx:DataValue&gt;
&lt;owlx:DataValue owlx:datatype="rdf:list"&gt;http://en.wikipedia.org/wiki/Europe&lt;/owlx:DataValue&gt;
&lt;/swrlx:builtinAtom&gt;
&lt;!-- <i>only delivery to Europe or NorthAmerica</i> --&gt;
&lt;swrlx:builtinAtom swrlx:builtin="swrlb:member"&gt;
&lt;ruleml:var&gt;deliveryContinent&lt;/ruleml:var&gt;
&lt;owlx:DataValue owlx:datatype="rdf:list"&gt;memberCountries&lt;/owlx:DataValue&gt;
&lt;/swrlx:builtinAtom&gt;
&lt;/ruleml:_body&gt;
&lt;/ruleml:imp&gt;
&lt;ruleml:imp&gt;
&lt;ruleml:_rlab ruleml:href="#outputRule1"/&gt;
&lt;owlx:Annotation&gt;
&lt;owlx:Documentation&gt;
If more than 50lbs was ordered, order is taken only for 50lbs
&lt;/owlx:Documentation&gt;
&lt;/owlx:Annotation&gt;
&lt;ruleml:_body&gt;
&lt;swrlx:individualPropertyAtom swrlx:property="hasOrder"&gt;
&lt;ruleml:var&gt;order&lt;/ruleml:var&gt;
&lt;ruleml:var&gt;packageWeight&lt;/ruleml:var&gt;
&lt;/swrlx:individualPropertyAtom&gt;
&lt;swrlx:builtinAtom swrlx:builtin="swrlb:greaterThan"&gt;
&lt;ruleml:var&gt;packageWeight&lt;/ruleml:var&gt;
&lt;owlx:DataValue owlx:datatype="xsd:int"&gt;50&lt;/owlx:DataValue&gt;
&lt;/swrlx:builtinAtom&gt;
&lt;/ruleml:_body&gt;
&lt;ruleml:_head&gt;
&lt;swrlx:individualPropertyAtom swrlx:property="hasOrder"&gt;
&lt;ruleml:var&gt;order&lt;/ruleml:var&gt;
&lt;owlx:DataValue owlx:datatype="xsd:int"&gt;50&lt;/owlx:DataValue&gt;
&lt;/swrlx:individualPropertyAtom&gt;
&lt;/ruleml:_head&gt;
&lt;/ruleml:imp&gt;
&lt;ruleml:imp&gt;
&lt;ruleml:_rlab ruleml:href="#outputRule2"/&gt;
&lt;owlx:Annotation&gt;
&lt;owlx:Documentation&gt;
ItemConfirmation # can be tracked only for 30 days after the order was placed
&lt;/owlx:Documentation&gt;
&lt;/owlx:Annotation&gt;
&lt;ruleml:_body&gt;
&lt;swrlx:builtinAtom swrlx:builtin="swrlb:subtractDates"&gt;
&lt;ruleml:var&gt;trackingTime&lt;/ruleml:var&gt;
&lt;ruleml:var&gt;orderDay&lt;/ruleml:var&gt;
&lt;ruleml:var&gt;today&lt;/ruleml:var&gt;
&lt;/swrlx:builtinAtom&gt;
&lt;swrlx:builtinAtom swrlx:builtin="swrlb:greaterThanOrEqual"&gt;
&lt;ruleml:var&gt;trackingTime&lt;/ruleml:var&gt;
&lt;owlx:DataValue owlx:datatype="xsd:time"&gt;T30H&lt;/owlx:DataValue&gt;
&lt;/swrlx:builtinAtom&gt;
&lt;/ruleml:_body&gt;
&lt;ruleml:_head&gt;
&lt;swrlx:individualPropertyAtom swrlx:property="itemConfirmationNo"&gt;
&lt;ruleml:var&gt;order&lt;/ruleml:var&gt;
&lt;owlx:DataValue owlx:datatype="xsd:String"&gt;null&lt;/owlx:DataValue&gt;
&lt;/swrlx:individualPropertyAtom&gt;
&lt;/ruleml:_head&gt;
&lt;/ruleml:imp&gt;
&lt;ruleml:imp&gt;
&lt;ruleml:_rlab ruleml:href="#outputRule3"/&gt;
&lt;owlx:Annotation&gt;
&lt;owlx:Documentation&gt;
If the order does not arrive the shipping location within the required date,
no charge will be made to the account.
&lt;/owlx:Documentation&gt;
&lt;/owlx:Annotation&gt;
&lt;ruleml:_body&gt;
&lt;swrlx:builtinAtom swrlx:builtin="swrlb:subtractDates"&gt;
&lt;ruleml:var&gt;arrivalDay&lt;/ruleml:var&gt;
&lt;ruleml:var&gt;deliveryDay&lt;/ruleml:var&gt;
&lt;ruleml:var&gt;today&lt;/ruleml:var&gt;
&lt;/swrlx:builtinAtom&gt;
&lt;swrlx:builtinAtom swrlx:builtin="swrlb:greaterThan"&gt;
&lt;ruleml:var&gt;arrivalDay&lt;/ruleml:var&gt;
&lt;ruleml:var&gt;deliveryDay&lt;/ruleml:var&gt;
&lt;/swrlx:builtinAtom&gt;
&lt;/ruleml:_body&gt;
&lt;ruleml:_head&gt;
&lt;swrlx:individualPropertyAtom swrlx:property="payment"&gt;
&lt;ruleml:var&gt;order&lt;/ruleml:var&gt;
&lt;owlx:DataValue owlx:datatype="xsd:boolean"&gt;false&lt;/owlx:DataValue&gt;
&lt;/swrlx:individualPropertyAtom&gt;
&lt;/ruleml:_head&gt;
&lt;/ruleml:imp&gt;
&lt;/rdf:RDF&gt;
</pre>
<p>Listing A-3: A SWRL XML represention of the rules. This example is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/rule/shipmentRule.swrlx">http://www.w3.org/2002/ws/sawsdl/spec/examples/rule/shipmentRule.swrlx</a>.
</p>
<pre>
wsmlVariant _"http://www.wsmo.org/wsml/wsml-syntax/wsml-full"
namespace { _"http://example.org#",
dc _"http://purl.org/dc/elements/1.1#",
onto _"http://example.org/ontology#",
wsml _"http://www.wsmo.org/wsml/#"
}
ontology _"http://www.example.org/ontologies/example"
axiom inputRule definedBy
?p[packageWeight hasValue ?w, address hasValue ?a] memberOf onto#package
and
wsml#lessEqual(?w,50)
and
?a[deliveryContinent hasValue ?c] memberOf onto#address
and
(wsml#equal(?c, "Europe") or wsml#equal(?c, "North America"))
and
?d[date hasValue ?dt] memberOf onto#delivery
and
?dt[deliveryHour hasValue ?h, day hasValue ?deliveryDay] memberOf onto#date
and
wsml#greaterEqual(?h,"07:00")
and
wsml#lessEqual(?h,"20:00")
and
?order[day hasValue ?orderDay] memberOf onto#order
and
numericGreaterThan(wsml#subtract\-dateTimes\-yielding\-day(?deliveryDay, ?orderDay),2).
</pre>
<p>Listing A-4: A WSML represention of the rule as described above. This example is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/rule/shipmentRule.wsml">http://www.w3.org/2002/ws/sawsdl/spec/examples/rule/shipmentRule.wsml</a>.
</p>
<pre>
; rule outputRule1
Implies (
Antecedent
(
order(I-variable(order))
swrlb:greaterThan(D-variable(packageWeight) 50)
)
Consequent(swrlb:equal(D-variable(packageWeight), 50))
; rule outputRule2
Implies (
Antecedent
(
order(I-variable(order))
hasItemConformation(I-variable(order) I-variable(itemConformationNo))
swrlb:lessThanOrEqual(D-variable(orderDay), 30)
)
Consequent(tracking(I-variable(itemConfirmationNo) false))
; rule outputRule3
Implies (
Antecedent
(
order(I-variable(order))
hasItemConformation(I-variable(order) I-variable(itemConformationNo))
hasAccount(I-variable(customer) I-variable(account)))
delivery(I-variable(package), null)
)
Consequent(charge(I-variable(account), nil))
</pre>
<p>Listing A-5: A SWRL abstract syntax representing the output rules. This example is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/rule/shipmentEffectRuleAbstract.swrlx">http://www.w3.org/2002/ws/sawsdl/spec/examples/rule/shipmentEffectRuleAbstract.swrlx</a>.
</p>
<pre>
; rule outputRule1
(order(?order)
^ swrlb:greaterThan(D-variable(packageWeight) 50))
=> swrlb:equal(D-variable(packageWeight), 50)
; rule outputRule2
(order(?order)
^ hasItemContirmation(?order, ?itemConfirmationNo)
^ swrlb:lessThanOrEqual(?orderDay, 30))
=> tracking(?itemConfirmationNo, false)
; rule outputRule3
(order(?order)
^hasItemConfirmation(?order, ?itemConfrimationNo)
^hasAccount(?customer, ?account)
^delivery(?package, null))
=> charge(?account, nil)
</pre>
<p>Listing A-6: A SWRL human-readable syntax representing the output rules as described above. This example is also available at: <a
href="http://www.w3.org/2002/ws/sawsdl/spec/examples/rule/shipmentEffectRuleHR.swrlx">http://www.w3.org/2002/ws/sawsdl/spec/examples/rule/shipmentEffectRuleHR.swrlx</a>.
</p>
<h2><a name="acknowledgements" id="acknowledgements">B. Acknowledgements</a></h2>
<p>This document is the work of the <a
href="http://www.w3.org/2002/ws/sawsdl/">W3C Semantic Annotations for Web
Service Description Language Working Group</a>.</p>
<p>Members of the Working Group are (at the time of writing, and in
alphabetical order): Rama Akkiraju (IBM Corporation), Carine Bournez (W3C), J.B.
Domingue (The Open University), Joel Farrell (IBM Corporation), Laura Ferrari (Telecom Italia SpA), Laurent Henocque
(ILOG, S.A.), Mathias Kleiner (ILOG, S.A.), Jacek Kopeck&yacute; (DERI Innsbruck
at the Leopold-Franzens-Universit&auml;t Innsbruck, Austria), Holger Lausen
(DERI Innsbruck at the Leopold-Franzens-Universit&auml;t Innsbruck, Austria), Peter Matthews (CA), Antony Miguel (Scapa Technologies Limited), John Miller
(University of Georgia Research Foundation, Inc (UGARF))
Carlos Pedrinaci (The Open University),
Eric Prud'hommeaux (W3C), Brahmananda Sapkota (DERI Galway at the National
University of Ireland, Galway, Ireland), Amit Sheth (Wright State University), Claudio Venezia (Telecom Italia SpA),
Tomas Vitvar (DERI Galway at the National University of Ireland, Galway, Ireland).</p>
</body>
</html>