SPARQL, SNORQL triple store – an introduction

I am overwhelmed by the potential power of RDF and the semantic web and am sure that this is a large part of our information-based future. I have been playing with dbpedia and its SPARQL interfaces and here I introduce you to the ideas.

Recall that dbpedia is a dump of (all?) the organized information (infoboxes and categories) in Wikipedia. They have created an RDF version of this (a triple store). Until recently triple stores had problems of scale, but at WWW2007 several people/organizations asserted they could deal with many billions of triples. Here we are going to access dbpedia though the SNORQL web interface. I suggest you clickalong with me – note that the syntax is a little hairy in places but you will get used to it. As I am going to Uppsala next week for the Bioclipse meeting, I’ll use “Uppsala” as the theme.
A triple looks like:

subject – predicate – object

and any or all of the components may be absolute URIs. Here is an example (in N3 notation);


(Note that the syntax is NOT XML, NOT HTML and do not omit the ‘.’ at the end!). In simple terms this states that in dbpedia resource/Anders_Celsius is the subject, deathplace is the predicate and resource/Uppsala is the object. These are all symbols for nodes in the dbpedia triple store (graph) and so far have no lexical form and no semantics. However it is not suprising that we humans can interpret this as

The “deathplace” of “Anders Celsius” is “Uppsala”. dbpedia (and WP) attach human-readable annotations to these components so we can reasonably assert that “Anders Celsius died in Uppsala”.

We’ll show how to find “Celsius” later. For now let’s assume that will occur as subjects and as objects in dbpedia (It’s unlikely to be a predicate). For human readability we use prefixes:

PREFIX dbpedia:

so <> … becomes … :Uppsala

and < … becomes … dbpedia:deathplace

dbpedia has a number of well-known namespaceURI systems and SNORQL lists several as PREFIXes:

PREFIX rdfs:
PREFIX foaf:
PREFIX dbpedia2:
PREFIX dbpedia:
PREFIX skos: 

so let’s issue a simple query – “list all triples where :Uppsala is the subject”:

  :Uppsala ?predicate ?object .

This gives about a hundred triples of which Uppsala is the subject. Here are a few:
rdf:type dbpedia:class/City

The predicates are Wikipedia types – often “Category”. These are becoming increasingly well formalized and will represent a common human label for well described objects. So Uppsala “is a City”, “is a town”, “is a University_town” and so on.

dbpedia2:abstract: If you are searching for the Uppsala of Norse mythology, see also Gamla Uppsala. Uppsala(older spelling Upsala) is a city in central Sweden, located about 70 km north of Stockholm. It is the fourth largest city in Sweden with its 130,000 inhabitants; including immediate surroundings, Uppsala Municipality amounts to 183 403 (2005). Uppsala is the capital of Uppsala County (Uppsala Län), and Sweden’s ecclesiastical centre, being the seat of Sweden’s archbishop since 1164. Uppsala is famous for its university, the oldest still existing in Scandinavia and Northern Europe, founded in 1477 (a Studium Generale was founded in Lund already in 1425).“”@en

This is the @en abstract – there are at least 12 other language equivalents. They don’t all have the same information. Note that the object is here a literal (a string), not a URI.


This is very important, geonames is the agreed central web classification/gazetteer/taxonomy of placenames. Only one is #2666199 and that is the Uppsala in Sweden. This allows linking to GIS coordinates, etc.

Now let’s try :Uppsala as the object – “something has predicate Uppsala”.

SELECT  *  WHERE {  ?subject ?predicate  :Uppsala  .  }

:Uppsala_County dbpedia2:capital

… Upsala County has capital Uppsala
:Area_code_018 dbpedia2:State
… area code 018 corresponds to State Uppsala

:Uppland_Rune_Inscription_1011 dbpedia2:city
… inscription 1011 is in (city) Uppsala

:Anders_Celsius dbpedia:deathplace
… Anders Celsius died in Uppsala

Already this is incredibly powerful – “tell me everything about X” in machine-understandale form. But when we link these we can get more:
“Find all people who were born and died in Uppsala and tell me all about them:

SELECT  ?subject ?predicate ?object
?subject dbpedia:deathplace  :Uppsala .
?subject dbpedia:birthplace  :Uppsala .
?subject ?predicate ?object .

I’ll leave you to do that. Not someone I know of, but I don’t watch Dynasty or Stargate.
And that’s only the beginning. Try asking “Which Stargate actors were born outside the US?” “Which actors played in both Dynasty and Stargate?” “Which actors were born and died in the same city?”.

And these are relatively simple questions. Imagine what will be possible when the Wikpedia chemistry gets fully into dbpedia!

This entry was posted in semanticWeb. Bookmark the permalink.

3 Responses to SPARQL, SNORQL triple store – an introduction

  1. Thanks for this nice introduction Peter. Note that the DBpedia URIs also work in a web browser, so you can go to and the DBpedia server will generate a web page showing the information it has about the item.

  2. Appropos Richard’s comments, you can also view the Uppsala URI via an RDF Browser as demonstrated by the OpenLink RDF Browser that is installed on the DBpedia server – All About Uppsala Permalink .
    I am also knocking up a screencast to show how you can use the iSPARQL Query builder to paint your SPARQL Graph Patterns on a QBE Canvas. If you are impatient you can see some iSPARQL and DBpedia screencasts I’ve already prepared (re. other queries).
    Important Note: We have enhanced the hyperlink behavior so that you can experience the power of Linked Data and URI Dereferencing. Just click “Explore” or “Dereference” in the Lookup window presented by the enhanced hyperlink.

  3. Pingback: Unilever Centre for Molecular Informatics, Cambridge - Jim Downing » Blog Archive » Linking representations in DBpedia

Leave a Reply

Your email address will not be published. Required fields are marked *