Using a year's natural number value in a SPARQL query

梦想与她 提交于 2019-12-24 00:57:45

问题


How do I query wikidata for a list of scientists that died in a prime-numbered year, and also were born in a prime-numbered year, using SPARQL? Here is what I have so far, which returns no results, and I'm assuming that's because people don't die in a number, but rather in a year... Also missing is the UNION statement for those born in a prime-numbered year, but we can omit that for the sake of focus.

SELECT ?number ?scientist ?scientistLabel
WHERE
{
  ?number wdt:P31 wd:Q49008.
  ?scientist wdt:P106 wd:Q901.
  ?scientist wdt:P570 ?number
  SERVICE wikibase:label { bd:serviceParam wikibase:language " [AUTO_LANGUAGE].en". }
}
ORDER BY DESC(?number)

Here is the URL for this query entered into the Query Service: https://query.wikidata.org/#SELECT%20%3Fnumber%20%3Fperson%20%3FpersonLabel%0AWHERE%0A%7B%0A%20%20%3Fnumber%20wdt%3AP31%20wd%3AQ49008.%0A%20%20%3Fperson%20wdt%3AP106%20wd%3AQ901.%0A%20%20%3Fperson%20wdt%3AP570%20%3Fnumber%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D.en%22.%20%7D%0A%7D%0AORDER%20BY%20DESC%28%3Fnumber%29

来源:https://stackoverflow.com/questions/53086466/using-a-years-natural-number-value-in-a-sparql-query

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!