我有兴趣从 statistics.gov.scot 获取可用的不同层次结构的列表。我想列出的最适合的层次结构如下:
http://statistics.gov.scot/def/hierarchy/best-fit#community-health-partnership
http://statistics.gov.scot/def/hierarchy/best-fit#council-area
http://statistics.gov.scot/def/hierarchy/best-fit#country
可通过 this sample geography 的 API 部分获取。
期望的结果
我希望返回所需的结果:
community-health-partnership
council-area
country
如何构建实际产生该结果的查询,我可以通过以下方式获取可用的所有地理位置的列表:
PREFIX sdmx: <http://purl.org/linked-data/sdmx/2009/dimension#>
SELECT DISTINCT ?framework
WHERE {
?a sdmx:refArea ?framework .
} LIMIT 10
我正在尝试一些事情:
PREFIX fits: <http://statistics.gov.scot/def/hierarchy/best-fit#>
SELECT DISTINCT ?framework
WHERE {
?a fits ?framework .
} LIMIT 10
但这种语法自然是不正确的。
最佳答案
开始于 their SPARQL endpoint ,你可以这样做——
DESCRIBE <http://statistics.gov.scot/def/hierarchy/best-fit#country>
然后,根据这些结果,您可能会尝试类似的方法,其结果并不完全是您所说的想要的,但可能会更好 -
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?hierarchy
?label
WHERE
{ ?hierarchy rdfs:subPropertyOf <http://statistics.gov.scot/def/hierarchy/best-fit>
; rdfs:label ?label
}
关于sparql - 从 stats.gov.scot 获取可用层次结构的列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48014698/