| Tutorial 4: Introducing RDFS & OWL |
|
Next: Querying Semantic Data Having introduced the advantages of modeling vocabulary and semantics in data models, let's introduce the actual technology used to attribute RDF data models with semantics. RDF data can be encoded with semantic metadata using two syntaxes: RDFS and OWL. After this tutorial, you should be able to:
You should have already understood the following tutorial (and pre-requisites) before you begin:
In the last lesson, we compared some of the more popular traditional forms of modeling data with the semantic model, and then introduced a situation where data sharing was enhanced and made significantly easier by using a semantic web approach. This example demonstrated a situation where two independent websites could mutually benefit by sharing data between them. In this lesson, we will explore the formal syntax used to annotate RDF data with semantic metadata. In the next lesson, we will then explore how this data is published and queried. RDF data is annotated with semantic metadata using two principal syntaxes: RDFS and OWL. Both RDFS and OWL are W3C specifications. 4.1 A Starting ExampleJust to show you what OWL looks like, here is a quick example: Do not concern yourself with the fine details for now, we will look at those later. Do notice however two new namespaces we've introduced in the header of our RDF document that we didn't have before: the RDFS (RDF Schema, http://www.w3.org/2000/01/rdf-schema#) and OWL (Web Ontology Language, http://www.w3.org/2002/07/owl#) namespaces on lines 03 and 04. Notice also that we are defining our ontology in RDF - yes, an ontology is also an RDF document. Let's break down a typical ontology document before building one up. For this example, we will look at a simple ontology that defines plant varieties. Point Of Interest Why OWL, not WOL? When the acronym for Web Ontology Language (OWL) was first proposed by the working group, OWL was adopted instead of WOL as it is easily remembered, and suggested wisdom. But confusingly enough, it is still an acronym that should strictly speaking be WOL. 4.2 OWL HeaderAlthough an ontology doesn't have to include a header, it is a good place to include information that will help others to understand what your ontology contains. As above, we've included a title and description for the ontology. But, this is also the place where we could include version information (to make sure you can appropriately track and communicate updates to your ontology) and where you can state that your ontology imports other ontologies. If your ontology does use elements from other ontologies, this will be absolutely necessary for tools or frameworks to know that your ontology is dependent on others. Point Of Interest See line 05 where we've defined the namespace for the dc: prefix, http://purl.org/dc/elements/1.1/. This references the Dublin Core Metadata Initiative namespace and tells machine readers that elements such as dc:title and dc:description are defined in this ontology. Remember - we mentioned this often used ontology at the end of the previous tutorial. And, because it's an OWL ontology, it is also defined in RDF. Just point your browser to its namespace URI to download it. 4.3 OWL Classes, Subclasses & IndividualsThe primary purpose of your ontology is to classify things in terms of semantics, or meaning. In OWL, this is achieved through the use of classes and subclasses, instances of which in OWL are called individuals. The individuals that are members of a given OWL class are called its class extension. A class in OWL is a classification of individuals into groups which share common characteristics. If an individual is a member of a class, it tells a machine reader that it falls under the semantic classification given by the OWL class. An ExampleHere is our example OWL ontology again, this time with some added classes and subclasses. We define three plant classes: the flowering plants class and shrubs class. which are both subclasses of the planttype class. The planttype class is the highest level class of all plant types. Point Of Interest You can investigate this RDF document further by passing it through W3C's RDF validator, which automatically tabulates the document's RDF subjects, predicates and objects for you. This can help significantly improve your understanding of RDF. Just click the 'copy to clipboard' button on the top right of the code excerpt and paste into the validator. Taxonomy - A Hierarchy Of TermsWhat we've done is define our semantic terms, or classes, in a hierarchy. In the semantic web world, this hierarchy of terms is called a taxonomy. Here's a graphical illustration the taxonomy hierarchy we've defined:
Note We haven't created another subclass of the flower class called magnolia. Rather, magnolia is an individual (instance) of class flower. Why is this? Magnolia is a member of the flower classification, but it is not a further flower subclassification. It makes sense from a semantic perspective for magnolia - and indeed other flowers - to be individuals (instances) of the class flower and not subclassifications. 4.4 OWL PropertiesIndividuals in OWL are related by properties. There are two types of property in OWL:
An ExampleLet's first add a data type property (one which links an instance to a literal value) and add the name of the species family the Magnolia is part of. Important Point At this point, if you are an object oriented programmer, your mind may well be thinking of programmatic object classes and their associated properties and comparing them to what we've just learned out OWL classes. Don't - they're not quite the same. Note from the example above. The 'family' property was defined independent of any class type, and was assigned to the instance of class flower (magnolia). Another instance of the same class may not have this property. So in OWL, note that the properties that instances have are not described in their class types, but their instances. In this case, you may use the same 'family' property for an instance of a completely different class. Finally, let's add an object property (one which links an instance to another instance). Let's say we're running a shop, and we want to link this plant (Magnolia) to another plant which we know as the shop owner is equally as popular. Let's add a property called "similarlyPopularTo": To illustrate, we have defined a new individual (instance) of the flowers class representing the Orchid with the URI http://www.linkeddatatools.com/plants#orchid. See if you can understand this from how we have defined the Magnolia instance, which is an individual of the same class. Now, just like in our first two tutorials, see if you can draw a graph showing the Orchid and Magnolia class instances and their predicates, according to the RDF graph defined above. Hint: You will need to show arrows for both the family and similarlyPopularTo properties. For the family property, they will point to the different family type literals for each plant. For the similarlyPopularTo property, the instances will point to each other. Important Point Note in the example above, we have a two way link between two instances of the same OWL class via the similarlyPopularTo object property (both Orchid and Magnolia are individuals of the same class). However note that object properties need not be two way - they may be one way. And, just as importantly, need not be between instances of the same OWL class. They may be completely different OWL classes. You have completed this lesson. You should now understand the following:
You should now be able to start the following tutorial:
|








Comments
5 minutes is relative, but the materials are absolutely good. :) Nice work.
http://owl.cs.manchester.ac.uk/tutorials/protegeowltutorial/resources/ProtegeOWLTutorialP4_v1_2.pdf
RSS feed for comments to this post.