Created
May 2, 2013 06:12
-
-
Save irl/5500444 to your computer and use it in GitHub Desktop.
Honours Project Data Analysis in R
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
library(rrdf) | |
g <- load.rdf("sparql.rdf") | |
rs <- sparql.rdf(g, "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
PREFIX qudt: <http://qudt.org/1.1/schema/qudt#> | |
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
PREFIX ssn: <http://purl.oclc.org/NET/ssnx/ssn#> | |
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> | |
SELECT ?temperature ?time WHERE { | |
?sensor rdf:type <http://uktemp.net/ont/#WundergroundTemperatureSensingDevice> . | |
?observation ssn:observedProperty <http://uktemp.net/dataset/temperature/AB24> . | |
?observation ssn:hasValue ?value . | |
?observation ssn:observationSamplingTime ?time . | |
?value qudt:numericValue ?temperature . | |
FILTER ( ?time < \"2013-04-25T00:00:00.00Z\"^^xsd:dateTime ) | |
FILTER ( ?temperature < \"20.0\"^^xsd:double ) | |
}") | |
temps <- as.numeric(rs[,1]) | |
times <- strptime(sub("\\..*$", "", rs[,2]), "%FT%T", "GMT") | |
jpeg("html/plot.jpg") | |
plot(times, temps) | |
dev.off() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment