extracting only postcode and lsoa code - sparkql

后端 未结 1 1607
礼貌的吻别
礼貌的吻别 2021-01-24 00:00

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

相关标签:
1条回答
  • 2021-01-24 01:01

    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
    
    0 讨论(0)
提交回复
热议问题