DBpedia as Open Knowledge Graph

This is supposed to be a concise tutorial and you should not spend longer than 10 minutes to go through it.

DBpedia an as Open Knowledge Graph

DBpedia is a crowd-sourced community effort to extract structured content from the information in Wikipedia. This structured information is known as an open knowledge graph (OKG). Note that 'open' indicates that it is available to everyone on the web. It publishes the data as RDF statements; hence, ones can navigate it using SPARQL. For instance, we can make the following queries as if we ask from Wikipedia:

  • Give me the list of countries of the world, their capital cities, and their populations;
  • Give me 100 randomly chosen people and their information.

Using DBpedia

The DBpedia RDF data models is housed and is published via OpenLink Virtuoso. As indicated on the above figure, Virtuoso provides an access to the RDF data via a SPARQL endpoint. You can test your queries via:

By far, the best RDF linked open data visualization tool may be: http://en.lodlive.it/ as it knows a lot of SPARQL endpoints including DBpedia.

SPARQL Examples

1. Give me the list of countries of the world, their capital cities, and their populations

PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dbp: <http://dbpedia.org/property/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT  min(?country_name) as ?Country_name min(?capital_name) as ?Capital_name min(?population) as ?Population
WHERE {
?country a dbo:Country.
?country rdfs:label ?country_name.
?country dbo:capital ?capital.
?capital  rdfs:label ?capital_name.
?country ?p ?population .
FILTER(?p = dbo:populationTotal || ?p = dbp:populationCensus). 
FILTER NOT EXISTS { ?country dbo:dissolutionYear ?year }
FILTER langMatches( lang(?country_name), "en"  ).
FILTER langMatches( lang(?capital_name), "en"  ).}
GROUP BY ?country_name

2. Give me 100 randomly chosen people and their information

SELECT  distinct ?link ?person_full_name ?birth_year   WHERE { 
     ?link a foaf:Person. 
     ?link ?p ?person_full_name. 
     FILTER(?p IN(dbo:birthName,dbp:birthName,dbp:fullname,dbp:name)). 
     ?link rdfs:label ?person_name .    
     ?person_name bif:contains "abdul" . 
     OPTIONAL { ?link dbo:birthYear ?birth_year .  }
     FILTER(langMatches(lang(?person_full_name), "en"))
     }
     LIMIT 100

Other blogged posts >> Tutorials