From e40333599f21960dd1d45b39eceff891aa743605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Thu, 19 Oct 2023 11:15:33 +0200 Subject: [PATCH] run document() --- man/spq_add.Rd | 21 ++++++++++++++------- man/spq_arrange.Rd | 3 ++- man/spq_filter.Rd | 6 ++++-- man/spq_label.Rd | 6 ++++-- man/spq_language.Rd | 3 ++- man/spq_mutate.Rd | 9 ++++++--- man/spq_perform.Rd | 30 ++++++++++++++++++++---------- man/spq_select.Rd | 3 ++- man/spq_tally.Rd | 4 ++-- 9 files changed, 56 insertions(+), 29 deletions(-) diff --git a/man/spq_add.Rd b/man/spq_add.Rd index 303843c0..ab1b89dd 100644 --- a/man/spq_add.Rd +++ b/man/spq_add.Rd @@ -21,18 +21,23 @@ spq_add( \arguments{ \item{.query}{query} -\item{.triple_pattern}{the triple pattern statement (replaces arguments subject verb and object)} +\item{.triple_pattern}{the triple pattern statement +(replaces arguments subject verb and object)} -\item{.subject}{an anonymous variable (for instance, and by default, "?subject") or item (for instance "wd:Q456"))} +\item{.subject}{an anonymous variable +(for instance, and by default, "?subject") or item (for instance "wd:Q456"))} \item{.verb}{the property (for instance "wdt:P190")} -\item{.object}{an anonymous variable (for instance, and by default, "?object") or item (for instance "wd:Q456"))} +\item{.object}{an anonymous variable (for instance, +and by default, "?object") or item (for instance "wd:Q456"))} \item{.prefixes}{Custom prefixes} -\item{.required}{whether the existence of a value for the triple is required or not (defaults to TRUE). -If set to FALSE, then other triples in the query are returned even if this particular triple is missing)} +\item{.required}{whether the existence of a value for the triple is required +or not (defaults to TRUE). +If set to FALSE, then other triples in the query are returned even +if this particular triple is missing)} \item{.label}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} See \code{\link[=spq_label]{spq_label()}}.} @@ -40,8 +45,10 @@ If set to FALSE, then other triples in the query are returned even if this parti Provided as list(southwest=c(long=...,lat=...),northeast=c(long=...,lat=...))} \item{.within_distance}{if provided, circular bounding box for the triple query. -Provided as list(center=c(long=...,lat=...), radius=...), with radius in kilometers. -The center can also be provided as a variable (for instance, "?location") for the center coordinates to be retrieved directly from the query.} +Provided as list(center=c(long=...,lat=...), radius=...), +with radius in kilometers. +The center can also be provided as a variable (for instance, "?location") +for the center coordinates to be retrieved directly from the query.} \item{.filter}{Filter for the triple. Only use this with \code{.required=FALSE}} } diff --git a/man/spq_arrange.Rd b/man/spq_arrange.Rd index 9da21108..49c3443c 100644 --- a/man/spq_arrange.Rd +++ b/man/spq_arrange.Rd @@ -30,7 +30,8 @@ spq_init() \%>\% spq_arrange(desc(length), item_label) \%>\% spq_head(50) -# descending length, ascending item_label, "R" syntax with quotes e.g. for a loop +# descending length, ascending item_label, +# "R" syntax with quotes e.g. for a loop variable = "length" spq_init() \%>\% spq_add("?item wdt:P31/wdt:P279* wd:Q4022") \%>\% diff --git a/man/spq_filter.Rd b/man/spq_filter.Rd index ece62b5c..3ac20cb6 100644 --- a/man/spq_filter.Rd +++ b/man/spq_filter.Rd @@ -24,8 +24,10 @@ spq_filter( Provided as list(southwest=c(long=...,lat=...),northeast=c(long=...,lat=...))} \item{.within_distance}{if provided, circular bounding box for the triple query. -Provided as list(center=c(long=...,lat=...), radius=...), with radius in kilometers. -The center can also be provided as a variable (for instance, "?location") for the center coordinates to be retrieved directly from the query.} +Provided as list(center=c(long=...,lat=...), radius=...), +with radius in kilometers. +The center can also be provided as a variable (for instance, "?location") +for the center coordinates to be retrieved directly from the query.} } \value{ A query object diff --git a/man/spq_label.Rd b/man/spq_label.Rd index f17da350..c4deb690 100644 --- a/man/spq_label.Rd +++ b/man/spq_label.Rd @@ -18,8 +18,10 @@ spq_label( \item{...}{variables by which to arrange (or SPARQL strings escaped with \code{spq()}, or strings, see examples)} -\item{.required}{whether the existence of a value for the triple is required or not (defaults to TRUE). -If set to FALSE, then other triples in the query are returned even if this particular triple is missing)} +\item{.required}{whether the existence of a value for the triple is required +or not (defaults to TRUE). +If set to FALSE, then other triples in the query are returned even +if this particular triple is missing)} \item{.languages}{Languages for which to query labels. Use \code{NULL} for removing restrictions on language (defined or not), \code{"*"} for any defined language. diff --git a/man/spq_language.Rd b/man/spq_language.Rd index f9ba9497..7ce7d8c1 100644 --- a/man/spq_language.Rd +++ b/man/spq_language.Rd @@ -9,7 +9,8 @@ spq_language(.query = NULL, language = "en") \arguments{ \item{.query}{the query} -\item{language}{the language in which the labels will be provided (defaults to "en" for English). See complete list of Wikimedia language codes \href{https://www.wikidata.org/wiki/Help:Wikimedia_language_codes/lists/all}{here}. You can also set language to "auto" and then the Wikidata SPARQL engine will try and detect your language automatically. Specifying several languages will return labels with languages following the priority specified (e.g. with language="fr,en", the label will be returned preferentially in French, or, if there is not French label for the item, in English).} +\item{language}{the language in which the labels will be provided +(defaults to "en" for English). See \href{https://www.wikidata.org/wiki/Help:Wikimedia_language_codes/lists/all}{complete list of Wikimedia language codes}. You can also set language to "auto" and then the Wikidata SPARQL engine will try and detect your language automatically. Specifying several languages will return labels with languages following the priority specified (e.g. with language="fr,en", the label will be returned preferentially in French, or, if there is not French label for the item, in English).} } \value{ A query object diff --git a/man/spq_mutate.Rd b/man/spq_mutate.Rd index dbc321a8..1fa5efaa 100644 --- a/man/spq_mutate.Rd +++ b/man/spq_mutate.Rd @@ -24,8 +24,10 @@ spq_mutate( Provided as list(southwest=c(long=...,lat=...),northeast=c(long=...,lat=...))} \item{.within_distance}{if provided, circular bounding box for the triple query. -Provided as list(center=c(long=...,lat=...), radius=...), with radius in kilometers. -The center can also be provided as a variable (for instance, "?location") for the center coordinates to be retrieved directly from the query.} +Provided as list(center=c(long=...,lat=...), radius=...), +with radius in kilometers. +The center can also be provided as a variable (for instance, "?location") +for the center coordinates to be retrieved directly from the query.} } \value{ A query object @@ -37,7 +39,8 @@ Create and modify variables in the results \if{html}{\out{
}}\preformatted{# common name of a plant species in different languages -# the triplet pattern "wd:Q331676 wdt:P1843 ?statement" creates the variable statement +# the triplet pattern "wd:Q331676 wdt:P1843 ?statement" +# creates the variable statement # hence our writing it in reverse within the spq_mutate() function spq_init() \%>\% spq_mutate(statement = wdt::P1843(wd::Q331676)) \%>\% diff --git a/man/spq_perform.Rd b/man/spq_perform.Rd index 087d7f38..7b8ea9f2 100644 --- a/man/spq_perform.Rd +++ b/man/spq_perform.Rd @@ -2,7 +2,8 @@ % Please edit documentation in R/spq_perform.R \name{spq_perform} \alias{spq_perform} -\title{Assemble query parts into a sparql query and send it to endpoint to get a tibble as a result.} +\title{Assemble query parts into a sparql query and send it to endpoint +to get a tibble as a result.} \usage{ spq_perform( .query, @@ -19,29 +20,38 @@ spq_perform( \arguments{ \item{.query}{a list with elements of the query} -\item{endpoint}{a string or url corresponding to a SPARQL endpoint. Defaults to "Wikidata"} +\item{endpoint}{a string or url corresponding to a SPARQL endpoint. +Defaults to "Wikidata"} -\item{user_agent}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} a string indicating the user agent to send with the query.} +\item{user_agent}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} a string indicating +the user agent to send with the query.} -\item{max_tries, max_seconds}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Cap the maximal number of -attemps with \code{max_tries} or the total elapsed time from the first request with \code{max_seconds}.} +\item{max_tries, max_seconds}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} +Cap the maximal number of +attemps with \code{max_tries} or the total elapsed time from the first request +with \code{max_seconds}.} -\item{timeout}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} maximum number of seconds to wait (\code{httr2::req_timeout()}).} +\item{timeout}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} maximum number of seconds +to wait (\code{httr2::req_timeout()}).} -\item{request_type}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} a string indicating how the query should be sent: in the +\item{request_type}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} a string indicating +how the query should be sent: in the URL (\code{url}, default, most common) or as a body form (\code{body-form}).} -\item{dry_run}{Boolean indicating whether to return the output of \code{httr2::req_dry_run()} +\item{dry_run}{Boolean indicating whether to return the output of +\code{httr2::req_dry_run()} rather than of \code{httr2::req_perform()}. Useful for debugging.} -\item{replace_prefixes}{Boolean indicating whether to replace used prefixes in the results table, +\item{replace_prefixes}{Boolean indicating whether to replace used +prefixes in the results table, for instance making, for instance "http://www.wikidata.org/entity/" "wd:".} } \value{ A query object } \description{ -Assemble query parts into a sparql query and send it to endpoint to get a tibble as a result. +Assemble query parts into a sparql query and send it to endpoint +to get a tibble as a result. } \section{Request control}{ diff --git a/man/spq_select.Rd b/man/spq_select.Rd index 0aea01ae..c1d23c34 100644 --- a/man/spq_select.Rd +++ b/man/spq_select.Rd @@ -12,7 +12,8 @@ spq_select(.query = NULL, ..., .spq_duplicate = NULL) \item{...}{variables by which to arrange (or SPARQL strings escaped with \code{spq()}, or strings, see examples)} -\item{.spq_duplicate}{How to handle duplicates: keep them (\code{NULL}), eliminate (\code{distinct}) +\item{.spq_duplicate}{How to handle duplicates: keep them (\code{NULL}), +eliminate (\code{distinct}) or reduce them (\code{reduced}, advanced usage).} } \value{ diff --git a/man/spq_tally.Rd b/man/spq_tally.Rd index 6def50ca..df7227f4 100644 --- a/man/spq_tally.Rd +++ b/man/spq_tally.Rd @@ -12,8 +12,8 @@ spq_count(.query, ..., sort = FALSE, name = "n") \arguments{ \item{.query}{a list with elements of the query} -\item{sort}{If \code{TRUE}, will show the largest groups at the top. (like the \code{sort} argument -of \code{dplyr::tally()})} +\item{sort}{If \code{TRUE}, will show the largest groups at the top. +(like the \code{sort} argument of \code{dplyr::tally()})} \item{name}{Name for the count column (like the \code{name} argument of \code{dplyr::tally()})}