This code will copy one or multiple property 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_property
, because this one creates properties that
exist in a similarly structured Wikibase instance, such as Wikidata.
Usage
copy_wikidata_property(
pid_on_wikidata,
pid_equivalence_property = "P2",
language = c("en", "hu"),
wikibase_api_url = "https://reprexbase.eu/jekyll/api.php",
classification_property = NA_character_,
classification_id = NA_character_,
data_curator = NULL,
log_file_name = NULL,
csrf,
wikibase_session = NULL
)
Arguments
- pid_on_wikidata
The PID of the property on Wikidata to be copied to your Wikibase.It can be one or more valid PIDs. (Only works with non-authenticated sources, this should be changed.)
- pid_equivalence_property
The PID in Wikibase that records the equivalent Wikidata PID 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, and "hu" for Hungarian.)- 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.- 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.- 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
, andcsrf
(for repeated use in a session.)
Value
Returns a dataset_df
object. The columns
are:
rowid
A row identifier.
action
The
copy_wikidata_property
function name.id_on_target
The new Property Identifier (PID) 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
Not applicable for properties.
classification_id
Not applicable for properties.
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_property
. That function creates a new property that
may not have an equivalent property on another Wikibase instance, but it
may well have an equivalent property in another graph system.
In this
function, we use pid_equivalence_property
for equivalence. In the
more general create function we use equivalence_property
, because we
may use different identifiers. Similarly, the pid_on_wikidata
replaces the more general equivalence_id
, because we must use PID
for identification in an other Wikibase instance.