First Question of the Week: mayors!

From The QA Company
Jump to navigation Jump to search

To start our tradition of the “question of the week” let’s start with something simple … the mayor of cities. There are millions of cities in the world and for many of them we know their mayor. We take this data fromWikidata (one of the biggest Knowledge Graphs we know about).

Try to find the mayor of your city like:

Example.2074ae5c.pngBut what is happening under the hood?

Let's take the last question "tell me the mayor of berlin".

We need to identify the entity "berlin" and link it with the right concept in Wikidata which ishttp://www.wikidata.org/entity/Q64. Sounds easy, but there are many thing in Wikidata called Berlin. For example there is aBerlin (American synthpop band) . Also we need to identify "mayor" and link it to the propertyhttp://www.wikidata.org/prop/direct/P6 which stands for "head of government". Finally note that "tell me" could refer toTell Me (song by Diddy) but this option is not the one the user intended.

After having identified the right nodes and relations in the graph we construct a SPARQL query. In this case

SELECT ?o1 WHERE {

  <http://www.wikidata.org/entity/Q64>  <http://www.wikidata.org/prop/direct/P6>  ?o1 .}

By querying this we have our result "Michael Müller". Quite long way no? Out of this we need to retrieve contextual information like: images, descriptions, external links, and important properties.

Google can also do this? Yes but they use some other data source … how do we know? if you ask on google “mayor of Saint-Etienne”you will not get any result even if it is a city with more than 150 thousand inhabitants!

Siri can do this? Yes and they use Wikidata as one of thier main source of information. Look at this answer:

Siri.5abedc8d.pngIf you check carefully you will see that you can find all the information rendered here also in Wikidata!

That's it for today!


See you next week!The QA Company