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
If the way URIs are generated is standard, you can just turn the results into strings and then take only the part that is needed:
PREFIX pc: <http://data.ordnancesurvey.co.uk/ontology/postcode/>
PREFIX geo: <http://opendatacommunities.org/def/geography#>
SELECT ?postcode ?lsoa
WHERE {
?URI_postcodeUnit
a pc:PostcodeUnit;
geo:lsoa ?URI_lsoa .
BIND (STRAFTER((STR(?URI_postcodeUnit)),"postcodeunit/") as ?postcode)
BIND (STRAFTER((STR(?URI_lsoa)),"lsoa/") as ?lsoa)
}
limit 10