Part I
Introducing Semantic Web Programming
The goal of this section is to quickly introduce you to Semantic Web programming. This section establishes a launchpad from which you can begin your exploration.
Chapter 1 defines the Semantic Web and the components and concepts critical to programming with it. It identifies, from the programmer's perspective, the characteristics and advantages of the Semantic Web that can be leveraged to provide innovative solutions to common problems. The chapter discusses the many roadblocks, myths, and hype that emerge with any new area of technology like the Semantic Web.
This leads to a brief history of the Semantic Web, which provides a useful perspective on its solid foundations. The Semantic Web is not a flash in the pan but rather an evolutionary step in our ability to share and use information. Finally, the chapter ends by presenting a series of example Semantic Web applications. These examples introduce some of the terms, structures, and programming considerations that you will see throughout the rest of the book. After Chapter 1, you will be ready to jump right into Semantic Web programming.
Chapter 2 is your opportunity to say a solid āHelloā to the Semantic Web. The chapter presents a tour of the canonical āHello Worldā example application from the perspective of the Semantic Web. It demonstrates how a Semantic Web knowledge model can integrate with an application and be used to separate domain-specific business logic from the program itself. The tour extends a common example-saying hello to your friends. These āHellosā build through code examples that touch on the main topics of the book. After quickly establishing your development environment, the tour takes you through setting up an ontology, adding data from multiple sources, aligning different data sources, reasoning, rules, querying, and finally outputting results in various formats. It's a whirlwind tour that gives you a taste of what is to come.
Together, the two chapters in this section provide a quick taste of the book and prepare you to move into the depth of the chapters ahead.
Chapter 1
Preparing to Program a Semantic Web of Data
āThe Semantic Web is not a separate Web but an extension of the current one, in which information is given well-defined meaning, better enabling computers and people to work in cooperation.ā
āTim Berners-Lee
Welcome to Semantic Web programmingāa powerful way to access, use, and share information. Our approach gets you programming quickly through hands-on, practical examples. We maintain a programmer's perspective, not a philosopher's perspective, throughout the book. We focus on applying the Semantic Web to real-world solutions rather than long justifications and explanations.
First, we need to establish a Semantic Web programming foundation. This foundation orients you to this new technology with its jargon and its attitude. The foundation also provides a justification for your learning investment, an investment we do not take lightly.
Our approach and examples come from years of building Semantic Web applications. Our applications employ the Semantic Web to make useable sense out of large, distributed information found throughout the World Wide Web.
The objectives of this chapter are to:
- Form a useful, pragmatic definition of the Semantic Web
- Identify the major components of a Semantic Web application and describe how they relate to one another
- Outline how the Semantic Web impacts programming applications
- Detail the roadblocks, myths, and hype regarding the often misunderstood and misused term Semantic Web
- Understand the origin and foundation of the Semantic Web
- Gain exposure to different, real-world solutions that employ the Semantic Web
Semantic Web programming introduces many new terms and approaches that are used throughout the book. This chapter offers a preliminary definition, one on which each chapter expands.
The concept map in Figure 1.1 outlines the chapter. Two main legs establish the key areas: the Semantic Web and Programming in the Semantic Web.
We start with the definition leading to the Semantic Web's components, features, and origins. Then we examine its programming implications.
Defining the Semantic Web
A definition for the Semantic Web begins with defining semantic. Semantic simply means meaning. Meaning enables a more effective use of the underlying data. Meaning is often absent from most information sources, requiring users or complex programming instructions to supply it. For example, web pages are filled with information and associated tags. Most of the tags represent formatting instructions, such as <H1> to indicate a major heading. Semantically, we know that words surrounded by <H1> tags are more important to the reader than other text because of the meaning of H1. Some web pages add basic semantics for search engines using the <META> tag; however, they are merely isolated keywords and lack linkages to provide a more meaningful context. These semantics are weak and limit searches to exact matches. Similarly, databases contain data and limited semantic hints, if well-named tables and columns surround the data.
Semantics give a keyword symbol useful meaning through the establishment of relationships. For example, a standalone keyword such as building exists on a web page devoted to ontologies. The <META> tag surrounds the building keyword to indicate its importance. However, does building mean constructing an ontology or ontologies that focus on constructing buildings? The awkwardness of the previous sentence points out the difficulty in simply expressing semantics in English. Semantics are left for the human reader to interpret. However, if the keyword relates to other keywords in defined relationships, a web of data or context forms that reveals semantics. So building relates to various other keywords such as architect, building plans, construction site, and so onāthe relationships expose semantics. If a formal standard captures the arrangement of terms, the terms adhere to specified grammar rules. It is even better if the terms themselves form an adopted standard or language. The two standards together, grammar and language, help incorporate meaning, or semantics. As this contextual web of grammar rules and language terms expands through relationships, the semantics are further enriched.
The Semantic Web is simply a web of data described and linked in ways to establish context or semantics that adhere to defined grammar and language constructs.
Programmatically, your application can add semantics through programming instructions; however, there is no formal standard for such programmed semantics. In addition, aggregation, sharing, and validation are usually difficult or not possible. The semantics are lost in a maze of if/else programming statements, database lookups, and many other programming techniques. This makes it difficult to take advantage of this rich information or even to recognize it all. The nonstandard, dispersed way of programmatic semantic capture places restrictions on it and makes it unnecessarily complex, essentially obfuscated. Standing alone, the meaning of various terms such as building is simply lost.
The Semantic Web addresses semantics through standardized connections to related information. This includes labeling data unique and addressable. Thus, your program can easily tell if this building is the same as another building reference. Each unique data element then connects to a larger context, or web. The web offers potential pathways to its definition, relationships to a conceptual hierarchy, relationships to associated information, and relationships to specific instances of building. The flexibility of a web form enables connections to all the necessary information, including logic rules. The pathways and terms form a domain vocabulary or ontology. Semantic Web applications typically use many ontologies, each chosen for a required information area. The applications can choose to standardize on specific ontologies and translate to ones employed by other applications. Advanced Semantic Web applications could automatically align vocabularies using advanced information techniques that logically employ the many paths within the Semantic Web. Thus, the rich relationships and the many relationship types each contribute to establish semanticsāthe Semantic Web.
Figure 1.2 illustrates the difference between a stranded keyword, plane, and a Semantic Web of data related to the keyword, plane. The figure uses a graph perspective for easier visualization of the relationships.
Shortly we will outline all the major components of the Semantic Web. For now, the fundamental building block of the Semantic Web is a statement. This might sound too generic and basic, but this simplicity creates many possibilities. Throughout the book, we explore all types of statements contained in the Semantic Web, statements that describe concepts, logic, restrictions, and individuals. The statements share the same standards to enable sharing and integration, which take advantage of the semantics.
The Sem...