我有一张英格兰和威尔士每个太阳能农场大约900个邮政编码的清单。我想找出每个邮政编码的房价,看看太阳能发电场实施后房价可能会发生什么变化。
我是SPARQL的新手,不知道如何对所有邮政编码进行单个查询。如果有人能帮上忙,那就太好了。
这是通过邮政编码进行搜索的链接:http://landregistry.data.gov.uk/app/qonsole。
非常感谢。
发布于 2017-07-24 20:56:21
它看起来不像是同时包含房价指数和邮政编码的端点。但是,看起来不同端点中的资源是链接的,所以我们可以使用联邦查询来组合信息:
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)在这里,我们查询Ordnance Survey端点以使用邮政编码获取地区(地区),然后使用这些地区获得房价指数。
请注意,一次插入所有900个邮政编码可能太多,端点无法处理。
Try the query in Yasgui。
https://stackoverflow.com/questions/45279072
复制相似问题