index.html 126 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515
<?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>