GSS-Cogs / chart-builder

The Chart Builder is a proof-of-concept app to understand the feasibility of using a CSV file (or SPARQL query) to generate and customise a chart or data visualisation
https://chart-builder-no4vxskx7a-nw.a.run.app
2 stars 0 forks source link

Wrong Local Authority values or labels when using sorted map data in Standalone Chart Builder #175

Open charlesons opened 1 year ago

charlesons commented 1 year ago

Using the following SPARQL query in the standalone chart builder gives incorrect values or labels on the output map. The same issue does not seem to occur in the Volto integrated version of Chart Builder.

PREFIX qb: <http://purl.org/linked-data/cube#>
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/gss_data/climate-change/beis-2005-to-2019-local-authority-carbon-dioxide-co2-emissions#>
PREFIX dim: <http://gss-data.org.uk/data/gss_data/climate-change/beis-2005-to-2019-local-authority-carbon-dioxide-co2-emissions#dimension/>
PREFIX meas: <http://gss-data.org.uk/def/climate-change/measure/>

SELECT ?geography_uri ?label  (ROUND((SUM(xsd:float(?val)) * 100) / 100) AS ?values)
WHERE {
  ?obs qb:dataSet data:dataset ;
       dim:year <http://reference.data.gov.uk/id/year/2019> ;
       dim:local-authority-code ?geography_uri ;
       meas:territorial-emissions ?val .

       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)