Interact with Data Type Registries and Create Machine-Readable Data

You can load a schema from a DTR (data type registry) as an R object. Use this schema to write your data in JSON-LD (JavaScript Object Notation for Linked Data) format to make it machine readable.


dtreg

coverage CRANstatus

100% AI-free: we did not use any AI technologies in developing this package.

The goal of dtreg is to help users interact with various data type registries (DTRs) and create machine-readable data. Currently, we support the ePIC and ORKG DTRs.

  • First, load a DTR schema (an ePIC datatype or an ORKG template) as an R object.

  • Then, create a new instance of the schema by filling in the relevant fields.

  • Finally, write the instance as a machine-readable JSON-LD file.

Installation

The easiest way is to install dtreg from CRAN:

install.packages("dtreg")

Development version

You can install the development version of dtreg with:

# install.packages("devtools")
library(devtools)
devtools::install_gitlab("TIBHannover/lki/knowledge-loom/dtreg-r", build_vignettes = TRUE)

Example

This brief example shows you how to work with a DTR schema. You need to know the schema identifier (see the help page ).

library(dtreg)
## load the schema with the known identifier
dt <- dtreg::load_datatype("https://doi.org/21.T11969/aff130c76e68ead3862e")
## look at the schemata you might need to use
names(dt)
## check available fields for your schema
dtreg::show_fields(dt$data_item())
## create your own instance by filling the fields of your choice
## see the help page to know more about the fields
my_label = "my results"
my_df <- data.frame(A = 1, B = 2, stringsAsFactors = FALSE)
url_1 <- dt$url(label = "URL_1")
url_2 <- dt$url(label = "URL_2")
my_inst <- dt$data_item(
  label = my_label,
  has_expression = list(url_1, url_2),
  source_table = my_df
)
## write the instance in JSON-LD format as a string
my_json <- dtreg::to_jsonld(my_inst)

## the result can be saved as a JSON file
## write(my_json, "my_file.json")

For more information, please see the help page and dtreg vignette. To access the vignette, you can run:

vignette("dtreg", package="dtreg")

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("dtreg")

1.1.2 by Markus Stocker, a year ago


https://gitlab.com/TIBHannover/lki/knowledge-loom/dtreg-r


Report a bug at https://gitlab.com/TIBHannover/lki/knowledge-loom/dtreg-r/-/issues


Browse source code at https://github.com/cran/dtreg


Authors: Olga Lezhnina [aut] , Manuel Prinz [aut] , Markus Stocker [aut, cre] (ORCID: , Open Research Knowledge Graph Project and Contributors [cph]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports httr2, jsonlite, methods, R6, stringr

Suggests knitr, rmarkdown, sets, stats, testthat


Imported by mrap.


See at CRAN