Linked Open Data DBpedia practical

authored by Frank Lynam at 01/12/2014 16:38:44

Objective

Ask DBpedia how many universities are in each country in the world.

Steps

  1. Go to DBpedia’s SPARQL endpoint at http://dbpedia.org/sparql
  2. If the main SPARQL endpoint is down for some reason, go to http://live.dbpedia.org/sparql
  3. Enter the following query:

#Get a count of universities per country from DBPedia
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dbpedia: <http://dbpedia.org/property/>
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
SELECT ?country COUNT(?uni) AS ?uniCount WHERE { ?uni rdf:type dbpedia-owl:University . ?uni dbpedia:country ?country } GROUP BY ?country
  1. Read through and make sure that you understand the logic of the query.
  2. Choose an output format. What is the difference between the options?
  3. Click <Run Query> to run the query.
  4. Navigate the data if viewing as HTML.
  5. Why are some entries URIs and some text?
  6. Enter the following query:

#Get an overview of the predicates associated with the dbpedia-owl:University type
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dbpedia: <http://dbpedia.org/property/>
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
DESCRIBE ?uni WHERE { ?uni rdf:type dbpedia-owl:University } LIMIT 1
  1. What do you think this query is asking?

Further work

Get the geo-coordinates for all of the universities hosted by DBpedia.

Comments

submit