It doesn't look like the same endpoint contains both the house price index and postcodes. However, looks like the resources in different enpoints are linked, so we can use a federated query to combine the information:
SELECT DISTINCT ?regionName ?postcode ?date ?ukhpi ?volume {
SERVICE <http://data.ordnancesurvey.co.uk/datasets/os-linked-data/apis/sparql> {
VALUES ?postcode {
#-- insert postcodes here (two example postcodes below)
"NP20 5AW"
"SW1W 0NY"
}
?postcodeUri rdfs:label ?postcode ;
pc:district ?ordnanceSurveyRegion .
}
?region owl:sameAs ?ordnanceSurveyRegion .
?region rdfs:label ?regionName .
FILTER (langMatches(lang(?regionName), "EN"))
?report
ukhpi:refRegion ?region;
ukhpi:refMonth ?date;
ukhpi:housePriceIndex ?ukhpi.
OPTIONAL {
?report ukhpi:salesVolume ?volume
}
} ORDER BY DESC(?date)
Here we query the Ordnance Survey endpoint to get the regions (district) using postcodes, and then get the house price indexes using those regions.
Note that inserting all 900 postcodes at once might be too much for the endpoint to handle.
Try the query in Yasgui.