Finding correct indicators

28 views
Skip to first unread message

Girish Koundinya

unread,
Apr 16, 2012, 1:44:11 PM4/16/12
to World Bank API
Hi,
I am quite new in using this particular api. I am working on
an application that processes air water and soil pollution in a
particular region. Could you please give me an example of how to
obtain the exact indicator so that i can get the appropriate
information to work on? If i get the output as an xml file i can work
on it. But unable to find the exact api query that would match my
requirements. Please guide with an example of how to find this. If
possible also alternative api's that i can try out.

Thanks

Sarven Capadisli

unread,
Apr 16, 2012, 3:40:57 PM4/16/12
to world-b...@googlegroups.com

Hi Girish,

There is an API documentation for indicator queries:

http://data.worldbank.org/node/203

Get the XML output of all indicator meta data:

http://api.worldbank.org/indicators?format=xml&per_page=20000

Search for keywords in that document and grab the indicator codes
accordingly.

Then make another call for that indicator to get all the observations
for an area:

http://api.worldbank.org/countries/{countryCode}/indicators/{indicatorCode}?per_page=20000

countryCode is either 'all' or country code used in:

http://api.worldbank.org/countries?format=xml&per_page=20000

This is your best bet. But, there are alternative ways to get a hold of
this information.

---

Use the text search interface for indicators:

http://data.worldbank.org/indicator

Click on the result items to go to the indicator URL and grab the
indicator notation from the URL component.

Like earlier, make a specific call for those indicator observations.

---

Yet another way is to use a SPARQL Endpoint with the World Bank
Development Indicators data. NOTE: This is not endorsed in any way by
The World Bank. For data validity, you should always resort to The World
Bank's API.

http://worldbank.270a.info/sparql

The following query reveals the available indicator codes that has to do
with "pollution":

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX classification: <http://worldbank.270a.info/classification/>
PREFIX g-meta: <http://worldbank.270a.info/graph/meta>

SELECT *
WHERE {
GRAPH g-meta: {
?indicatorURI
skos:inScheme classification:indicator ;
skos:prefLabel ?prefLabel ;
skos:notation ?notation ;
foaf:page ?page ;
.
FILTER (regex(?prefLabel, "pollution", "i") && regex(?prefLabel,
"air|water|soil", "i"))
}
}

Apparently, there are no matches for "air" and "soil". Results at:

http://worldbank.270a.info/sparql?query=PREFIX+foaf%3A+%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%0D%0APREFIX+skos%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2004%2F02%2Fskos%2Fcore%23%3E%0D%0APREFIX+classification%3A+%3Chttp%3A%2F%2Fworldbank.270a.info%2Fclassification%2F%3E%0D%0APREFIX+g-meta%3A+%3Chttp%3A%2F%2Fworldbank.270a.info%2Fgraph%2Fmeta%3E%0D%0A%0D%0ASELECT+*%0D%0AWHERE+%7B%0D%0AGRAPH+g-meta%3A+%7B%0D%0A%3FindicatorURI%0D%0A++++skos%3AinScheme+classification%3Aindicator+%3B%0D%0A++++skos%3AprefLabel+%3FprefLabel+%3B%0D%0A++++skos%3Anotation+%3Fnotation+%3B%0D%0A++++foaf%3Apage+%3Fpage+%3B%0D%0A++++.%0D%0AFILTER+%28regex%28%3FprefLabel%2C+%22pollution%22%2C+%22i%22%29+%26%26+regex%28%3FprefLabel%2C+%22air%7Cwater%7Csoil%22%2C+%22i%22%29%29%0D%0A%7D%0D%0A%7D&default-graph-uri=&output=xml&stylesheet=%2Fxml-to-html.xsl

I didn't do it above, but you can write a query to get the observations.

Hope this helps.

-Sarven

Reply all
Reply to author
Forward
0 new messages