This function does not cache results.
tw_get_all_with_p(
p,
fields = c("item", "itemLabel", "itemDescription"),
language = tidywikidatar::tw_get_language(),
method = "SPARQL",
wait = 0.1,
limit = Inf,
return_as_tw_search = TRUE,
user_agent = tidywikidatar::tw_get_user_agent()
)A data frame with three columns is method is set to "SPARQL", or as
many columns as fields if more are given and return_as_tw_search is set
to FALSE. A single column with Wikidata identifier if method is set to
"JSON".
A character vector, a property. Must always start with the capital letter "P", e.g. "P31" for "instance of".
A character vector of Wikidata fields. Ignored if
return_as_tw_search is set to TRUE (as per default). Defaults to
("item", "itemLabel", "itemDescription")
Defaults to language set with tw_set_language(); if not
set, "en". If more than one, can be set in order of preference, e.g.
c("it", "fr", "en"). Use "all_available" to keep all languages. For
available language values, see the
list
of available language codes in the official documentation.
Defaults to "SPARQL". The only accepted alternative value is "JSON", to use instead json-based API.
Defaults to 0.1. Used only in method is set to "JSON".
Defaults to Inf. Set to smaller values for testing and cache
locally when possible to reduce load on servers.
Logical, defaults to TRUE. If TRUE, returns a
data frame with three columns (id, label, and description) that can
be piped to other tw_ functions. If FALSE, a data frame with as many
columns as fields.
Defaults to a combination of tidywikidatar and package
version number. Consider customising it for the current sessions with
tw_set_user_agent(), in particular if you are making many queries.
if (interactive()) {
# get all Wikidata items with an ICAO airport code ("P239")
tw_get_all_with_p(p = "P239", limit = 10)
}
Run the code above in your browser using DataLab