I am trying to write some sparkql to extract postcode data and marching lsoa codes. what I have so far extracts all the url for both the postcodes and lsoa codes, when I would like just the last unit. How do i get just the last elements please?
query <- "PREFIX pc: <http://data.ordnancesurvey.co.uk/ontology/postcode/>
PREFIX geo: <http://opendatacommunities.org/def/geography#>
SELECT * WHERE {
?postcodeUnit
a pc:PostcodeUnit;
geo:lsoa ?lsoa .
}
limit 10"
endpoint <- "http://opendatacommunities.org/sparql"
resultList <- SPARQL(endpoint,query)
head(resultList)
I am also concerned when i get this working, R studio will time out, do i need to run this from a web server? please
Thanks in advance