SPARQL: Get all the entities of subclasses of a certain class

ε祈祈猫儿з 提交于 2019-12-05 00:44:18

A better solution is to use property path expressions in SPARQL 1.1

This would be rewritten as:

SELECT ?entity
WHERE {
  ?entity rdf:type ?type.
  ?type rdfs:subClassOf* :C.
}

Based on the SPARQL 1.1 specification the proper way to do it would be:

SELECT ?entity
WHERE {
    ?entity rdf:type/rdfs:subClassOf* :C
}

Without support for property paths there is no way of expressing class hierarchies of arbitrary length.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!