spq_filter | R Documentation |
Filters results by adding conditions
spq_filter(
.query = NULL,
...,
.label = NA,
.within_box = c(NA, NA),
.within_distance = c(NA, NA)
)
.query |
a list with elements of the query |
... |
variables by which to arrange
(or SPARQL strings escaped with |
.label |
|
.within_box |
if provided, rectangular bounding box for the triple query. Provided as list(southwest=c(long=...,lat=...),northeast=c(long=...,lat=...)) |
.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. |
A query object
spq_init() %>% spq_filter(item == wdt::P31(wd::Q13442814)) # Lexemes in English that match an expression # here starting with "pota" query <- spq_init() |> spq_prefix(prefixes = c(dct = "http://purl.org/dc/terms/")) |> spq_add(spq('?lexemeId dct:language wd:Q1860')) |> spq_mutate(lemma = wikibase::lemma(lexemeId)) |> spq_filter(str_detect(lemma, '^pota.*')) |> spq_select(lexemeId, lemma)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.