create_eml: Create EML metadata

View source: R/create_eml.R

create_emlR Documentation

Create EML metadata

Description

Create EML metadata

Usage

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

Arguments

path

(character) Path to the directory containing ecocomDP 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 ecocomDP 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.

basis_of_record

(character) An optional argument to facilitate creation of a Darwin Core record from this dataset using convert_to_dwca(). Use this to define the Darwin Core property basisOfRecord as HumanObservation or MachineObservation.

url

(character) URL to the publicly accessible directory containing ecocomDP 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.

Details

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

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

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

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

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

  • <keywordSet Adds the "ecocomDP" keyword to enable search and discovery of all ecocomDP data packages in the data repository it is published, and 7 terms from the LTER Controlled vocabulary: "communities", "community composition", "community dynamics", "community patterns", "species composition", "species diversity", and "species richness". Darwin Core Terms listed under basis_of_record are listed and used by convert_to_dwca() to create a Darwin Core Archive of this ecocomDP data package.

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

  • <taxonomicCoverage> Appends to the taxonomic coverage element with data supplied in the ecocomDP taxon table.

  • <contact> Adds the ecocomDP 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 ecocomDP tables.

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

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

Taxa listed in the taxon table, and resolved to one of the supported authority systems (i.e. ITIS, WORMS, or GBIF), will have their full taxonomic hierarchy expanded, including any common names for each level.

Value

An EML metadata file.

Examples

## Not run: 
# Create directory with ecocomDP tables for create_eml()
mypath <- paste0(tempdir(), "/data")
dir.create(mypath)
inpts <- c(ants_L1$tables, path = mypath)
do.call(write_tables, inpts)
file.copy(system.file("extdata", "create_ecocomDP.R", package = "ecocomDP"), mypath)
dir(mypath)

# Describe, with annotations, what the source L0 dataset "is about"
dataset_annotations <- c(
  `species abundance` = "http://purl.dataone.org/odo/ECSO_00001688",
  Population = "http://purl.dataone.org/odo/ECSO_00000311",
  `level of ecological disturbance` = "http://purl.dataone.org/odo/ECSO_00002588",
  `type of ecological disturbance` = "http://purl.dataone.org/odo/ECSO_00002589")

# Add self as contact information incase questions arise
additional_contact <- data.frame(
  givenName = 'Colin',
  surName = 'Smith',
  organizationName = 'Environmental Data Initiative',
  electronicMailAddress = 'csmith@mail.com',
  stringsAsFactors = FALSE)

# Create EML
eml <- create_eml(
  path = mypath,
  source_id = "knb-lter-hfr.118.33",
  derived_id = "edi.193.5",
  is_about = dataset_annotations,
  script = "create_ecocomDP.R",
  script_description = "A function for converting knb-lter-hrf.118 to ecocomDP",
  contact = additional_contact,
  user_id = 'ecocomdp',
  user_domain = 'EDI',
  basis_of_record = "HumanObservation")

dir(mypath)
View(eml)

# Clean up
unlink(mypath, recursive = TRUE)

## End(Not run)


ecocomDP documentation built on Sept. 11, 2024, 6:58 p.m.