annotate_eml: Annotate an EML file (.xml) or an emld list object

View source: R/annotate_eml.R

annotate_emlR Documentation

Annotate an EML file (.xml) or an emld list object

Description

Annotate an EML file (.xml) or an emld list object

Usage

annotate_eml(annotations = NULL, eml.in = NULL, eml.out = NULL)

Arguments

annotations

(character; data frame) Path or data frame of the annotations.txt template for annotating eml.in. Create annotations.txt with template_annotations().

eml.in

(EML; emld list) Path to, or emld list of, the EML file to be annotated. Accepted versions of the emld list object can be created by EMLassemblyline::read_eml() or make_eml().

eml.out

(character) Path of the annotated EML file to be written.

Value

(EML; emld list) If the input to eml.in is an EML file then the output will be an EML file. The emld list object is always returned.

Note

All annotated elements are assigned ids and their annotations are placed both immediately under the parent element (subject) when supported and within the /eml/annotations node through id+reference pairs. This redundant approach supports variation in where EML metadata consumers harvest this information and supports annotation of EML elements requiring id+references.

Examples


# Annotate an EML file --------------------------------------------------------
#
# Annotate an existing EML file (edi.260.3.xml) and write a new version 
# (edi.260.4.xml)

eml <- annotate_eml(
 annotations = system.file("/examples/pkg_260/metadata_templates_overflow/annotations.txt", package = "EMLassemblyline"),
 eml.in = system.file("/examples/eml/edi.260.3.xml", package = "EMLassemblyline"),
 eml.out = paste0(tempdir(), "/edi.260.4.xml")
)
eml

# Remove the EML files from the temporary directory

unlink(paste0(tempdir(), "/edi.260.3.xml"))
unlink(paste0(tempdir(), "/edi.260.4.xml"))


EDIorg/emlAssemblyLine documentation built on Nov. 4, 2022, 11:59 p.m.