Get triplets with subject verb object.

get_triplets(
  subject = "?subject",
  verb = "?verb",
  object = "?object",
  optional = FALSE,
  label = NA,
  limit = NA,
  within_box = c(NA, NA),
  within_distance = c(NA, NA),
  track = NA
)

Arguments

subject

an anonymous variable (for instance, and by default, "?subject") or item (for instance "Q456"))

verb

the property (for instance "wdt:P190")

object

an anonymous variable (for instance, and by default, "?object") or item (for instance "Q456"))

label

a vector of variables for which to include a label column (defaults to NA)

limit

the max number of items sent back

within_box

if provided, rectangular bounding box for the triplet query. Provided as list(southwest=c(long=...,lat=...),northeast=c(long=...,lat=...))

within_distance

if provided, circular bounding box for the triplet 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.

track

element to add as a column in result to track which item the information refers to

Examples

get_triplets(subject="?city",verb="wdt:P31/wdt:P279*",object="wd:Q515", label=c("?city"), limit=10)
#> # A tibble: 10 x 2 #> city cityLabel #> <chr> <chr> #> 1 http://www.wikidata.org/entity/Q309436 Ksar of Aït Benhaddou #> 2 http://www.wikidata.org/entity/Q817274 Beni Isguen #> 3 http://www.wikidata.org/entity/Q2670896 Ksar Ouled Soltane #> 4 http://www.wikidata.org/entity/Q3200131 Ksar Ifegh #> 5 http://www.wikidata.org/entity/Q3200135 Ksar of Lamaarka #> 6 http://www.wikidata.org/entity/Q3818705 Ksar Nalut #> 7 http://www.wikidata.org/entity/Q11736787 Ksar Hallouf #> 8 http://www.wikidata.org/entity/Q12233025 Ksar Beni Barka #> 9 http://www.wikidata.org/entity/Q16593169 Ksar of Taourirt #> 10 http://www.wikidata.org/entity/Q21029712 Ksar of Rgabi N'Ait Hassou
get_triplets(subject="wd:Q355",verb="wdt:P625",object="?coords")
#> NULL
get_triplets(subject="wd:Q355",verb="wdt:P625",object="?coords", track="subject")
#> # A tibble: 1 x 1 #> tracking #> <chr> #> 1 wd:Q355