遵循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 .
}
我希望得到所有活着的人。 如何用SPARQL语法表达? 它更像是询问,让我得到所有没有特定边缘的节点。 是否可以在SPARQL中使用?
先谢谢。 任何帮助表示赞赏。
答案 0 :(得分:3)
在SPARQL 1.1中
SELECT DISTINCT ?item {
?item <http://freebase.com/ns/common/topic/notable_types> <http://freebase.com/ns/people/person> .
FILTER NOT EXISTS { ?item <http://freebase.com/ns/people/deceased_person/date_of_death> ?y}
}
答案 1 :(得分:2)
不确定。你可以使用这种结构:
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))
}