Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KasperBrandt/6107282 to your computer and use it in GitHub Desktop.
Save KasperBrandt/6107282 to your computer and use it in GitHub Desktop.
SPARQL query for retrieving country planned disbursements per year. Should be performed on the IATI endpoint: http://eculture.cs.vu.nl:1987/iati/user/query
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX iati: <http://purl.org/collections/iati/>
SELECT ?countrycode ?year ?currencycode (sum(?float) as ?sum)
WHERE {
?act iati:activity-planned-disbursement ?trans .
?trans iati:value ?value .
?trans iati:value-currency ?currency .
?trans iati:start-date ?date .
BIND (SUBSTR(?date, 1, 4) as ?year) .
?currency iati:code ?currencycode .
BIND (REPLACE(?value, ",", "", "i") AS ?correctedvalue) .
BIND (xsd:float(?correctedvalue) as ?float) .
?act iati:activity-recipient-country ?country .
?country iati:country-code ?code .
?code iati:code ?countrycode
} GROUP BY ?countrycode ?year ?currencycode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment