GSS-Cogs / ukstats.ccv2.theme

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

Update - Greenhouse gas emissions (residence basis) for the three highest emitting industries and households, UK, 1990 to 2020 2021, (million tonnes of carbon dioxide equivalent) DB Emissions #76

Closed peterfrenchons closed 1 year ago

peterfrenchons commented 1 year ago

Update SPARQL, title and narrative.

osamede20 commented 1 year ago
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 data: <http://gss-data.org.uk/data/climate-change/ons-atmospheric-emissions-greenhouse-gases-by-industry-and-gas-1990-to-2020-and-provisional-2021/atmospheric-emissions-greenhouse-gases-by-industry-and-gas-1990-to-2020-and-provisional-2021#dataset>
PREFIX period: <http://purl.org/linked-data/sdmx/2009/dimension#refPeriod>
PREFIX emission_type: <http://gss-data.org.uk/data/climate-change/ons-atmospheric-emissions-greenhouse-gases-by-industry-and-gas-1990-to-2020-and-provisional-2021/atmospheric-emissions-greenhouse-gases-by-industry-and-gas-1990-to-2020-and-provisional-2021#dimension/emission-type>
PREFIX section: <http://gss-data.org.uk/data/climate-change/ons-atmospheric-emissions-greenhouse-gases-by-industry-and-gas-1990-to-2020-and-provisional-2021/atmospheric-emissions-greenhouse-gases-by-industry-and-gas-1990-to-2020-and-provisional-2021#dimension/section>
PREFIX measure: <http://gss-data.org.uk/data/climate-change/ons-atmospheric-emissions-greenhouse-gases-by-industry-and-gas-1990-to-2020-and-provisional-2021/atmospheric-emissions-greenhouse-gases-by-industry-and-gas-1990-to-2020-and-provisional-2021#measure/mass-of-air-emissions>

SELECT ?year ?emissionsMillonTonnes ?industrySector ?unit
WHERE {
           {
              SELECT (SUM(DISTINCT ?emissions/1000) AS ?emissionsMillonTonnes) ?unit
                          (GROUP_CONCAT(DISTINCT ?industryLabel; separator = ",") AS ?industrySector)
                           (GROUP_CONCAT(DISTINCT ?period; separator = ",") AS ?year) 
                   { 
                                    ?obs qb:dataSet data: .
                                     ?obs period: [ rdfs:label ?period ] .
                                     ?obs emission_type: [ rdfs:label ?emissionType ] .
                                    ?obs section: ?section .
                                     ?obs measure: ?emissions .

                                     GRAPH <http://gss-data.org.uk/graph/climate-change/ons-atmospheric-emissions-greenhouse-gases-by-industry-and-gas-1990-to-2020-and-provisional-2021/section> { 
                                               ?section rdfs:label ?industry .
                                      }

                                      FILTER(?emissionType = 'Total GHG')
                                      FILTER(?industry != 'Consumer expenditure Not travel' && ?industryLabel != 'Consumer expenditure Travel')
                     FILTER(?industry IN ('Electricity, gas, steam and air conditioning supply', 'Manufacturing', 'Consumer expenditure', 'Activities of households as employers; undifferentiated goods and services-producing activities of households for own use', 'Transport and storage')) 
                            BIND(
                                         REPLACE(REPLACE(REPLACE(?industry,'Electricity, gas, steam and air conditioning supply','Energy Supply'), 'Consumer expenditure', 'Households'), 'Activities of households as employers; undifferentiated goods and services-producing activities of households for own use', 'Households') AS ?industryLabel)                   
                        BIND("Mt CO2e" AS ?unit)
                 }
                 GROUP BY ?industryLabel ?period ?unit
                 ORDER BY ?period                   
        }
}
GROUP BY ?year ?emissionsMillonTonnes ?industrySector ?unit
ORDER BY ASC(?year) DESC(?emissionsMillonTonnes)