Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for additional backends? #10

Open
cboettig opened this issue Jan 21, 2022 · 4 comments
Open

support for additional backends? #10

cboettig opened this issue Jan 21, 2022 · 4 comments

Comments

@cboettig
Copy link

Really nice package here, and love the clever name!

Just curious if you would have plans to allow glitter to send sparql queries to other backends? Though I haven't had a chance to explore more deeply, looks like the package examples use the {SPARQL} R package to query a handful of existing public triplestores over HTTP. I was just thinking R users might like to use this to query their own data as well, e.g. via triplestores created or connected via rdflib / redland or virtuoso wrappers.

@maelle
Copy link
Collaborator

maelle commented Feb 21, 2022

@cboettig do you have an example of a to-be-saved-locally triplestore & a related query? Maybe in one of your packages?

@maelle maelle added this to the CRAN release milestone Feb 21, 2022
@cboettig
Copy link
Author

@maelle sure, of course anything can be a triplestore, so there's a few examples in https://cran.r-project.org/web/packages/rdflib/vignettes/rdf_intro.html

more meaningful examples though are probably easiest to generate by taking anything that provides json-ld and using that as RDF triples. There's some toy examples in that vignette, or just grab any schema.org markup (codemeta files, or JSON-LD from DataCite or EarthCube, e.g. https://github.com/ESIPFed/science-on-schema.org/blob/master/examples/dataset/full.jsonld)

@maelle maelle pinned this issue Jul 28, 2023
@maelle
Copy link
Collaborator

maelle commented Aug 30, 2023

@cboettig

doc <- system.file("extdata", "dc.rdf", package="redland")

library("glitter")
(sparql <- spq_init() %>%
  spq_prefix(prefixes = c(dc = "http://purl.org/dc/elements/1.1/")) %>%
  spq_mutate(c = dc::creator(a)) %>%
  spq_select(a, c) %>%
  spq_assemble())
#> [1] "PREFIX dc: <http://purl.org/dc/elements/1.1/>\nSELECT ?a ?c\nWHERE {\n\n?a dc:creator ?c.\n\n}\n\n"

rdf <- rdflib::rdf_parse(doc)
rdflib::rdf_query(rdf, sparql)
#> Rows: 1 Columns: 2
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (2): a, c
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 1 × 2
#>   a                      c           
#>   <chr>                  <chr>       
#> 1 http://www.dajobe.org/ Dave Beckett

Created on 2023-08-30 with reprex v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants