The work consists of two main tasks. The first assesses your knowledge of RDF/S as a modelling language. The second allows you to explore the practical use of the SPARQL query language and how to process SPARQL queries in Jena. Jena is a Java framework for building Semantic Web and linked-data applications that provides a programmatic environment for RDF, RDFS, OWL and SPARQL.
Task 1
Consider the following RDF/S graph:
:Dare rdf:type :song .
:Doctor_Dee ref:type :opera .
:composer :composed :musical_content .
:song ref:type refs:Class .
:opera rdf:type rdfs:Class .
:Damon_Albarn rdf:type :musician ;
:composed :Dare ;
:composed :Doctor_Dee ;
rdf:type :songwriter .
[login to view URL] the content of this document in natural language;
[login to view URL] the graph representation of the document;
[login to view URL] whether the following two statements can be represented in RDF/S and motivate your answer:
[login to view URL] and songwriters are musicians;
[login to view URL] compose operas and songwriters compose songs
Task 2
Familiarise yourself with the Music ontology. This ontology represents information on music styles and musicians. The ontology is written in OWL expressed using its RDF/XML syntax.
Write a Java program that uses JENA to:
1. Generate the list of class and object property names in the Music Ontology. Do not use SPARQL for this task but rather navigate the ontology in Jena and print out all the class names;
2. Process the following SPARQL queries:
- Find the name of the artists who have been married to exactly two other artists;
- Write a query to find the name of Johnny Cash's wife who is an artist;
- Find the URI for the group "Foo Fighters";
The output from your program should print the results for each of the queries above. Make sure the result of the queries is formatted appropriately, do not just cut and paste the RDF/XML syntax!
In order to run the queries you can use the Talis SPARQL endpoint directly from Jena. Use ResultSetFormatter to pretty print your output