Warning:
This wiki has been archived and is now read-only.

SPARQL Overview

From Decision XG
Jump to: navigation, search

SPARQL Overview

SPARQL: SPARQL is a World Wide Web Consortium (W3C) recommendation for querying Resource Description Framework (RDF) data stores.

  • You will find a SPARQL tutorial here: http://www.cambridgesemantics.com/2008/09/sparql-by-example/ (click or use right arrow key to step through).
  • To explore SPARQL, you can run sample queries against dbpedia (an rdf data store collected from Wikipedia infoboxes) at http://dbpedia.org/snorql/.
  • In case you are curious, a sample SPARQL query is below. This query doesn’t specify a data store, but you can copy/paste and run it against dbpedia.


The query asks for the names and populations of all landlocked countries whose population is greater than 15 million.


PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>        
PREFIX type: <http://dbpedia.org/class/yago/>
PREFIX prop: <http://dbpedia.org/property/>
SELECT ?country_name ?population
 WHERE {
   ?country a type:LandlockedCountries ;
   rdfs:label ?country_name ;
   prop:populationEstimate ?population .
   FILTER (?population > 15000000) .
 }