I want to Query DBPedia to get the list of all the countries in the world but I am not able to make such a query due to lack of knowledge about which ontology to use as in the URI's . Please help to generate such query for DBPedia ?

asked 08 Dec '11, 05:56

Roger's gravatar image

accept rate: 10%

It's problematic to create a list of countries for a few reasons.

The :Country type in the Dbpedia Ontology has about 10 times as many countries in it than currently exist in the world. These include a number of entities that no longer exist, such as the Roman and Hapsburg Empires.

You're better off looking for a list of entities that have ISO country codes, which can be had with the following query

select ?s {
    ?s <http://dbpedia.org/ontology/wikiPageRedirects> ?r .

Even the ISO codes have problems. There are many countries for which people don't agree on the status, and a huge number of ISO codes have been issued for islands that appear to be completely administered by larger countries. These are of interest to domain name speculators and amateur radio operators, but they aren't really independent entities.

permanent link

answered 08 Dec '11, 09:12

database_animal's gravatar image

database_animal ♦
accept rate: 15%

@database_animal I tried out with the ISO codes but was a problem as you mentioned. Can I have some LOD where I can query about the different things without redundancy. I am looking for things such as Name of the countries and its states as well as population distribution etc demographic details?

(09 Dec '11, 02:00) Roger Roger's gravatar image

DBpedia and Wikipedia aren't the best sources for this sort of information, due to their crowdsourced and constantly evolving nature.

A better list would probably be something like you can get from the CIA World Factbook, which has been partially translated into Linked Data...

Here's a nice simple query based on the Factbook --

  WHERE { ?country a <http://www4.wiwiss.fu-berlin.de/factbook/ns#Country> } 
  ORDER BY ?country

-- which can get you results from the LOD Cloud Cache (should be fairly complete) or URIburner (may not be complete).

For your simple list of countries, there also happens to be an HTML-based browser startpoint on the Factbook endpoint.

permanent link

answered 08 Dec '11, 17:11

TallTed's gravatar image

TallTed ♦
accept rate: 14%

@TallTed I came up with a small solution of using a static list of this data from some source because this dosent change much and then query DBPedia and other resources for the result. This will help me to get a consistent list for the future. but I would definitely try out the approach that you mentioned. Thanks. Please let me know if the thing I have mentioned above is good enough for time being ?

(09 Dec '11, 02:06) Roger Roger's gravatar image

The best way to figure out these sorts of queries is to look at an example of what you're looking for, like France.

From this, you see it should just be:

   ?c a <http://dbpedia.org/ontology/Country> .

But due to noise, and former countries, the result list is full of noise. It seems that anything that uses the Wikipedia template for country will be typed country here. Unfortunately, I don't see a way of getting a clean list. (Bit of a pity because Wikipedia has a "clean" list here, albeit with the usual political disclaimers.)

permanent link

answered 08 Dec '11, 09:17

Signified's gravatar image

Signified ♦
accept rate: 37%

edited 08 Dec '11, 09:46

@Signified I too saw that list in Wikipedia but does not help in getting my goal. I was thinking of getting a static list from some website and then querying DBPedia for the results.I think that will be a good solution rather than going around with the data in DBPedia. Even it will reduce my ajax request that I make to DBPedia. What are your opinions on this approach?

(09 Dec '11, 02:02) Roger Roger's gravatar image

Playing around I have today 191 of the countries with united nations members:

select ?country where { ?country <http://purl.org/dc/terms/subject> <http://dbpedia.org/resource/Category:Member_states_of_the_United_Nations>; <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Country> } order by ?country

However, "clean" wikipedia list states today 193 member states.

permanent link

answered 24 Feb '13, 11:50

hlu's gravatar image

accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 08 Dec '11, 05:56

question was seen: 4,952 times

last updated: 24 Feb '13, 11:50