EXERCISES INF3580 SPRING 2010 WEEK 2

A bird.

A bird.

This document contains exercises made for INF3580. Please send any comments, errors, bug or improvement reports to this exercise set to martige@ifi.uio.no. Feedback is most welcome! Alphabetically thanks to Audun Stolpe, Espen H. Lian, Martin Giese and Rune Dahl for feedback.

The main curriculum for INF3580 spring 2010 is Semantic Web Programming by John Hebeler et al., Wiley Publishing, 2009. They have a website with additional articles and all source code used in the book at http://semwebprogramming.org/. Auxiliary curriculum is the book Foundations of Semantic Web Technologies by Hitzler, Krützsch, Rudolph, CRC Press 2009.

Keep all the work you do for these exercises in a safe place. Setting up a version control system like cvs, svn or git for the work you do is smart. You can create a svn repository on IfI's svn server, see their help section for more information. There is also a walk-through from old INF3120 on how to set up a svn repository and connect it to Eclipse, but news is that you'll need the plug-in subclipse to make it work. Please contact me if you have any smart tips to share.

1 RDF

Read

  • Semantic Web Programming: chapter 3.
  • Foundations of Semantic Web Technologies: chapter 2.

1.1 FOAF - Friend of a friend

The FOAF project is one of the most well-known projects using RDF and a project where RDF is the core technology. Quoting foaf-project.org:

FOAF is about your place in the Web, and the Web's place in our world. FOAF is a simple technology that makes it easier to share and use information about people and their activities (eg. photos, calendars, weblogs), to transfer information between Web sites, and to automatically extend, merge and re-use it online.

See also the following webpages for more information.

1.1.1 Exercise

Go to the FOAF-a-Matic and create your own FOAF file. If you are hesitant publishing information about yourself online, then make something up.

Befriend yourself with at least Martin Giese and Martin G. Skjæveland, who have the following FOAF files, respectively:

1.1.2 Exercise

Publish your FOAF file to your homepage. If you don't have a homepage, you can create one using your UiO account. Follow the instructions on http://folk.uio.no/.

1.1.3 Exercise

In the FOAF file you have generated you are identified as me, e.g., the identifier for Martin G. Skjæveland is

http://folk.uio.no/martige/foaf.rdf#me

Explain why #me is used? What is the difference from

http://folk.uio.no/martige/foaf.rdf

and

http://folk.uio.no/martige/foaf.rdf#me ?

See Best Practice Recipes for Publishing RDF Vocabularies and Cool URIs for the Semantic Web for help.

1.1.4 Exercise

Set up a redirection service on your UiO homepage so that

http://folk.uio.no/martige/id/martige

,or a similar URL, 303-redirects to your homepage or your FOAF file—assuming your username is martige.

For help see the articles referred to in the above exercise and USIT's Videresending med .htaccess.

1.1.5 Exercise

Open your FOAF file with an RDF browser, e.g., SIOC RDF Browser or FOAFer, and find the interests of Aaron Swartz, who Tim Berners-Lee knows, who again Martin G. Skjæveland knows.

1.1.6 Exercise

Open your FOAF file in your favourite plain text editor. Add IfI as Organisation with the following values:

  • rdf:ID = ifi
  • name in both Norwegian and English
  • homepage
  • logo, use e.g., http://www.ifi.uio.no/gfx-bin/logo.jpg
  • the coordinates where IfI is located, see http://www.w3.org/2003/01/geo/
  • add at least yourself, Martin Giese and Martin G. Skjæveland as members of the organisation.

Use the FOAF ontology to find the correct resource names for adding this information. You can write RDF using the RDF serialisation you prefer, but you will need to publish it in RDF/XML as that currently is the only standardised RDF serialisation language. There are applications available online which convert between RDF serialisations, one is found behind the next link. Make sure that your FOAF file is written in valid RDF syntax. Use an RDF validator, e.g., RDF Validator and Converter or W3C's RDF validator (accepts only RDF/XML), for this purpose.

1.1.7 Exercise

Add more information about yourself or your surroundings, e.g., a picture of yourself, where you live—maybe using coordinates, places you have been to, your interests, your chat identities, and so on.

See the FOAF ontology and what FOAFer supports, e.g., these relationships, for the vocabulary you can use in your FOAF file.

1.1.8 Exercise

Open your FOAF file in Protégé and see how things look when Protégé interprets the RDF file as OWL. Try to find all the information you have written in your FOAF file. Pay attention to where you find which information, e.g., which information is located under the classes, properties and individuals tabs, respectively.

1.2 The Simpsons in RDF

This set of exercises is the start of a theme that will follow us for many of the exercises, The Simpsons.

The aim of these exercises is to capture family relations of the Simpson family in RDF. To give you an overview of how parts the Simpson family look like1 check the family tree of them on www.learnenglish.be.

When solving the exercises and modelling family relationships use only the information given to you in the exercise text and do not use information from the family tree or other sources. We do this to be able to make some of the exercises a bit challenging.

You may use the resources

  • fam:Family
  • fam:Person

and the properties

  • rdf:type (primitive rdf property)
  • fam:hasFamilyMember (relating a family to its members)
  • fam:hasBrother (relating a person to its brother)
  • fam:hasSister
  • fam:hasParent
  • fam:hasMother
  • fam:hasFather
  • fam:hasSpouse
  • fam:hasName
  • fam:hasAge

where fam: is prefix for the namespace

http://www.ifi.uio.no/INF3580/v10/ex/family.n3#

in the exercises.

Use the RDF serialisation you prefer, e.g., RDF/XML, Turtle, N3 or N-Triples, but make sure your work is syntactically correct RDF.

In the exercises below, write RDF which captures the given statement as completely as possible. Make your own namespace for your RDF data and use sensible identifiers. For each of the persons you introduce in the exercises add the full name of the person using the fam:hasName property and add their age using the fam:hasAge property. The table below lists the name and age of some of the characters in the Simpsons.

PersonAge
Homer Simpson36
Marge Simpson34
Lisa Simpson8
Bart Simpson10
Maggie Simpson1
Abraham Simpson78
Selma Bouvier41
Patty Bouvier41
Mona Simpson
Clancy Bouvier
Jackeline Bouvier
Herb Powell
Ling Bouvier

1.2.1 Exercise

First, create an RDF file. This file shall contain all the RDF statements you produce in this week's exercises.

Add the standard rdf namespace and the fam namespace.

1.2.2 Exercise

Statement: "The Simpsons is a family, where Marge is the mother and Homer is the father. Marge and Homer have a son, Bart, and two daughters, Lisa and Maggie."

1.2.2.1 Tip

Example statement: "Selma is the parent of Ling."

From this statement we know that both Selma and Ling are Persons, and that Ling has Selma as parent. Remember also to add their names and ages. This is expressed in RDF, using Turtle, as

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix fam: <http://www.ifi.uio.no/INF3580/v10/ex/family.n3#> .
@prefix : <http://my.own/namespace#> .

:Ling rdf:type fam:Person ;
      fam:hasParent :Selma .

:Selma rdf:type fam:Person ;

1.2.3 Exercise

Statement: "Maggie has the grandfathers Abraham and Clancy, and the grandmothers Mona and Jackeline."

1.2.3.1 Tip

You do not know which of the grandparents is parent to which of Maggie's parents (since you only know what these exercises tell you). To express the relationship between Maggie and her grandparents, you'll need to use blank nodes.

1.2.4 Exercise

Statement: "Lisa has the aunts Patty and Selma and the uncle Herb. Patty and Selma are sisters."

1.2.5 Exercise

Statement: "Ling is a cousin of Bart on Bart's mother's side."

1.2.5.1 Tip

This statement means that Ling has a parent which has a sister which is Bart's mother. You know from the previous exercises that Marge is Bart's mother.

1.2.6 Exercise

Statement: "Homer has a mother-in-law Jackeline."

Footnotes:

1 —and learn English the Belgium way!

Author: Martin G. Skjæveland <martige@ifi.uio.no>

Date: 2010-03-12 15:36:11 CET

HTML generated by org-mode 6.34trans in emacs 23