MASWS Assignment 1

Due Date

Please have your results completed by 16:00, Monday 8th February.

Preamble

In this assignment, you will do the following:

  • write a FOAF file describing yourself;
  • write a SPARQL query involving more than one FOAF file;
  • use the results of your FOAF query to query DBPedia;
  • use the results of your DBPedia query to create a Semantic Web mashup.

Getting Started

  1. In your homepages area, create a masws directory,

    i.e. /public/homepages/<yourmatricno>/web/masws.

  2. Register for an OS OpenSpace API account at http://openspace.ordnancesurvey.co.uk/openspace/. This will give you a user-name and an API key that you will need to query the site. Use http://homepages/<yourmatricno> as the document root for the registration.

Task 1: Writing a FOAF file

http://xmlns.com/foaf/spec/ http://www.schemaweb.info/ http://composing-the-semantic-web.blogspot.com/2008/02/beyond-social-networking-with-foaf-and.html

Your first task is to write a FOAF file to describe yourself. If you wish, you can generate a basic file using the FOAF-a-matic tool. The FOAF data can be written using either Turtle or XML/RDF. Once created, place your FOAF file in the masws directory of your homepage.

Any subject of an RDF triple needs to be identified by a unique URI, and in your FOAF data, you will be the subject of FOAF triples. But rather than having to invent some obscure URI for yourself, you can just use a blank node instead.

But this is not quite sufficient. We still need a way to identify the blank node as you. To do this, we shall use your mailbox. So if two nodes in a graph are described as having the same FOAF mailbox, we will say those nodes denote the same person.

To protect yourself from spammers, you will not specify your mailbox directly, but instead, will use its SHA-1 hash. The SHA-1 hashing algorithm will obfuscate your email address, creating a unique string that cannot be disassembled. (See http://blogs.sun.com/bblfish/entry/my_bloomin_friends for some discussion of this.)

So long as you select the checkbox “Protect my email addresses from spammers”, the FOAF-a-matic tool will automatically compute the SHA-1 hash. If you do not use this tool, you will need to obtain the hash yourself. To generate it, use the utility sha1sum at the terminal as follows ('%' represents the terminal prompt):

% echo -n 'mailto:<your email address>' | sha1sum

On Mac OSX, you will need to do the following instead:

% echo -n 'mailto:<your email address>' | openssl sha1

Make sure you include data in your FOAF file for the people you foaf:know, and make sure they are described as instances of foaf:Person. Again, since we are not relying on URIs, you will need to identify these people by the SHA-1 hashes of their mailboxes, so make sure you add FOAF triples for these. You can find a sample FOAF file `here ...`__. In addition, add a few triples (at least three) which specify musicians that you like. Use the predicate [what is the right predicate???]. Use DBPedia URIs for the musicians,

You can use the RDF Validator to check the syntax of your document, and to see a table of all the RDF triples.

[xx marks]

Task 2. Querying two FOAF Files

We have created a ‘fake friend’ FOAF file for you. Your fake friend’s identifying name is the same as your matriculation number, with the string _f appended. So, for example, if your matriculation number was 0123456, then your fake friend’s ID would be 0123456_f, and you can find their FOAF file at the following URL: http://demos.inf.ed.ac.uk:8836/MASWS/ff/0123456_f.rdf (replacing 0123456 with your own number). According to this file, your fake friend likes a certain musician.

Know do the following:

  1. Add to your own file a statement that says that you know your fake friend.
  2. Write a SPARQL query to find all the musicians that you like or someone that you know likes.

In case you need to refresh your memory, here is some documentation about SPARQL.

[xx marks]

Task 3. Geolocating the Birthplace of Your Fake Friend’s Musician

Your next task is to query DBPedia about your fake friend’s favourite musician. Construct a SPARQL query that will find the musician’s birthplace and then find the latitude and longitude of the birthplace. You should be able to do this with a single query.

[xx marks]

Task 4. Create a Mashup

Starting from the example of this skeleton file map.txt, use the latitude and longitude recovered from the preceding task to create a map. You will also need to supply your OpenSpace API. For full marks, you should create the required HTML page programmatically — it is up to you exactly what technique you use to do this. (In order to get the page to render in a browser, save it with the suffix .html, not .txt.) Put the resulting page into your homepages directory and check that it works as you expected.

[xx marks]

Task 5. Extend the Mashup

Browse the DBPedia RDF data about your fake friend’s favourite musician, and look for some additional interesting information about him or her. Construct a SPARQL query to recover that information, and incorporate the results into the information panel, along the lines of the example shown here. Credit will be given for creative or unusual solutions.

[xx marks]

Task 6: Write a Report

Write a report in which you say how you carried out the task. Include all your SPARQL queries in the text, together with the output they produced. Comment on any issues or difficulties which arose, and explain how you addressed them.

Finally, comment on how well you think the Semantic Web technologies you used worked for this task, and whether you can think of any improvements.

You must submit this report in PDF format. Reports in other formats (e.g., MS Word) will not be marked.

[xx marks]

Marking Scheme

Tasks 1 – 6 are marked out of 100 points, and will be scaled so that the total coursework for this course is worth 30% overall.

Questions

If you have any queries about Tasks 1 – 6 of this assignment, please contact Xi Bai by email: xi.bai at ed.ac.uk.

Submission

  1. Please create an archive (zip or gzipped/bzipped tar) containing:
  • your FOAF file
  • your SPARQL queries
  • any glue code
  • your report (in PDF !!!)
  1. Submit the archive using the DICE submit command, as follows:

    UG4:

    submit ai4 masws-4 1 <your-archive-file>

    MSc:

    submit msc masws-5 1 <your-archive-file>

  2. Submission deadline: 16:00, Monday 8th February.