Before you start
This tutorial is for developers who want to learn more about using semantic techniques and applications. Specifically, it teaches you how to use semantic Web techniques to pull data from an arbitrary Web service on-the-fly and display it in the form of a user's choosing.
This tutorial assumes that you are familiar with Java programming. You should also be familiar with the concepts of XML and Resource Description Framework (RDF) in general, and Web Ontology Language (OWL) in particular. If you need a refresher on these three topics, check out Parts 3 and 4 of this series.
It seems you can't turn around on the Web these days without running into a Web site that either offers access to its data through a Web-services-based API or uses data from another site obtained through a Web-services-based API. When you consider the advantage of using existing information in your own applications, that's probably not terribly surprising. It was also just a matter of time before someone started to combine the data from these disparate systems to create something entirely new. These applications, called mashups, are the latest rage on the Web, from community-based sites to specialized search sites to the ever-present mapping mashups.
They're (almost) all useful, but one thing that they have in common is that they were all developed for a specific set of services, and if one of those services changes, or if the preference for a specific service of a particular type changes, you'll have lots of work to do.
The purpose of this tutorial series is to create a mashup application so smart that users can literally add and remove services at will, and the system will know what to do with them. The series progresses as follows:
Part 1 introduced the concept of mashups, showing how they work and building a simple version of one. Serious performance problems involved in making potentially dozens of Web calls were also discovered.
Part 2 solved some of that problem by using the new pureXML™ capabilities of IBM® DB2® to build an XML cache, which saves the the results of previous requests and also enables you to retrieve specific information.
Ultimately, you will need to use ontologies, or vocabularies that define concepts and their relationships, so in Part 3 you began that process by learning about RDF and RDFs, two key ingredients in the Web Ontology Language (OWL), discussed in Part 4. Part 5 takes the ontologies you created in Part 4 and used them to enable users to change out information sources.
Now, in this tutorial, things get really fun. At this point, you have a working application and the framework in place so that the system can use semantic reasoning to understand the services at its disposal. In this tutorial, you give the user control, enabling him or her to choose from services in the ontology and to pick and choose the data that is used for a custom mashup.
This tutorial, Part 6 in a series, explains how to add semantic capabilities to an existing Web services mashup application. In Part 5 (see Resources), you took an existing ontology and implemented it to enable the user to easily change services. In this tutorial, you'll use semantic techniques to give the user complete control over the information displayed and its presentation.
In this tutorial, you will learn to:
- Invoke a reasoner on semantic data
- Programmatically determine subclasses of a class
- Programmatically determine the available properties of a class
- Programmatically determine specific property values
- Build an application that pulls information based on semantics rather than XPath expressions
In this tutorial, you will take the mashup you built in Parts 1 through 5 and give the user the ultimate control. The user will be able to choose a type of service, a specific Web service to use, the data to pull from the Web service, and the presentation of that data. In the end, you can add new functionality and new services to the application by simply adding them to the ontology rather than touching the application at all.
To follow along with the code in this tutorial, you will need to have the following software installed and tested.
- IBM® DB2® 9 (formerly known as "Viper"): This relational database also includes significant XML capabilities, which you'll need for this tutorial. You can download a trial version of DB2 9: DB2 Enterprise 9 or DB2 Express-C 9, a no-charge version of DB2 Express 9 data server.
- Apache Tomcat or other servlet engine: This tutorial assumes that you will build Web applications using servlets, so you'll need a servlet engine such as Apache Tomcat. If you choose to build the application using another environment, just make sure you have the appropriate software on hand. Download apache-tomcat-5.5.17.zip and install into a directory with no spaces in the directory name.
- Java: Apache Tomcat 5.5, with which this tutorial is built, requires Java 1.5 or higher. Download the J2SE SDK.
- To make things easier, you can use an IDE such as Eclipse or IBM Rational™ Web Developer for your development. You can download Eclipse at Eclipse.org, download a trial version of Rational Web Developer, or use your favorite development environment. You won't be doing anything fancy as far as compilation and deployment are concerned.




