GSS-Cogs / ukstats.ccv2.theme

Climate Change v2 theme and content
Other
0 stars 0 forks source link

2 Carbon dioxide (CO2) emissions (territorial basis) by local authority, UK, 2019, (kilo tonnes of carbon dioxide) DB: EMISSIONS #67

Closed peterfrenchons closed 1 year ago

peterfrenchons commented 1 year ago

From ticket #34. To be done once GeoJson is updated on PMD

osamede20 commented 1 year ago

A the updated data, with 2020 time-series, has other greenhouse gases as against only Carbon dioxide (CO2) provided previously, the chart and SPARQL query title was changed to: Total greenhouse gas emissions (territorial basis) by local authority, UK, 2020, kilo tonnes of carbon dioxide equivalent (kt CO2e)

Updated GeoJSON Boundaries data was uploaded for now to PMD-Staging by Swirrl, and not on PMD-Beta yet. So, the SPARQL endpoint URL is: https://staging.gss-data.org.uk/sparql

SPARQL Query is updated and given below:

PREFIX dcat: <http://www.w3.org/ns/dcat#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX qb: <http://purl.org/linked-data/cube#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX void: <http://rdfs.org/ns/void#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX geo: <http://statistics.data.gov.uk/def/statistical-geography#>

PREFIX data: <http://gss-data.org.uk/data/climate-change/beis-2005-to-2020-local-authority-greenhouse-gas-emissions/2005-to-2020-local-authority-greenhouse-gas-emissions-dataset#dataset>
PREFIX year: <http://gss-data.org.uk/data/climate-change/beis-2005-to-2020-local-authority-greenhouse-gas-emissions/2005-to-2020-local-authority-greenhouse-gas-emissions-dataset#dimension/year>
PREFIX local_authority: <http://gss-data.org.uk/data/climate-change/beis-2005-to-2020-local-authority-greenhouse-gas-emissions/2005-to-2020-local-authority-greenhouse-gas-emissions-dataset#dimension/local-authority>
PREFIX measure: <http://gss-data.org.uk/data/climate-change/beis-2005-to-2020-local-authority-greenhouse-gas-emissions/2005-to-2020-local-authority-greenhouse-gas-emissions-dataset#measure/territorial-emissions>

SELECT ?geography_uri ?label (ROUND((SUM(xsd:float(?value)) * 100) / 100) AS ?values)
WHERE {
        ?obs qb:dataSet data: .
        ?obs year: [ rdfs:label ?year] .
        ?obs local_authority: ?geography_uri .
        ?obs measure: ?value . 
        FILTER(?year = '2020') 

        FILTER(?geography_uri != <http://statistics.data.gov.uk/id/statistical-geography/N92000002>)

        OPTIONAL{?geography_uri geo:officialname ?label}

}
GROUP BY ?geography_uri ?label
ORDER BY ASC(?geography_uri)