Skip to contents

[Stable] Reads a sensor instance described in an RDF/Turtle (.ttl) file and uses the extracted metadata to create or update a DOI record in DataCite/Fabrica via the REST API.

The sensor instance is treated as a DataCite Instrument resource. By default, the function creates a draft DOI record, letting DataCite automatically generate the DOI suffix using the provided prefix.

Metadata are mapped from the TTL as follows:

  • rdfs:label → DataCite Titles

  • rdfs:comment → DataCite Descriptions (Abstract)

  • dct:identifier → Alternate Identifier (UUID)

  • schema:serialNumber → Alternate Identifier (SerialNumber)

  • foaf:givenName, foaf:familyName, foaf:account → DataCite Creators (Person with ORCID)

Usage

sensors_to_datacite(
  ttl_file,
  env = c("test", "prod"),
  prefix,
  publisher,
  publisherIdentifier,
  state = c("draft", "register", "publish"),
  url_override = NULL,
  method = c("POST", "PUT"),
  doi = NULL,
  datacite_username = Sys.getenv("DATACITE_USER"),
  datacite_password = Sys.getenv("DATACITE_PASS")
)

Arguments

ttl_file

Character. Path to the Turtle (.ttl) file describing a single sensor instance.

env

Character. DataCite environment to use: "test" or "prod".

prefix

Character. DOI prefix (e.g. "10.82159"). The DOI suffix is generated automatically by DataCite.

publisher

Character. Name of the publishing organisation (e.g. "LTER-Italy").

publisherIdentifier

Character. Persistent identifier of the publisher, typically a ROR URI (e.g. "https://ror.org/05ma8mw15").

state

Character. Desired DataCite record state (e.g. "draft", "register", "publish").

url_override

Character. Optional landing page URL for the DOI. If NULL, the sensor instance URI from the TTL file is used.

method

Character. HTTP method to use: "POST" (create a new DOI) or "PUT" (update an existing DOI).

doi

Character. Existing DOI to update (required only if method = "PUT").

Value

Invisibly returns a list containing:

  • the parsed sensor instance metadata,

  • the JSON payload sent to DataCite,

  • the DataCite API response,

  • the minted DOI (if returned by DataCite).

Details

The function performs a POST request to the DataCite API endpoint (/dois) to create a new DOI record. If method = "PUT" is used, an existing DOI record can be updated (e.g. to change state from draft to publish).

Authentication credentials must be provided via the environment variables DATACITE_USER and DATACITE_PASS.

Examples

if (FALSE) { # \dontrun{
sensors_to_datacite(
  ttl_file = "sensor_instance_20260114_0d57829e-f780-47c3-bfc7-f36c0c983b3f.ttl",
  env = "prod",
  prefix = "10.82159",
  publisher = "LTER-Italy",
  publisherIdentifier = "https://ror.org/05ma8mw15",
  state = "draft",
  method = "POST"
)
} # }