markrobinsonuzh/os_monitor

Add Wikidata identifier support

Opened this issue · 3 comments

egonw commented

Wikidata (see https://scholia.toolforge.org/topic/Q2013) has many scholarly profiles (for notable researchers) but importantly identifiers on the platforms you already use including ORCID, GScholar, and Publons. For example, my Wikidata ID is Q20895241 (BTW, you can use the ORCID to look up people in Wikidata with Scholia: http://scholia.toolforge.org/orcid/0000-0001-7542-0286), and I can list my other accounts with this SPARQL query at https://query.wikidata.org/:

SELECT ?author ?orcid ?researcherid ?scholar WHERE {
  VALUES ?author { wd:Q20895241 }
  OPTIONAL { ?author wdt:P496 ?orcid }
  OPTIONAL { ?author wdt:P1053 ?researcherid }
  OPTIONAL { ?author wdt:P1960 ?scholar }
}

The matching R code would be something like this (note the "</> Code" button on that query page for other languages):

#http://www.r-bloggers.com/sparql-with-r-in-less-than-5-minutes/
library(SPARQL) # SPARQL querying package

endpoint <- "https://query.wikidata.org/sparql"
query <- 'SELECT ?author ?orcid ?researcherid ?scholar WHERE {\n  VALUES ?author { wd:Q20895241 }\n  OPTIONAL { ?author wdt:P496 ?orcid }\n  OPTIONAL { ?author wdt:P1053 ?researcherid }\n  OPTIONAL { ?author wdt:P1960 ?scholar }\n}'
useragent <- paste("https://pubassistant.ch/", R.version.string)

qd <- SPARQL(endpoint,query,curl_args=list(useragent=useragent))
df <- qd$results

Actually, you can use Wikidata as source for citations, see the Scholia paper: https://scholia.toolforge.org/work/Q41799194

Hi @egonw
Thanks for the input. Sounds like a very useful addition. We will check to see if and how it could be included in the app.

egonw commented

Happy to give pointers. BTW, this is the query to get the literature for an author:

SELECT DISTINCT ?author ?pubmed ?doi WHERE {
  VALUES ?author { wd:Q20895241 }
  ?author ^wdt:P50 ?article .
  OPTIONAL { ?article wdt:P698 ?pubmed }
  OPTIONAL { ?article wdt:P356 ?doi }
}

You can combine the two queries also to list DOIs and PubMed IDs for the ORCID of an author:

SELECT DISTINCT ?author ?pubmed ?doi WHERE {
  VALUES ?orcid { "0000-0001-7542-0286" }
  ?author ^wdt:P50 ?article ; wdt:P496 ?orcid .
  OPTIONAL { ?article wdt:P698 ?pubmed }
  OPTIONAL { ?article wdt:P356 ?doi }
}

The R code is pretty much the same as above. Just the query <- line changes :)

Great, thank you!