Created
July 29, 2013 20:00
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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