SPARQL 和计数项目

发布于 2025-01-16 02:53:29 字数 728 浏览 3 评论 0原文

我正在使用 SPARQL 和 Wikidata 查询服务来尝试确定:获得奥斯卡奖的演员按照他们获得的(任何)奖项总数按降序排列,并列出所有奖项的列表。

到目前为止,这是我所拥有的有效方法,但并不能完全满足问题的要求。

SELECT ?item ?itemLabel
WHERE {
  ?item wdt:P31 wd:Q5 .
  ?item wdt:P166 wd:Q103916 .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

LIMIT 1000

这就是我所拥有的,我正在努力开始工作,但尚未开始工作。我对此很陌生,非常感谢任何帮助。 更新了下面的查询,因为我已经更接近了

SELECT ?item ?itemLabel (COUNT (DISTINCT ?year) AS ?count)
WHERE {
  ?item wdt:P31 wd:Q5 .
  ?item wdt:P166 wd:Q103916 .
  ?item p:P585 ?year .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?item ?itemLabel
ORDER BY ?count
LIMIT 100

I'm using SPARQL and Wikidata query service to try and determine: The actors that got the Oscar award sorted by the total number of (any) awards they received in decreasing order with the list of all their awards.

So far this is what I have that works but doesn't quite do what the question is asking.

SELECT ?item ?itemLabel
WHERE {
  ?item wdt:P31 wd:Q5 .
  ?item wdt:P166 wd:Q103916 .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

LIMIT 1000

And this I what I have that I am trying to get to work but is not yet working. Im new to this and any help is appreciated. Updated below query because I've gotten a bit closer

SELECT ?item ?itemLabel (COUNT (DISTINCT ?year) AS ?count)
WHERE {
  ?item wdt:P31 wd:Q5 .
  ?item wdt:P166 wd:Q103916 .
  ?item p:P585 ?year .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?item ?itemLabel
ORDER BY ?count
LIMIT 100

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文