Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dataobservatory-eu/turtle

A Turtle converter for R
https://github.com/dataobservatory-eu/turtle

Last synced: 10 days ago
JSON representation

A Turtle converter for R

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r setupknitr, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/",
out.width = "100%"
)
```

# tuRtle

[![lifecycle](https://lifecycle.r-lib.org/articles/figures/lifecycle-experimental.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![Project Status: WIP](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
[![dataobservatory](https://img.shields.io/badge/ecosystem-dataobservatory.eu-3EA135.svg)](https://dataobservatory.eu/)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.11582410.svg)](https://zenodo.org/records/10576998)

The goal of tuRtle is to parse or export R data with the Turtle syntax for the Resource Description Framework (RDF). This is a very early version that is being co-developed with the [dataset](https://dataset.dataobservatory.eu/) package.

## Installation

You can install the development version of tuRtle with `remotes::install_github()`:

```{r installation, eval=FALSE}
remotes::install_github("dataobservatory-eu/tuRtle", build = FALSE)
```

## Example

Let us organise statements into a table of *s* subject, *p* predicate and *o* object:

```{r tdfdef, results='asis'}
tdf <- data.frame (s = c("eg:01","eg:02", "eg:01", "eg:02", "eg:01" ),
p = c("a", "a", "eg-var:", "eg-var:", "rdfs:label"),
o = c("qb:Observation",
"qb:Observation",
"\"1\"^^",
"\"2\"^^",
'"Example observation"')
)

knitr::kable(tdf)
```

The Turtle serialisation is this, written into an `example_file`. The parameter `ttl_namespace = NULL` results in using the default prefixes of the dataset package.

```{r ttl_example}
library(tuRtle)
example_file<- file.path(tempdir(), "example_ttl.ttl")
ttl_write(tdf=tdf, ttl_namespace = NULL, file_path = example_file)

readLines(example_file)
```

## Code of Conduct

Please note that the tuRtle project is released with a [Contributor Code of Conduct](https://dataobservatory-eu.github.io/tuRtle/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.