In this example, we search for three articles using their DOIs (P356), find their QIDs, download their full wikidata entries, and then extract the “main topics” (note PID didn’t have to be used).
First find the structured knowledge documents on Wikidata based on DOIs:
article.qid <- qid_from_DOI(c('10.15347/WJM/2017.007','10.15347/WJM/2019.001','10.15347/WJM/2019.007'))
#> Rows: 1 Columns: 1
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (1): value
#>
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> Rows: 1 Columns: 1
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (1): value
#>
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> Rows: 1 Columns: 1
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (1): value
#>
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
article.qid
#> 10.15347/WJM/2017.007 10.15347/WJM/2019.001 10.15347/WJM/2019.007
#> "Q43994531" "Q63740114" "Q75392964"Mass-retrieve the items from Wikidata:
article.q <- get_item(article.qid)
article.topics.p <- extract_claims(article.q, "main topic")
#> Inexact match for "main topic", closest match = main subject (P921).
get_names_from_properties(article.topics.p)
#> $`10.15347/WJM/2017.007`
#> # A tibble: 1 × 2
#> QID value
#> <chr> <chr>
#> 1 P921.Q164778 Rotavirus
#>
#> $`10.15347/WJM/2019.001`
#> # A tibble: 3 × 2
#> QID value
#> <chr> <chr>
#> 1 P921.Q15989108 Western African Ebola virus epidemic
#> 2 P921.Q10538943 Orthoebolavirus zairense
#> 3 P921.Q44512 epidemic
#>
#> $`10.15347/WJM/2019.007`
#> # A tibble: 6 × 2
#> QID value
#> <chr> <chr>
#> 1 P921.Q1820650 readability
#> 2 P921.Q16235120 health information on Wikipedia
#> 3 P921.Q52 Wikipedia
#> 4 P921.Q328 English Wikipedia
#> 5 P921.Q130731442 readability of Wikipedia
#> 6 P921.Q870337 Wikipedia as a subject of academic studies $`10.15347/WJM/2017.007`
# A tibble: 1 x 2
QID value
<chr> <chr>
1 P921.Q164778 rotavirus
$`10.15347/WJM/2019.001`
# A tibble: 2 x 2
QID value
<chr> <chr>
1 P921.Q15989108 Western African Ebola virus epidemic
2 P921.Q10538943 Ebola virus
$`10.15347/WJM/2019.007`
# A tibble: 2 x 2
QID value
<chr> <chr>
1 P921.Q1820650 readability
2 P921.Q16235120 health information on Wikipedia