https://github.com/dataobservatory-eu/turtle
A Turtle converter for R
https://github.com/dataobservatory-eu/turtle
Last synced: 2 months ago
JSON representation
A Turtle converter for R
- Host: GitHub
- URL: https://github.com/dataobservatory-eu/turtle
- Owner: dataobservatory-eu
- License: gpl-3.0
- Created: 2024-01-27T17:35:39.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-20T15:37:53.000Z (7 months ago)
- Last Synced: 2025-05-04T11:27:40.474Z (2 months ago)
- Language: R
- Homepage: https://turtle.dataobservatory.eu/
- Size: 556 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
- Codemeta: codemeta.json
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%"
)
```[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[](https://www.repostatus.org/#wip)
[](https://dataobservatory.eu/)
[](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.