我想做一个SPARQL查询,它返回与Person
有关的所有本体类/属性的列表。对于例如,像亚类的Person
SPARQL查询与人有关的所有类的列表
<rdfs:subClassOf rdf:resource="http://dbpedia.org/ontology/Person"/>
(衍生自)或具有Person
<rdfs:domain rdf:resource="http://dbpedia.org/ontology/Person"/>
结构域/范围。
例如,像"http://dbpedia.org/ontology/OfficeHolder"
& "http://dbpedia.org/ontology/Astronaut"
结果应查询返回,作为第一个具有rdfs:domain
人,而第二个是一个rdfs:subClassOf
人。
下面是我写的查询:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dbo: <http://dbpedia.org/ontology/>
select distinct ?s
where {
{
?s rdfs:domain dbo:Person .
}
union
{
?s rdfs:range dbo:Person .
}
union
{
?s rdfs:subClassOf dbo:Person .
}
}
现在,该查询返回所有明确提到在他们的属性Person
类的列表,但错过了类,如Singer
,这是一个子类MusicalArtist
,它位于Person的域中。
我想要一个查询,它直接或通过“继承”列出所有与Person相关的类/属性。有什么建议么?
'DBO:OfficeHolder'不是属性,它有没有'RDFS:domain'。 –