We use cookies to give you a better experience, if that’s ok you can close this message and carry on browsing. For more info read our cookies policy.
1.10

# Try out RDF!

Here you have a chance to write some RDF and check your understanding of how to express statements in this way. It is important to try writing and editing some RDF to ensure you can apply the concepts that we’ve covered so far to a slightly different example.

Study the following RDF statements, expressed in the Turtle syntax, then attempt the exercise that follows. We don’t expect you to do this off the top of your head. Revisit the example RDF snippets that we’ve seen in the course so far, and then apply the syntax and structure rules that they use to this example.

@base <http://www.euclid-project.eu/examples/> .
@prefix vocab: <http://www.euclid-project.eu/ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .

vocab:ResearchProject rdfs:subClassOf foaf:Group .

vocab:consortiumMember rdfs:subPropertyOf foaf:member .

<barry>    a foaf:Person ;
foaf:givenName "Barry" ;
foaf:familyName "Norton" .

<euclid> rdfs:label "The Euclid Project"@en, "Das Projekt Euclid"@de ;
vocab:consortiumMember <barry> .



## Exercise

We have developed an interactive exercise for you to try out RDF and check out your understanding. We suggest that you open this exercise in a new browser window or tab so that you can view it alongside the instructions.

In response to comments from learners, we have created a video screencast walkthrough of how to approach this activity. It is also strongly recommended that you revisit Step 1.8 and Step 1.9 and you read and / or print out the attached Exercise 1 worksheet & FAQs before you have a go at answering the following questions:

1. Re-express the statements in NTriples (i.e. remove all prefixes and abbreviations to give full triples in absolute URIs - you should look at the example in Step 1.8 for guidance on how to approach this).
2. Add a resource representing yourself, attaching your name using the FOAF properties. (Look at how it has been done for Barry.)
3. Execute the following SPARQL query and consider why the class “Agent” has members, even though none are explicitly asserted in the data:

 PREFIX ex1: <http://www.euclid-project.eu/examples/module1#>
PREFIX vocab: <http://www.euclid-project.eu/ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?agent WHERE {?agent a foaf:Agent}

4. Add a property to “consortiumMember” to assert that all subjects should be research projects (members of the “ResearchProject” class).
5. Adapt the query from (3) to ensure that “euclid” is now a research project
6. Create a new property to relate training participants to research projects and use it to relate yourself with “euclid”.

## Instructions

For question 3 you should use interactive exercise link to execute the query and examine the results.

The interactive exercise will let you enter RDF as either Turtle or NTriples. You can then run SPARQL queries on this input and receive the results, which means you can try out the RDF concepts that we’ve covered in the course.

When you load the link for the exercise, the RDF statements (in Turtle) will be displayed automatically in the “RDF input” box. To execute a SPARQL query (for Question 3), you need to use the lower half of the form.

Note: This exercise will work on mobile devices, but typing the code will be much less prone to errors using a keyboard, and a larger screen will make it easier to manage your code. We recommend using a PC or laptop if possible.

You may wish to post your answers in the comments to discuss them with your fellow learners particularly if you are stuck and would like to seek help from fellow learners. We have provided some model answers which are available in PDF format from the bottom of this page but your learning will be enhanced if you don’t look at them until you have at least attempted the questions and sought help.

## Get a taste of this course

Find out what this course is like by previewing some of the course steps before you join:

• ##### Welcome to the course
video

Watch Dr Elena Simperl & Dr Barry Norton explain how this short course on linked data & the semantic web can help you use this technology in your work

• ##### Developing real world applications
video

Watch Dr Barry Norton describing some real world applications that have Linked Data as their underlying technology.

• ##### Welcome to Week 2
video

Watch Dr Barry Norton explain what you will learn about SPARQL (the query language) on this course and what you will be practicing.