Swirrl / cubiql

CubiQL: A GraphQL service for querying multidimensional Linked Data Cubes
Eclipse Public License 1.0
41 stars 2 forks source link

official tutorial steps leave response as string #115

Closed bjornrud closed 2 years ago

bjornrud commented 6 years ago

After following the official(?) tutorial steps... https://github.com/Swirrl/graphql-qb/wiki/Querying-a-GraphQL-client-for-linked-data-using-R

It appears the GraphqlClient is just passing the response straight back as a character vector, unstructured and unparseable for df <- as.data.frame(responses).

> responses
[1] "{\"data\":{\"datasets\":[{\"title\":\"Pupil Attainment\",\"description\":\"Number of pupils who attained a given number of qualifications by level and stage.\"},{\"title\":\"Earnings\",\"description\":\"Median gross weekly earnings (£s) by gender and workplace/residence measure. \"},{\"title\":\"Income Support Claimants\",\"description\":\"Number of income support claimants by age and gender (age split not available for gender).\"},{\"title\":\"Child Benefit\",\"description\":\"Geographical analysis of Child Benefit at small area levels. Number of children in a live Child Benefit award as at 31st August.\"},{\"title\":\"
...snip...

> glimpse(df)
Observations: 1
Variables: 1
$ responses <fct> {"data":{"datasets":[{"title":"Pupil Attainment","description":"Number of pupils who attained a given number of qualifications by l...

> str(responses)
 chr "{\"data\":{\"datasets\":[{\"title\":\"Pupil Attainment\",\"description\":\"Number of pupils who attained a give"| __truncated__

My session info is as follows:

> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] forcats_0.3.0   stringr_1.3.1   dplyr_0.7.6     purrr_0.2.5     readr_1.1.1     tidyr_0.8.1     tibble_1.4.2    ggplot2_3.0.0   tidyverse_1.2.1
[10] httr_1.3.1      jsonlite_1.5    ghql_0.0.4.9210 devtools_1.13.6

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.18     cellranger_1.1.0 pillar_1.3.0     compiler_3.5.1   git2r_0.23.0     plyr_1.8.4       bindr_0.1.1      tools_3.5.1     
 [9] digest_0.6.15    lubridate_1.7.4  memoise_1.1.0    nlme_3.1-137     gtable_0.2.0     lattice_0.20-35  pkgconfig_2.0.1  rlang_0.2.1     
[17] cli_1.0.0        rstudioapi_0.7   curl_3.2         haven_1.1.2      bindrcpp_0.2.2   xml2_1.2.0       withr_2.1.2      hms_0.4.2       
[25] grid_3.5.1       tidyselect_0.2.4 glue_1.3.0       R6_2.2.2         readxl_1.1.0     modelr_0.1.2     magrittr_1.5     backports_1.1.2 
[33] scales_0.5.0     rvest_0.3.2      assertthat_0.2.0 colorspace_1.3-2 stringi_1.2.4    lazyeval_0.2.1   munsell_0.5.0    broom_0.5.0     
[41] crayon_1.3.4