我想要獲得已完成3件或更多作品(在DBpedia中)的所有作者的列表。 http://dbpedia.org/sparql我想獲得所有作者已經超過3件作品的列表 - DBpedia Sparql
基本代碼
select (count(?work) as ?totalWork), ?author
Where
{
?work dbo:author ?author.
}
GROUP BY ?author
我得到每個作家作品的完成總量:
我的例子能上運行。但是,當我嘗試過濾僅顯示具有超過3件作品的作者列表時。我得到錯誤:
我試着HAVING關鍵字或使用FILTER關鍵字。
使用過濾器
select (count(?work) as ?tw), ?author
Where
{
?work dbo:author ?author.
FILTER (?work > 3).
}
GROUP BY ?author
error: Virtuoso 22023 Error VECDT: SR066: Unsupported case in CONVERT (INTEGER -> IRI_ID)
使用HAVING關鍵字
select (count(?work) as ?tw), ?author
Where
{
?work dbo:author ?author.
}
GROUP BY ?author
HAVING (?tw > 3)
Virtuoso 37000 Error SP031: SPARQL compiler: Variable ?tw is used in the result set outside aggregate and not mentioned in GROUP BY clause
@TallTed感謝您的參考,我不知道這一點。不幸的是,它不會在http://sparql.org/query-validator.html上引發錯誤。我會和那裏的維護人員交談。 – AKSW