Copy a Wikidata item(s)
Source:R/copy_wikidata_item.R
, R/copy_wikidata_property.R
copy_wikidata_item.Rd
This code will copy (an) item label(s) and description(s) from Wikidata to a new instance. It should work between instances, but the authentication to copy from a password protected instance is not yet coded. The function is more specific than create_item, because this one creates items that exist in a similarly structured Wikibase instance, such as Wikidata.
Usage
copy_wikidata_item(
qid_on_wikidata = "Q4",
qid_equivalence_property = "P35",
language = c("en", "nl", "hu"),
classification_property = NA_character_,
classification_id = NA_character_,
wikibase_api_url = "https://reprexbase.eu/jekyll/api.php",
data_curator = NULL,
log_file_name = NULL,
csrf,
wikibase_session = NULL
)
copy_wikidata_items(
qid_on_wikidata,
qid_equivalence_property,
classification_property,
classification_id,
language,
wikibase_api_url,
data_curator,
csrf,
wikibase_session
)
copy_wikidata_properties(
pid_on_wikidata,
pid_equivalence_property,
language,
wikibase_api_url,
data_curator,
csrf,
wikibase_session = NULL
)
Arguments
- qid_on_wikidata
The QID of the item to be copied to your Wikibase. A single valid QID or a vector of several QIDs.
- qid_equivalence_property
The QID in Wikibase that records the equivalent Wikidata QID as an external ID.
- language
Defaults to
c("en", "nl", "hu")
. A character string of the languages in which the users wants to receive the labels and descriptions of the property. The vector of languages must use BCP 47-compliant language tags (e.g., "en" for English, "nl" for Dutch and "hu" for Hungarian.)- classification_property
The instance of, or subclass of, or superclass of property. Defaults to
NA_character
when not used.- classification_id
The QID of the class. Defaults to
NA_character
when not used.- wikibase_api_url
The full URL of the Wikibase API, which is the address that the
wbdataset
R client sends requests to when interacting with the knowledge base. For example,'https://reprexbase.eu/demowiki/api.php'
. The URL must end with api.php.- data_curator
The name of the data curator who runs the function and creates the log file, created with person.
- log_file_name
An explicitly stated full path to a possible CSV log file, defaults to
NULL
. If the value isNULL
, no log file will be created.- csrf
The CSRF token of your session, received with
get_csrf
.- wikibase_session
An optional list that contains any of the values of parameters
qid_equivalence_property
,language
,wikibase_api_url
,data_curator
,log_path
andcsrf
(for repeated use in a session.)
Value
Returns a dataset_df
object.
The columns are:
rowid
A row identifier.
action
copy_wikidata_item
id_on_target
The new item identifier (QID) on the targeted Wikibase.
label
The propery label
description
The description label
language
The language code of the label.
datatype
The datatype of the property, for example,
string
wikibase_api_url
The MediaWiki API URL where the new property is created.
equivalence_property
The PID that connects an equivalence ID to the property.
equivalence_id
The ID of an equivalent property defined elsewhere.
classification_property
The PID that connects the item to a superclass, or class.
classification_id
The QID of a class, subclass or superclass.
success
TRUE if successfully created, FALSE if there was an error.
comment
A summary of the error messages(s), if success is FALSE.
time
The time when the action started.
logfile
The name of the CSV logfile.
The number of rows corresponds to the length of the qid_on_wikidata vector.
Details
This function is slightly different from create_item. That function
creates a new item that may not have an equivalent item on another Wikibase
instance, but it may well have an equivalent item in another database.
In this function, we use qid_equivalence_property
for equivalence.
In the more general create function we use equivalence_item
, because
we may use different identifiers. Similarly, the qid_on_wikidata
replaces the more general equivalence_id
, because we must use QID
for identification in an other Wikibase instance.