All Projects → ropensci → rdflib

ropensci / rdflib

Licence: other
📦 High level wrapper around the redland package for common rdf applications

Programming Languages

HTML
75241 projects
r
7636 projects
TeX
3793 projects
CSS
56736 projects
Dockerfile
14818 projects
shell
77523 projects

Projects that are alternatives of or similar to rdflib

opencage
🌐 R package for the OpenCage API -- both forward and reverse geocoding 🌐
Stars: ✭ 82 (+74.47%)
Mutual labels:  r-package, peer-reviewed
nlrx
nlrx NetLogo R
Stars: ✭ 66 (+40.43%)
Mutual labels:  r-package, peer-reviewed
ropenaq
⛔ ARCHIVED ⛔ Accesses Air Quality Data from the Open Data Platform OpenAQ
Stars: ✭ 69 (+46.81%)
Mutual labels:  r-package, peer-reviewed
nomisr
Access UK official statistics from the Nomis database through R.
Stars: ✭ 30 (-36.17%)
Mutual labels:  r-package, peer-reviewed
cyphr
Humane encryption
Stars: ✭ 91 (+93.62%)
Mutual labels:  r-package, peer-reviewed
PostcodesioR
API wrapper around postcodes.io - free UK postcode lookup and geocoder
Stars: ✭ 36 (-23.4%)
Mutual labels:  r-package, peer-reviewed
bittrex
A R Client for the Bittrex Crypto-Currency Exchange
Stars: ✭ 26 (-44.68%)
Mutual labels:  r-package, peer-reviewed
rdefra
rdefra: Interact with the UK AIR Pollution Database from DEFRA
Stars: ✭ 14 (-70.21%)
Mutual labels:  r-package, peer-reviewed
suppdata
Grabbing SUPPlementary DATA in R
Stars: ✭ 31 (-34.04%)
Mutual labels:  r-package, peer-reviewed
riem
✈️ ☀️ R package for accessing ASOS data via the Iowa Environment Mesonet ☁️ ✈️
Stars: ✭ 38 (-19.15%)
Mutual labels:  r-package, peer-reviewed
oai
OAI-PMH R client
Stars: ✭ 13 (-72.34%)
Mutual labels:  r-package, peer-reviewed
getCRUCLdata
CRU CL v. 2.0 Climatology Client for R
Stars: ✭ 17 (-63.83%)
Mutual labels:  r-package, peer-reviewed
robotstxt
robots.txt file parsing and checking for R
Stars: ✭ 65 (+38.3%)
Mutual labels:  r-package, peer-reviewed
weathercan
R package for downloading weather data from Environment and Climate Change Canada
Stars: ✭ 83 (+76.6%)
Mutual labels:  r-package, peer-reviewed
medrxivr
Access and search medRxiv and bioRxiv preprint data
Stars: ✭ 34 (-27.66%)
Mutual labels:  r-package, peer-reviewed
rrlite
R interface to rlite https://github.com/seppo0010/rlite
Stars: ✭ 16 (-65.96%)
Mutual labels:  r-package, peer-reviewed
geoparser
⛔ ARCHIVED ⛔ R package for the Geoparser.io API
Stars: ✭ 38 (-19.15%)
Mutual labels:  r-package, peer-reviewed
NLMR
📦 R package to simulate neutral landscape models 🏔
Stars: ✭ 57 (+21.28%)
Mutual labels:  r-package, peer-reviewed
roadoi
Use Unpaywall with R
Stars: ✭ 60 (+27.66%)
Mutual labels:  r-package, peer-reviewed
crminer
⛔ ARCHIVED ⛔ Fetch 'Scholary' Full Text from 'Crossref'
Stars: ✭ 17 (-63.83%)
Mutual labels:  r-package

rdflib

Project Status: Active – The project has reached a stable, usable state and is being actively developed. Travis-CI Build Status Build status Coverage Status CircleCI CRAN_Status_Badge CRAN RStudio mirror downloads DOI

A friendly and consise user interface for performing common tasks on rdf data, such as parsing and converting between formats including rdfxml, turtle, nquads, ntriples, and trig, creating rdf graphs, and performing SPARQL queries. This package wraps the redland R package which provides direct bindings to the redland C library. Additionally, the package supports parsing and serialization of rdf into json-ld through the json-ld package, which binds the official json-ld javascript API. The package interface takes inspiration from the Python rdflib library.

Installation

You can install rdflib from GitHub with:

# install.packages("devtools")
devtools::install_github("ropensci/rdflib")

Basic use

While not required, rdflib is designed to play nicely with %>% pipes, so we will load the magrittr package as well:

library(magrittr)
library(rdflib)

Parse a file and serialize into a different format:

system.file("extdata/dc.rdf", package="redland") %>%
  rdf_parse() %>%
  rdf_serialize("test.nquads", "nquads")

Perform SPARQL queries:

sparql <-
 'PREFIX dc: <http://purl.org/dc/elements/1.1/>
  SELECT ?a ?c
  WHERE { ?a dc:creator ?c . }'

system.file("extdata/dc.rdf", package="redland") %>%
rdf_parse() %>%
rdf_query(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

Initialize graph a new object or add triples statements to an existing graph:

x <- rdf()
x <- rdf_add(x, 
    subject="http://www.dajobe.org/",
    predicate="http://purl.org/dc/elements/1.1/language",
    object="en")
x
#> Total of 1 triples, stored in hashes
#> -------------------------------
#> <http://www.dajobe.org/> <http://purl.org/dc/elements/1.1/language> "en" .

Change the default display format (nquads) for graph objects:

options(rdf_print_format = "jsonld")
x
#> Total of 1 triples, stored in hashes
#> -------------------------------
#> {
#>   "@id": "http://www.dajobe.org/",
#>   "http://purl.org/dc/elements/1.1/language": "en"
#> }

JSON-LD

We can also work with the JSON-LD format through additional functions provided in the R package, jsonld.

out <- tempfile()
rdf_serialize(x, out, "jsonld")
rdf_parse(out, format = "jsonld")
#> Total of 1 triples, stored in hashes
#> -------------------------------
#> {
#>   "@id": "http://www.dajobe.org/",
#>   "http://purl.org/dc/elements/1.1/language": "en"
#> }

For more information on the JSON-LD RDF API, see https://json-ld.org/spec/latest/json-ld-rdf/.

Advanced Use

See articles from the documentation for advanced use including applications to large triplestores, example SPARQL queries, and information about additional database backends.


Citing rdflib

Please also cite the underlying redland library when citing rdflib

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 (2021). redland: RDF Library Bindings in R. doi: 10.5063/F1VM496B (URL: https://doi.org/10.5063/F1VM496B), R package version 1.0.17-15, <URL: https://github.com/ropensci/redland-bindings/tree/master/R/redland>.

rofooter

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].