Question

Is it possible to search a query within wikipedia for only populated places?

For example: when i write a query like BELGIUM intitle:GEMBLOUX or BELGIUM GEMBLOUX, I anticipate Gembloux page, where is a town in Belgium, in the first order but I get Gembloux Abbey page which is useless for my aim. I thought that if I can state it in the query retrieving only populated places, I can get what i want.

P.s.:I have already used DBpedia but I need to get the correct link in the first place in wikipedia search results and then I need to parse this page since DBpedia is not up to date for many cities...

Was it helpful?

Solution

You can certainly use DBpedia to search for populated places. In your case, you can use the public DBpedia SPARQL endpoint retrieve populated places that have "Gembloux" in their name and the associated Wikipedia article with this query:

select distinct ?place ?wikipediaArticle where { 
  ?place a dbpedia-owl:PopulatedPlace ;
         rdfs:label ?label ;
         foaf:isPrimaryTopicOf ?wikipediaArticle .

  filter( regex( ?label, "Gembloux" ))
}

SPARQL results

place                                       wikipediaArticle
---------------------------------------------------------------------------------------
http://dbpedia.org/resource/Gembloux        http://en.wikipedia.org/wiki/Gembloux
http://dbpedia.org/resource/Gembloux_Abbey  http://en.wikipedia.org/wiki/Gembloux_Abbey
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top