Skip to contents

Create EML metadata

Usage

create_eml(
  path,
  source_id = NULL,
  derived_id,
  script,
  script_description,
  is_about = NULL,
  contact,
  user_id,
  user_domain,
  url = NULL
)

Arguments

path

(character) Path to the directory containing hymetDP tables, conversion script, and where EML metadata will be written.

source_id

(character) Identifier of a data package published in a supported repository. Currently, the EDI Data Repository is supported.

derived_id

(character) Identifier of the dataset being created.

script

(character) Name of file used to convert source_id to derived_id.

script_description

(character) Description of script.

is_about

(named character) An optional argument for specifying dataset level annotations describing what this dataset "is about".

contact

(data.frame) Contact information for the person that created this hymetDP dataset, containing these columns:

  • givenName

  • surName

  • organizationName

  • electronicMailAddress

user_id

(character) Identifier of user associated with user_domain.

user_domain

(character) Domain (data repository) the user_id belongs to. Currently, EDI is supported.

url

(character) URL to the publicly accessible directory containing hymetDP tables, conversion script, and EML metadata. This argument supports direct download of the data entities by a data repository and is used for automated revisioning and publication.

Value

An EML metadata file.

Details

This function creates an EML record for a hymetDP dataset by combining metadata from source_id with boiler-plate metadata describing the hymetDP model. Changes to the source_id EML include:

  • <access> Adds user_id to the list of principals granted read and write access to the hymetDP data package this EML describes.

  • <title> Adds a note that this is a derived data package in the hymetDP format.

  • <pubDate> Adds the date this EML was created.

  • <abstract> Adds a note that this is a derived data package in the hymetDP format.

  • <keywordSet> Adds the "hymetDP" keyword to enable search and discovery of all hymetDP data packages in the data repository it is published.

  • <intellectualRights> Keeps intact the original intellectual rights license source_id was released under, or uses CCO if missing.

  • <contact> Adds the hymetDP creator as a point of contact.

  • <methodStep> Adds a note that this data package was created by the script, and adds provenance metadata noting that this is a derived dataset and describes where the source_id can be accessed.

  • <dataTables> Replaces the source_id table metadata with descriptions of the the hymetDP tables.

  • <otherEntity> Adds script and script_description. otherEntities of source_id are removed.

  • <annotations> Adds boilerplate annotations describing the hymetDP at the dataset, entity, and entity attribute levels.

Examples

if (FALSE) {
# Create directory with hymetDP tables for create_eml()
mypath <- paste0(tempdir(), "/data")
dir.create(mypath)
inpts <- c(hymet_L1$tables, path = mypath)
do.call(write_tables, inpts)
file.copy(system.file("extdata", "create_hymetDP.R", package = "hymetDP"), mypath)
dir(mypath)

# Add self as contact information incase questions arise
additional_contact <- data.frame(
  givenName = 'Kyle',
  surName = 'Zollo-Venecek',
  organizationName = 'Environmental Data Initiative',
  electronicMailAddress = 'hymetdp@gmail.com',
  stringsAsFactors = FALSE)

# Create EML
eml <- create_eml(
  path = mypath,
  source_id = "knb-lter-mcm.9003.11",
  derived_id = "edi.10101.1",
  is_about = dataset_annotations,
  script = "create_hymetDP.R",
  script_description = "A function for converting knb-lter-mcm.9003 to hymetDP",
  contact = additional_contact,
  user_id = 'hymetdp',
  user_domain = 'EDI')

dir(mypath)
View(eml)

# Clean up
unlink(mypath, recursive = TRUE)
}