最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

wikidata - How to use query_wikidata() (function available in WikidataR package for R) with multiple QIDs to obtain some of thei

programmeradmin1浏览0评论

I am trying to make a wikidata query using WikidataR package for R. My query shoud have the following results :

for each item of a list of wikidata elements (such as Q124988842, Q125696676, Q130644039) get the property P189 (country of discovery)

I have written the script below:

library(WikidataR)

q_list <- c("Q124988842" ,"Q125696676", "Q130644039") 

qid_list <- c(paste0("wd:",q_list, collapse = " "))


query_sparql <- paste0("SELECT
  ?item ?country
WHERE {", qid_list,"}
 OPTIONAL { ?item wdt:P189 ?locationOfDiscovery. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language 'en'. }
}")
print(query_sparql)

results <- query_wikidata(query_sparql)
print(results)

and get this error message:

Erreur dans FUN(X[[i]], ...) : Bad Request (HTTP 400).

What is going wrong?

I have tried to put all my QID in a list and then my insert my list inside the query, but the query seems to be invalid.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论