How to use SPARQL to query DBpedia?

As nowadays data is very often being stored in RDF formats such as RSS, a need has arisen for a simple way to locate specific information. In this article, I’ll try to demonstrate how easy it’s to build a simple query using SPARQL and use it to query DBpedia for a specific information!

When was John Lennon born?

Result:

x1
1940-10-09

Click here to see the Live Result

You can look at this page, for the list of available information about (in this case) John Lennon: http://dbpedia.org/page/John_Lennon

 

What is the population of Slovakia?

Result:

x1
5397036

Click here to see the Live Result

 

Who wrote Anna Karenina?

Result:

x1
“Leo Tolstoy”@en

Click here to see the Live Result

 

Who was Freddie Mercury?

Result:

x1
“Freddie Mercury (born Farrokh Bulsara; Gujarati: Pharōkh Balsārā‌; 5 September 1946 – 24 November 1991) was a British musician, record producer, and singer-songwriter, best known as the lead vocalist and lyricist of the rock band Queen. As a performer, he was known for his flamboyant stage persona and powerful vocals over a four-octave range.”@eň

Click here to see the Live Result

 

What albums did Pink Floyd record?

Result:

x2
“Echoes: The Best of Pink Floyd”@en
“Echoes: The Best of Pink Floyd”^^<http://www.w3.org/2001/XMLSchema#string>
“Oh, by the Way”@en
“Animals”@en
“Animals”^^<http://www.w3.org/2001/XMLSchema#string>
“More”@en
“More”^^<http://www.w3.org/2001/XMLSchema#string>
“The Dark Side of the Moon”@en
“Wish You Were Here”@en
“Obscured by Clouds”@en
“Relics”@en
“Works”@en
“The Best of Pink Floyd: A Foot in the Door”@en
“The Best of Pink Floyd: A Foot in the Door”^^<http://www.w3.org/2001/XMLSchema#string>
“Atom Heart Mother”@en
“Ummagumma”@en
“Meddle”@en
“A Collection of Great Dance Songs”@en
“Pink Floyd: Discovery”@en
“The Dark Side of the Moo”@en
“Shine On”@en

Click here to see the Live Result

 

Find all landlocked countries with a population smaller than 100 thousand, with the highest population country first.

Result:

country_namepopulation
“Andorra”@en85082
“Liechtenstein”@en36281
“San Marino”@en32576
“Vatican City”@en839
“Swaziland”@en1.106

Click here to see the Live Result

 

Is the Amazon river longer than the Nile River?

Result: FALSE

Click here to see the Live Result

 

Note: You can use Virtuoso SPARQL Query Editor against the live DBpedia database at following url: http://live.dbpedia.org/sparql

Facebook Comments