java代写

The first practical assignment 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 RDFRDFSOWL and SPARQL.

The solution to both tasks should be submitted electronically. In preparing the solution files and naming them please follow carefully the submission instructions given below. The assignment deadline is March 15th, 2018 at 16.00.

Part 1 (40 marks)

Consider the folllowing RDF graph G:

@prefix : < myExample.org/>.
@prefix w3c:< www.w3.org/>.
@prefix SW: <http://data.semanticweb.org/conference/iswcaswc/2007/

(1)  SW:paper/147        
rdf:type    :ConferenceArticle .
(2)  SW:paper/147        :hasAuthors _:m .
(3)  _:m 
                rdf:type    rdf:Seq .
(4)  _:m 
                rdf:_1      “Guilin Qi” .
(5)  _:m                 rdf:_2      “Anthony Hunter” .
(6)  w3c:TR/rdf11-mt     rdf:type    :W3CStandard .
(7)  w3c:TR/rdf11-mt     :writtenBy  _:n .
(8)  _:n                 rdf:type    rdf:Seq .
(9)  _:n                 rdf:_1      “Patrick Heyes” .
(10)  _:n                 rdf:_2      “Peter Patel-Schneider” .
(11) :ConferenceArticle  rdfs:subClassOf :Publication .
(12) :W3CStandard        rdfs:subClassOf :Publication .
(13) :writtenBy          rdfs:subPropertyOf :hasAuthors .

 

Complete each of the following tasks. Submit the solution as a PDF file.

  1. Can you represent in RDFS the statement “All conference articles are publications that are not W3C standards”? If so, provide the Turtle representation of the statement otherwise motivate your answer.
  2. Given G, verify if the following set of triples, S, is simple-entailedby G. Explain your answer by showing how S is contained in the new graph obtained applying simple entailment rules.
    _:m1 :has Authors _:l1 . _:m1 rdf:type :Publication .
  3. Given G, verify if the following set of triples, S, is RDFS-entailedby G. Explain your answer by showing how S is contained in the new graph obtained applying RDFS-entailment rules.
    _:m1 :has Authors _:n ._:m1 rdf:type :Publication .
  4. Write a SPARQL query that verifies whether a conference article has one or more authors, without listing them

Note:

rdf:_1 and rdf:_2 to describe a resource as being one of these the different types of containers allowed in RDF. The RDF primer document specifies that “The resource is given an rdf:type property whose value is one of the predefined resources rdf:Bagrdf:Seq, or rdf:Alt (whichever is appropriate). The container resource (which may either be a blank node or a resource with a URIref) denotes the group as a whole. The members of the container can be described by defining a container membership property for each member with the container resource as its subject and the member as its object. These container membership properties have names of the form rdf:_n , where n is a decimal integer greater than zero, with no leading zeros, e.g., rdf:_1rdf:_2rdf:_3, and so on, and are used specifically for describing the members of containers. Container resources may also have other properties that describe the container, in addition to the container membership properties and the rdf:type property.”

Part 2 (60 marks)

The second task consists in writing a Java programme that uses Jena to edit an RDF file and answers queries expressed in SPARQL.

Your programme should consists of one class only, named CreateAndQuery.java, that reads in the RDF dataset of the Nobel laureates, generates a new graph with some of the triples, prints out a list of the Nobel laureates (one per line) and answers some SPARQL queries.

The RDF file with the dump of the dataset (in N-Triple format) is modelled according to the ontology (schema) specified in the Nobel Prize Linked Data Vocabulary and is in attachment.

The program should carry out the following tasks, in order:

  1. Create a new RDF graph containing only some of the information concerning Nobel laureates, in particular their name, nationality, the discipline for which they won the award, the year of the award and their gender. The programme should print each of the triples one entry per line. The output should be of the form: name, gender, nationality, discipline, year.Save this graph in the file rdf that should be submitted with the other documents. Use Turtle syntax for the new file.
  2. Formulate the following SPARQL queries and execute them against the original RDF file. Pretty print the results as in the Jena SPARQL tutorial:

    Query 1:Find all the Nobel Laureates from the UK;

    Query 2:
     Find all the Nobel Laureates who are female and were born after 1949;

    Query 3: List all the Nobel Laureates ordering them by discipline for which they were awarded the prize. List the names in alphabetical order;

    Query 4: Find all the Nobel Laureates born in the US who share the award with someone else;