create_eml: Create EML metadata

Description Usage Arguments Details Value Examples

View source: R/create_eml.R

Description

Create EML metadata

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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:

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
## 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 Oct. 19, 2021, 1:08 a.m.