lvaudor / glitter

an R package which writes SPARQL queries
https://lvaudor.github.io/glitter
45 stars 5 forks source link

spq_select works with negative selection, not positive #200

Closed lvaudor closed 1 year ago

lvaudor commented 1 year ago

Hi, I just realized that spq_select() does work if we want NOT to get something, but does not if we DO want to get something.

For instance, this removes column station_label:

spq_init() %>% 
  spq_add("?station wdt:P16 wd:Q1552") %>% 
  spq_add("?station wdt:P31 wd:Q928830") %>%
  spq_add("?station wdt:P625 ?coords") %>% 
  spq_select(-station_label) %>% 
  spq_perform() 

But this does not select ONLY station_label:

spq_init() %>% 
  spq_add("?station wdt:P16 wd:Q1552") %>% 
  spq_add("?station wdt:P31 wd:Q928830") %>%
  spq_add("?station wdt:P625 ?coords") %>% 
  spq_select(station_label) %>% 
  spq_perform()