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
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
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.
answered 08 Dec '11, 09:12
DBpedia and Wikipedia aren't the best sources for this sort of information, due to their crowdsourced and constantly evolving nature.
Here's a nice simple query based on the Factbook --
For your simple list of countries, there also happens to be an HTML-based browser startpoint on the Factbook endpoint.
answered 08 Dec '11, 17:11
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:
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.)
Playing around I have today 191 of the countries with united nations members:
However, "clean" wikipedia list states today 193 member states.
answered 24 Feb, 11:50