Package 'dtreg'

Title: Interact with Data Type Registries and Create Machine-Readable Data
Description: 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.
Authors: Olga Lezhnina [aut] (ORCID: <https://orcid.org/0000-0003-2237-7725>), Manuel Prinz [aut] (ORCID: <https://orcid.org/0000-0003-2151-4556>), Markus Stocker [aut, cre] (ORCID: <https://orcid.org/0000-0001-5492-3212>), Open Research Knowledge Graph Project and Contributors [cph]
Maintainer: Markus Stocker <[email protected]>
License: MIT + file LICENSE
Version: 1.1.2
Built: 2026-05-23 07:55:59 UTC
Source: https://github.com/cran/dtreg

Help Index


Load classes for a schema with the known identifier

Description

Load a list of R6 classes for a schema identifier, such as an ePIC datatype DOI or an ORKG template URL. The classes contain information of the requested schema and nested schemata.

Usage

load_datatype(datatype_id)

Arguments

datatype_id

A schema identifier, such as a DOI or a URL

Value

A list of R6 classes

Examples

dt <- dtreg::load_datatype("https://doi.org/21.T11969/aff130c76e68ead3862e")

Show schema fields

Description

Show which fields of a schema can be used for creating an instance

Usage

show_fields(datatype)

Arguments

datatype

An R6 class from dtreg::load_datatype

Value

A character vector of available fields

Examples

dt <- dtreg::load_datatype("https://doi.org/21.T11969/aff130c76e68ead3862e")
dtreg::show_fields(dt$data_item())

Write an instance in JSON-LD format

Description

Write an instance of a schema-related class in JSON-LD format as a string

Usage

to_jsonld(instance)

Arguments

instance

An instance of an R6 class

Value

JSON string in JSON-LD format

Examples

dt <- dtreg::load_datatype("https://doi.org/21.T11969/aff130c76e68ead3862e")
instance <- dt$data_item(label = "my_results")
result <- dtreg::to_jsonld(instance)