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]
|
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 |
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.
load_datatype(datatype_id)
load_datatype(datatype_id)
datatype_id |
A schema identifier, such as a DOI or a URL |
A list of R6 classes
dt <- dtreg::load_datatype("https://doi.org/21.T11969/aff130c76e68ead3862e")
dt <- dtreg::load_datatype("https://doi.org/21.T11969/aff130c76e68ead3862e")
Show which fields of a schema can be used for creating an instance
show_fields(datatype)
show_fields(datatype)
datatype |
An R6 class from dtreg::load_datatype |
A character vector of available fields
dt <- dtreg::load_datatype("https://doi.org/21.T11969/aff130c76e68ead3862e") dtreg::show_fields(dt$data_item())
dt <- dtreg::load_datatype("https://doi.org/21.T11969/aff130c76e68ead3862e") dtreg::show_fields(dt$data_item())
Write an instance of a schema-related class in JSON-LD format as a string
to_jsonld(instance)
to_jsonld(instance)
instance |
An instance of an R6 class |
JSON string in JSON-LD format
dt <- dtreg::load_datatype("https://doi.org/21.T11969/aff130c76e68ead3862e") instance <- dt$data_item(label = "my_results") result <- dtreg::to_jsonld(instance)
dt <- dtreg::load_datatype("https://doi.org/21.T11969/aff130c76e68ead3862e") instance <- dt$data_item(label = "my_results") result <- dtreg::to_jsonld(instance)