Last active
November 16, 2015 13:19
-
-
Save postspectacular/75d7a356680928cc1071 to your computer and use it in GitHub Desktop.
thi.ng/fabric heatmap & ONS lat/lon polygon query
This file contains hidden or 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
;; query spec to compute aggregated heatmap data of all property sales per borough | |
{:prefixes {"sg" "http://statistics.data.gov.uk/def/statistical-geography#"} | |
:q [{:where [[?s "rdf:type" "schema:SellAction"] | |
[?s "schema:price" ?price] | |
[?s "ws:onsID" ?boroughID] | |
[?borough "rdfs:label" ?boroughID] | |
[?borough "sg:officialName" ?name] | |
[?borough "sg:hasExteriorLatLongPolygon" ?poly]]}] | |
:aggregate {?num (agg-count ?s) | |
?avg (agg-avg ?price) | |
?min (agg-min ?price) | |
?max (agg-max ?price) | |
?apoly (agg-collect ?poly) | |
?aname (agg-collect ?name)} | |
:group-by ?boroughID | |
:select [?boroughID ?apoly ?avg ?min ?max ?num ?aname]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment