SPARQL - How do you use count?

让人想犯罪 __ 提交于 2019-12-01 18:40:33

This is because COUNT(*) simply counts result rows for each group

If there is no GROUP BY clause in your query then there is one implicit group of all results hence you just get the number of rows.

If you add a GROUP BY to your query like the following example you should get the result you want:

SELECT (COUNT(*) AS ?count)
WHERE
{
  ?a <http://xmlns.com/foaf/0.1/topic_interest> ?s}
} GROUP BY ?s
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!