| write_wikidata {WikidataR} | R Documentation | 
Write statements to Wikidata
Description
Upload data to wikidata, including creating items, adding statements to existing items (via the quickstatements format and API).
Usage
write_wikidata(
  items,
  properties = NULL,
  values = NULL,
  qual.properties = NULL,
  qual.values = NULL,
  src.properties = NULL,
  src.values = NULL,
  remove = FALSE,
  format = "tibble",
  api.username = NULL,
  api.token = NULL,
  api.format = "v1",
  api.batchname = NULL,
  api.submit = TRUE
)
Arguments
| items | a vector of strings indicating the items to which to add statements (as QIDs or labels).
Note: if labels are provided, and multiple items match, the first matching item will be used
(see  | 
| properties | a vector of strings indicating the properties to add as statements (as PIDs or labels).
Note: if labels are provided, and multiple items match, the first matching item will be used
(see  | 
| values | a vector of strings indicating the values to add as statements (as QIDs or strings). Note: if strings are provided, they will be treated as plain text. | 
| qual.properties | a vector, data frame, or tibble of strings indicating the properties to add as qualifiers to statements (as PIDs or labels).
Note: if labels are provided, and multiple items match, the first matching item will be used
(see  | 
| qual.values | a vector, data frame, or tibble of strings indicating the values to add as statements (as QIDs or strings). Note: if strings are provided, they will be treated as plain text. | 
| src.properties | a vector, data frame, or tibble of strings indicating the properties to add as reference sources to statements (as SIDs or labels).
Note: if labels are provided, and multiple items match, the first matching item will be used
(see  | 
| src.values | a vector, data frame, or tibble of strings indicating the values to add reference sources to statements (as QIDs or strings). Note: if strings are provided, they will be treated as plain text. | 
| remove | a vector of boolians for each statemnt indicating whether it should be removed from the item rather than added (default = FALSE) | 
| format | output format as a string. Options include: 
 | 
| api.username | a string indicating your wikimedia username | 
| api.token | a string indicating your api token (the unique identifier that you can find listed at [your user page](https://quickstatements.toolforge.org/#/user)) | 
| api.format | a string indicateing which version of the quickstatement format used to submit the api (default = "v1") | 
| api.batchname | a string create a named batch (listed at [your batch history page](https://quickstatements.toolforge.org/#/batches)) and tag in the edit summaries | 
| api.submit | boolian indicating whether to submit instruction directly to wikidata (else returns the URL that can be copy-pasted into a web browser) | 
Value
data formatted to upload to wikidata (via quickstatemsnts),
optionally also directly uploded to wikidata (see format parameter).
Examples
# Add a statement to the "Wikidata sandbox" item (Q4115189)
# to say that it is an "instance of" (P31) of Q1 (the universe).
# The instruction will submit directly to wikidata via the API
# (if you include your wikimedia username and token)
write_wikidata(items        = "Wikidata Sandbox",
               properties   = "instance of",
               values       = "Q1",
               format       = "api",
               api.username = "myusername", 
               api.token    = , #REDACTED#
               )
#note: