SPARQL 包含 属性 的所有子属性

SPARQL to encompass all sub-properties of a property

我想要所有已经结束的维基数据项,所以我这样写:

?item wdt:P582 ?endtime.

问题:它不包括已经 "abolished".
的项目 abolished is a subproperty of end time.

问题:如何包含所有子属性?


不包含子属性的当前查询:

SELECT
    ?item ?endtime
WHERE {
    ?item p:P31/ps:P31/wdt:P279* wd:Q3917681. # Embassies...
    ?item wdt:P582 ?endtime. # ... that have ended
}

我可以对所有已知的子属性执行 UNION,但将来可能会出现新的子属性。

如果维基数据包含子属性关系,您只需要:

?p rdfs:subPropertyOf* wdt:P582 .
?item ?p ?endtime.