使用SPARQL查找活着的人(选择没有边缘的项目)

niz*_*.sp 5 rdf freebase sparql dbpedia virtuoso

以下 sparql 查询将给出已死亡的人。

select distinct ?item{
?item <http://freebase.com/ns/common/topic/notable_types> <http://freebase.com/ns/people/person> .
?item <http://freebase.com/ns/people/deceased_person/date_of_death> ?y .
}
Run Code Online (Sandbox Code Playgroud)

我想要得到所有还活着的人。如何用 SPARQL 语法表达这一点?它更像是在问,给我所有没有特定边缘的节点。在SPARQL中可以吗?

提前致谢。任何帮助表示赞赏。

Lev*_*ich 3

当然。您可以使用此结构:

SELECT DISTINCT ?item {
    ?item <http://freebase.com/ns/common/topic/notable_types> <http://freebase.com/ns/people/person> .
    OPTIONAL {?item <http://freebase.com/ns/people/deceased_person/date_of_death> ?y}
    FILTER (!BOUND(?y))
}
Run Code Online (Sandbox Code Playgroud)

  • 请注意,这不会只提供还活着的人。它只为您提供在 freebase 中没有记录死亡日期的人。 (4认同)