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.
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 .
[url removed, login to view] the content of this document in natural language;
[url removed, login to view] the graph representation of the document;
[url removed, login to view] whether the following two statements can be represented in RDF/S and motivate your answer:
[url removed, login to view] and songwriters are musicians;
[url removed, login to view] compose operas and songwriters compose songs
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