You can install rdflib from GitHub with:
While not required,
rdflib is designed to play nicely with
%>% pipes, so we will load the
magrittr package as well:
Parse a file and serialize into a different format:
Perform SPARQL queries:
Initialize graph a new object or add triples statements to an existing graph:
Change the default display format (
nquads) for graph objects:
We can also work with the JSON-LD format through additional functions provided in the R package,
For more information on the JSON-LD RDF API, see https://json-ld.org/spec/latest/json-ld-rdf/.
See articles from the documentation for advanced use including applications to large triplestores, example SPARQL queries, and information about additional database backends.
Please also cite the underlying
redland library when citing
Carl Boettiger. (2018). rdflib: A high level wrapper around the redland package for common rdf applications (Version 0.1.0). Zenodo. https://doi.org/10.5281/zenodo.1098478
Jones M, Slaughter P, Ooms J, Boettiger C, Chamberlain S (2019). redland: RDF Library Bindings in R. doi: 10.5063/F1VM496B (URL: https://doi.org/10.5063/F1VM496B), R package version 1.0.17-11, <URL: https://github.com/ropensci/redland-bindings/tree/master/R/redland>.