SPARQL HAVING 子句给出语法错误
SPARQL HAVING clause giving syntax error
我正在尝试使用 this 和以下内容从 DBPedia 中获取超过 3 本书的作者:
SELECT ?author (COUNT(*) as ?count) WHERE {?works dbo:author ?author. }
Group by(?author)
ORDER BY DESC (?count)
HAVING (?count > 3)
但是我收到一个语法错误,当我删除我的 HAVING 子句时,其余部分工作正常,知道可能是什么问题吗?
你有:
Group by(?author) ORDER BY DESC (?count) HAVING (?count > 3)
但是 HAVING
应该在 ORDER BY
.
之前
错误告诉你“?count is used in the result set outside aggregate”所以基本上你应该使用 "aggregated solution" 你可以这样做:
SELECT ?author (COUNT(*) as ?count) WHERE {?works dbo:author ?author. }
Group by ?author
HAVING (COUNT(*) > 3)
ORDER BY DESC (?count)
你可以看到here形式语法。
我正在尝试使用 this 和以下内容从 DBPedia 中获取超过 3 本书的作者:
SELECT ?author (COUNT(*) as ?count) WHERE {?works dbo:author ?author. }
Group by(?author)
ORDER BY DESC (?count)
HAVING (?count > 3)
但是我收到一个语法错误,当我删除我的 HAVING 子句时,其余部分工作正常,知道可能是什么问题吗?
你有:
Group by(?author) ORDER BY DESC (?count) HAVING (?count > 3)
但是 HAVING
应该在 ORDER BY
.
错误告诉你“?count is used in the result set outside aggregate”所以基本上你应该使用 "aggregated solution" 你可以这样做:
SELECT ?author (COUNT(*) as ?count) WHERE {?works dbo:author ?author. }
Group by ?author
HAVING (COUNT(*) > 3)
ORDER BY DESC (?count)
你可以看到here形式语法。