Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Let Semantics Bring Sophistication to Your Applications : Page 2

Leverage semantic technology and the W3C's Web Ontology Language standard to spice up a query-based application.


advertisement
About Ontologies
Fundamental to an understanding of semantic technology is the representation of knowledge. For example, to create a sophisticated sommelier, you would need to provide it with an understanding of the types of wines, their characteristics, and relationships. Within the field of semantics, this representation often takes the form of an ontology. An ontology is a set of concepts and relationships that can be used by people and computers to reason about a domain.

There are many standards for representing ontologies, but this article will focus on the popular Web Ontology Language (OWL). OWL is a W3C standard that extends other W3C standards such as the Resource Description Framework (RDF) and RDF-Schema (RDFS) by adding to their vocabulary and by specifying additional semantics.

Ontologies are composed of statements about a domain. These statements relate individuals, properties, and classes and are sometimes referred to as triples. Statements assert something about the domain and take the form of "<Subject> < Predicate> <Object>". I could make a statement about wine such as "FrenchWine is-a Wine." In this statement, both Wine and FrenchWine are classes that are related through subclassing, as indicated by the "is-a" predicate.



Classes, Individuals, and Properties
Ontologies in OWL are composed of classes, individuals, and properties and are represented (like RDF) in XML. OWL defines the serialization of these components and prescribes semantic meaning for special types of relationships that can be used for reasoning. But, more on reasoning later. First, you should explore classes, individuals, and properties in the context of your wine domain.

Each OWL ontology will have a base URI that uniquely identifies the ontology. This base URI is described in the header of the OWL document. As an example, the base URI for the wine ontology is http://www.w3.org/TR/2003/CR-owl-guide-20030818/wine. All resources (including classes, individuals, and properties) declared in an OWL document are identified by a fully-qualified URI. For example, there is a resource defined in this ontology named http://www.w3.org/TR/2003/CR-owl-guide-20030818/wine#FrenchWine. As a convenience, you can omit the base URI in references within the document and just prefix those references with the pound symbol (#)—for example, #FrenchWine.

Classes are sets that contain like individuals and are related to each other through subclassing (they are also referred to as taxonomies). All classes in OWL implicitly subclass the owl:Thing class and are declared using the owl:class construct. You could represent your previous statement about French wines in OWL as follows:

<owl:class rdf:ID="Wine" /> <owl:class rdf:ID="FrenchWine" > <rdfs:subClassOf rdf:resource="#Wine" /> </owl:class>

This code states that there are two classes (Wine and FrenchWine), that all instances of FrenchWine are instances of Wine, and that all instances of Wine are instances of Thing. Notice that the subclassing of Thing was implicit.

Individuals are the instances of things in a domain. For example, there is a wine named Chateau Cheval Blanc St. Emilion (which is a St. Emilion-styled wine from the Chateau Cheval Blanc winery). This instance is an individual wine, one that you could go and buy. This instance could be declared in OWL notation as:

<Wine rdf:ID="#ChateauChevalBlancStEmilion" />

This declaration can be read as "there exists an instance of wine named ChateauChevalBlancStEmilion."

Properties relate two instances in the form of a statement. For example, I could state: "ChateauChevalBlancStEmilion hasColor Red" and "ChateauChevalBlancStEmilion hasFlavor Strong." These statements can be combined to form a graph representing your current understanding of the wine domain as shown in Figure 2.

The properties hasColor and hasFlavor can be declared in OWL as:

<owl:ObjectProperty rdf:ID="hasColor" /> <owl:ObjectProperty rdf:ID="hasFlavor" />

And, the ChateauChevalBlancStEmilion instance can have these properties defined for it as:

<Wine rdf:ID="#ChateauChevalBlancStEmilion" > <hasColor rdf:resource="#Red" /> <hasFlavor rdf:resource="#Strong" /> </Wine>

In this example, Red and Strong are individuals declared elsewhere in this document and are related to the ChateauChevalBlancStEmilion instance through the hasColor and hasFlavor properties, respectively.

It is important to note that properties relate individuals, not classes. However, individuals can be grouped into classes on the basis of their properties through class restrictions. For example, you could define a class named RedWine, which represents the set of all individuals having the property hasColor and the value Red. Figure 3 illustrates this new class and three instances, all of which are related to RedWine through the hasColor property.

Figure 2. Properties Example: This diagram shows two statements that together declare that ChateauChevalBlancStEmilion is red and has a strong flavor.Figure 3. A Basic Class: The hasColor property relates these three instances to the RedWine class.

In OWL the RedWine class would be expressed as:

<owl:Class rdf:ID="RedWine"> <rdfs:subClassOf rdf:resource="Wine" /> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#hasColor" /> <owl:hasValue rdf:resource="#Red" /> </owl:Restriction> </rdfs:subClassOf> </owl:Class>

Author's Note: The restriction is implemented through subclassing. The declaration in the previous code example could be read as "The RedWine class is a subclass of wine and a subclass of the anonymous set of all individuals having the color red."

The foregoing has been only a basic introduction to ontologies and OWL, but hopefully it has at least given you an initial understanding of how ontologies are structured and represented through OWL. For this article, you will consume a prebuilt ontology for the sommelier application, so you don't need to be an OWL expert and probably know enough to continue. If you are interested in learning more about ontologies and OWL consult the related resources sidebar for links to the relevant specifications, tutorials, and helpful tools.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap