Closed cmdoret closed 1 year ago
@cmdoret for that endpoint you need to use the request_type = "body-form"
argument of https://lvaudor.github.io/glitter/reference/spq_perform.html
We added it especially for this endpoint after another user tried it. :grin:
library("glitter")
spq_init() %>%
spq_add("?s ?p ?o") %>%
spq_head(n=10) %>%
spq_perform(endpoint="https://ld.admin.ch/query", request_type = "body-form")
#> # A tibble: 10 × 3
#> p s o
#> <chr> <chr> <chr>
#> 1 https://gont.ch/canton https://lod.opentransportdata.swiss/didok/85016… http…
#> 2 https://gont.ch/canton https://lod.opentransportdata.swiss/didok/85019… http…
#> 3 https://gont.ch/canton https://lod.opentransportdata.swiss/didok/85016… http…
#> 4 https://gont.ch/canton https://lod.opentransportdata.swiss/didok/85194… http…
#> 5 https://gont.ch/canton https://lod.opentransportdata.swiss/didok/85055… http…
#> 6 https://gont.ch/canton https://lod.opentransportdata.swiss/didok/85055… http…
#> 7 https://gont.ch/canton https://lod.opentransportdata.swiss/didok/85055… http…
#> 8 https://gont.ch/canton https://lod.opentransportdata.swiss/didok/85055… http…
#> 9 https://gont.ch/canton https://lod.opentransportdata.swiss/didok/85055… http…
#> 10 https://gont.ch/canton https://lod.opentransportdata.swiss/didok/85181… http…
Created on 2023-07-19 with reprex v2.0.2
Thank you!! I saw this argument but did not connect the dots with the error message :sweat_smile:
Thank you for using glitter, which is a package still in progress. :smile_cat:
@cmdoret for info the syntax changed slightly, see example below
library("glitter")
spq_init(
endpoint ="https://ld.admin.ch/query",
request_control = spq_control_request(request_type = "body-form")
) %>%
spq_add("?s ?p ?o") %>%
spq_head(n = 10) %>%
spq_perform()
#> # A tibble: 10 × 3
#> p s o
#> <chr> <chr> <chr>
#> 1 https://gont.ch/canton https://lod.opentransportdata.swiss/didok/85016… http…
#> 2 https://gont.ch/canton https://lod.opentransportdata.swiss/didok/85019… http…
#> 3 https://gont.ch/canton https://lod.opentransportdata.swiss/didok/85016… http…
#> 4 https://gont.ch/canton https://lod.opentransportdata.swiss/didok/85194… http…
#> 5 https://gont.ch/canton https://lod.opentransportdata.swiss/didok/85055… http…
#> 6 https://gont.ch/canton https://lod.opentransportdata.swiss/didok/85055… http…
#> 7 https://gont.ch/canton https://lod.opentransportdata.swiss/didok/85055… http…
#> 8 https://gont.ch/canton https://lod.opentransportdata.swiss/didok/85055… http…
#> 9 https://gont.ch/canton https://lod.opentransportdata.swiss/didok/85055… http…
#> 10 https://gont.ch/canton https://lod.opentransportdata.swiss/didok/85181… http…
Created on 2023-09-21 with reprex v2.0.2
Glitter looks awesome and I wanted to try it out on the SPARQL endpoint of the Swiss government. As far as I know, it uses triply / YASGUI and I can run the following query via curl:
When trying to run an equivalent query with glitter, I get:
Click for full trace
``` ▆ 1. ├─... %>% spq_perform(endpoint = "https://ld.admin.ch/query") 2. └─glitter::spq_perform(., endpoint = "https://ld.admin.ch/query") 3. └─glitter::send_sparql(...) 4. └─rlang::abort("Not right response type") ```When trying to
spq_perform
the query directly, I get:Click for full trace
``` --- ▆ 1. ├─glitter::spq_perform("SELECT * WHERE {?s ?p ?o } LIMIT 10", endpoint = "https://ld.admin.ch/query") 2. │ └─glitter::spq_assemble(.query = .query, endpoint = endpoint) 3. │ └─glitter::spq_prefix(.query, auto = TRUE, prefixes = NULL) 4. │ └─... %>% dplyr::filter(.data$type != "Wikidata") 5. ├─dplyr::filter(., .data$type != "Wikidata") 6. ├─dplyr::filter(., .data$name %in% .query[["prefixes_used"]]) 7. ├─dplyr:::filter.data.frame(., .data$name %in% .query[["prefixes_used"]]) 8. │ └─dplyr:::filter_rows(.data, dots, by) 9. │ └─dplyr:::filter_eval(...) 10. │ ├─base::withCallingHandlers(...) 11. │ └─mask$eval_all_filter(dots, env_filter) 12. │ └─dplyr (local) eval() 13. ├─.data$name %in% .query[["prefixes_used"]] 14. └─base::.handleSimpleError(`Am I using glitter wrong, or is there some incompatibility between glitter and some SPARQL endpoints causing this issue?
System information: