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.
3.10

# Assigning variables

If you want to construct RDF triples using a variable that is derived from retrieved data, e.g., through an arithmetical operation, you can add a BIND statement to the WHERE clause as follows:

PREFIX dbpedia: <http://dbpedia.org/resource/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX mo: <http://purl.org/ontology/mo/>

CONSTRUCT { ?track mo:runtime ?secs }
WHERE { dbpedia:The_Beatles foaf:made ?album .
?album mo:record ?record .
?record mo:track ?track .
?track mo:duration ?duration .
BIND ((?duration/1000) AS ?secs) .
}


In this way the object of mo:runtime will be given in seconds rather than milliseconds.

This work is a derivative of ‘Using Linked Data Effectively’ by The Open University (2014) and licensed under CC by 4.0 International Licence adapted and used by the University of Southampton. http://www.euclid-project.eu/

## 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.