Skip main navigation
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.
We use cookies to give you a better experience. Carry on browsing if you're happy with this, or read our cookies policy for more information.

Ordering and limiting triples

When building new RDF triples with CONSTRUCT, you can use the operators described in Step 2.10 (Ordering query results) in order to organise and delimit the variable bindings retrieved from the dataset.

The following query will build “creator” relationships only for the first 10 albums recorded by the Beatles, following alphabetical order of the titles, along with their tracks:

PREFIX dbpedia: <>
PREFIX foaf: <>
PREFIX dc: <>
PREFIX mo: <>

CONSTRUCT { ?album dc:creator dbpedia:The_Beatles .
            ?track dc:creator dbpedia:The_Beatles .
WHERE { dbpedia:The_Beatles foaf:made ?album .
        ?album mo:record ?record .
        ?album dc:title ?album_title .
        ?record mo:track ?track . 
ORDER BY ?album_title

Share this article:

This article is from the free online course:

Introduction to Linked Data and the Semantic Web

University of Southampton

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
    Welcome to the course

    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
    Developing real world applications

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

  • Welcome to Week 2
    Welcome to Week 2

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

Contact FutureLearn for Support