Title: Interact with Data Type Registries and Create Machine-Readable Data
Version: 1.1.1
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.
License: MIT + file LICENSE
URL: https://gitlab.com/TIBHannover/orkg/dtreg-r
BugReports: https://gitlab.com/TIBHannover/orkg/dtreg-r/-/issues
Depends: R (≥ 4.1.0)
Imports: httr2, jsonlite, methods, R6, stringr
Suggests: knitr, rmarkdown, sets, stats, testthat (≥ 3.0.0)
VignetteBuilder: knitr
Config/testthat/edition: 3
Encoding: UTF-8
RoxygenNote: 7.2.3
NeedsCompilation: no
Packaged: 2025-02-15 11:10:06 UTC; LezhninaO
Author: Olga Lezhnina ORCID iD [aut, cre], Manuel Prinz ORCID iD [aut], Markus Stocker ORCID iD [aut], Open Research Knowledge Graph Project and Contributors [cph]
Maintainer: Olga Lezhnina <olga.lezhnina@tib.eu>
Repository: CRAN
Date/Publication: 2025-02-15 11:30:05 UTC

dtreg: 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.

Author(s)

Maintainer: Olga Lezhnina olga.lezhnina@tib.eu (ORCID)

Authors:

Other contributors:

See Also

Useful links:


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)