1414# ' replaces the more general \code{equivalence_id}, because we must use QID
1515# ' for identification in an other Wikibase instance.
1616# ' @param qid_on_wikidata The QID of the item to be copied to your Wikibase. A
17- # ' single valid QID or a vector of several QIDs.
17+ # ' single valid QID or a vector of several QIDs.
1818# ' @param qid_equivalence_property The QID in Wikibase that records the
1919# ' equivalent Wikidata QID as an external ID.
20- # ' @param language A vector of language codes, for example, \code{c("en",
21- # ' "et")}.
20+ # ' @param language Defaults to \code{c("en", "nl", "hu")}. A character string of
21+ # ' the languages in which the users wants to receive the labels and
22+ # ' descriptions of the property. The vector of languages must use \href{https://en.wikipedia.org/wiki/IETF_language_tag}{BCP
23+ # ' 47}-compliant language tags (e.g., "en" for English, "nl" for Dutch and "hu"
24+ # ' for Hungarian.)
2225# ' @param classification_property The instance of, or subclass of, or superclass
2326# ' of property. Defaults to \code{NA_character} when not used.
2427# ' @param classification_id The QID of the class. Defaults to
2528# ' \code{NA_character} when not used.
26- # ' @param wikibase_api_url For example,
27- # ' \code{'https://reprexbase.eu/demowiki/api.php'}.
29+ # ' @param wikibase_api_url The full URL of the Wikibase API, which is the
30+ # ' address that the \code{wbdataset} R client sends requests to when
31+ # ' interacting with the knowledge base. For example,
32+ # ' \code{'https://reprexbase.eu/demowiki/api.php'}. The URL must end with
33+ # ' api.php.
2834# ' @param data_curator The name of the data curator who runs the function and
29- # ' creates the log file, created with \link[utils]{person}.
30- # ' @param log_path A path to save the log file. Defaults to the return value of
31- # ' \code{\link{tempdir()}}.
32- # ' @param log_file An explicitly stated full path to a possible CSV log file,
33- # ' defaults to \code{NULL}. If the value is \code{NULL}, no log file will be
34- # ' created.
35+ # ' creates the log file, created with \link[utils]{person}.
36+ # ' @param log_file_name An explicitly stated full path to a possible CSV log
37+ # ' file, defaults to \code{NULL}. If the value is \code{NULL}, no log file
38+ # ' will be created.
3539# ' @param csrf The CSRF token of your session, received with
3640# ' \code{\link{get_csrf}}.
3741# ' @param wikibase_session An optional list that contains any of the values of
4044# ' \code{csrf} (for repeated use in a session.)
4145# ' @importFrom assertthat assert_that
4246# ' @importFrom utils person
43- # ' @return Returns a dataset_df object. The columns are:
44- # ' \itemize{
45- # ' \item{"rowid"}{ A row identifier. }
46- # ' \item{"action"}{ The create_item() function name. }
47- # ' \item{"id_on_target"}{ The new item identifier (QID) on the targeted Wikibase.}
48- # ' \item{"label"}{ The propery label}
49- # ' \item{"description"}{ The description label}
50- # ' \item{"language"}{ The language code of the label.}
51- # ' \item{"datatype"}{ The datatype of the property, for example, `string`}
52- # ' \item{"wikibase_api_url"}{ The MediaWiki API URL where the new property is created.}
53- # ' \item{"equivalence_property"}{ The PID that connects an equivalence ID to the property.}
54- # ' \item{"equivalence_id"}{ The ID of an equivalent property defined elsewhere.}
55- # ' \item{"classification_property"}{ The PID that connects the item to a superclass, or class.}
56- # ' \item{"classification_id"}{ The QID of a class, subclass or superclass.}
57- # ' \item{"success"}{ TRUE if successfully created, FALSE if there was an error.}
58- # ' \item{"comment"}{ A summary of the error messages(s), if success is FALSE.}
59- # ' \item{"time"}{ The time when the action started.}
60- # ' \item{"logfile"}{ The name of the CSV logfile.}
47+ # ' @return Returns a \code{\link[dataset]{dataset_df}} object.
48+ # ' The columns are:\cr
49+ # ' \describe{
50+ # ' \item{\code{rowid}}{A row identifier. }
51+ # ' \item{\code{action}}{\code{copy_wikidata_item}}
52+ # ' \item{\code{id_on_target}}{The new item identifier (QID) on the targeted Wikibase.}
53+ # ' \item{\code{label}}{The propery label}
54+ # ' \item{\code{description}}{The description label}
55+ # ' \item{\code{language}}{The language code of the label.}
56+ # ' \item{\code{datatype}}{The datatype of the property, for example, `string`}
57+ # ' \item{\code{wikibase_api_url}}{The MediaWiki API URL where the new property is created.}
58+ # ' \item{\code{equivalence_property}}{The PID that connects an equivalence ID to the property.}
59+ # ' \item{\code{equivalence_id}}{The ID of an equivalent property defined elsewhere.}
60+ # ' \item{\code{classification_property}}{The PID that connects the item to a superclass, or class.}
61+ # ' \item{\code{classification_id}}{The QID of a class, subclass or superclass.}
62+ # ' \item{\code{success}}{TRUE if successfully created, FALSE if there was an error.}
63+ # ' \item{\code{comment}}{A summary of the error messages(s), if success is FALSE.}
64+ # ' \item{\code{time}}{The time when the action started.}
65+ # ' \item{\code{logfile}}{The name of the CSV logfile.}
6166# ' }
6267# ' The number of rows corresponds to the length of the qid_on_wikidata vector.
6368# ' @export
@@ -70,7 +75,6 @@ copy_wikidata_item <- function(
7075 classification_id = NA_character_ ,
7176 wikibase_api_url = " https://reprexbase.eu/jekyll/api.php" ,
7277 data_curator = NULL ,
73- log_path = tempdir(),
7478 log_file_name = NULL ,
7579 csrf ,
7680 wikibase_session = NULL ) {
@@ -99,10 +103,6 @@ copy_wikidata_item <- function(
99103 wikibase_api_url <- wikibase_session $ wikibase_api_url
100104 }
101105
102- if (! is.null(wikibase_session $ log_path )) {
103- log_path <- wikibase_session $ log_path
104- }
105-
106106 if (! is.null(wikibase_session $ log_file_name )) {
107107 log_file_name <- wikibase_session $ log_file_name
108108 }
@@ -115,7 +115,6 @@ copy_wikidata_item <- function(
115115 # Assertions for correct inputs ------------------------------------------------
116116
117117 if (is.null(data_curator )) data_curator <- person(" Jane" , " Doe" )
118- if (is.null(log_path )) log_path <- tempdir()
119118
120119 assertthat :: assert_that(
121120 inherits(data_curator , " person" ),
@@ -133,7 +132,6 @@ copy_wikidata_item <- function(
133132 language = language ,
134133 wikibase_api_url = wikibase_api_url ,
135134 data_curator = data_curator ,
136- log_path = log_path ,
137135 csrf = csrf ,
138136 wikibase_session = wikibase_session
139137 )
@@ -251,7 +249,6 @@ copy_wikidata_item <- function(
251249 action = " copy_item" ,
252250 search_term = default_label ,
253251 language = " en" ,
254- action_timestamp = action_timestamp ,
255252 equivalence_property = qid_equivalence_property ,
256253 equivalence_id = qid_on_wikidata ,
257254 classification_property = classification_property ,
@@ -572,7 +569,6 @@ copy_wikidata_items <- function(qid_on_wikidata,
572569 language ,
573570 wikibase_api_url ,
574571 data_curator ,
575- log_path ,
576572 csrf ,
577573 wikibase_session ) {
578574 # Ensure that QIDs are used in the loop ----------------------------
@@ -605,10 +601,6 @@ copy_wikidata_items <- function(qid_on_wikidata,
605601 wikibase_api_url <- wikibase_session $ wikibase_api_url
606602 }
607603
608- if (! is.null(wikibase_session $ log_path )) {
609- log_path <- wikibase_session $ log_path
610- }
611-
612604 if (! is.null(wikibase_session $ csrf )) {
613605 csrf <- wikibase_session $ csrf
614606 }
@@ -624,7 +616,6 @@ copy_wikidata_items <- function(qid_on_wikidata,
624616 language = language ,
625617 wikibase_api_url = wikibase_api_url ,
626618 data_curator = data_curator ,
627- log_path = log_path ,
628619 csrf = csrf
629620 )
630621 }
0 commit comments