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, cre] , Manuel Prinz [aut] , Markus Stocker [aut] , Open Research Knowledge Graph Project and Contributors [cph]
Maintainer: Olga Lezhnina <[email protected]>
License: MIT + file LICENSE
Version: 1.1.1
Built: 2025-02-15 13:05:39 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)