我写了这个查询并返回夫妻和特定条件的列表.(在http://live.dbpedia.org/sparql中)
SELECT DISTINCT ?actor ?person2 ?cnt
WHERE
{
{
select DISTINCT ?actor ?person2 (count (?film) as ?cnt)
where {
?film dbo:starring ?actor .
?actor dbo:spouse ?person2.
?film dbo:starring ?person2.
}
order by ?actor
}
FILTER (?cnt >9)
}
Run Code Online (Sandbox Code Playgroud)
问题是某些行是重复的.例:
http://dbpedia.org/resource/George_Burns http://dbpedia.org/resource/Gracie_Allen 12
http://dbpedia.org/resource/Gracie_Allen http://dbpedia.org/resource/George_Burns 12
如何删除这些重复?我将性别添加到?actor但它会损害当前结果.