read_eml: Read EML into an emld list object

View source: R/template_annotations.R

read_emlR Documentation

Read EML into an emld list object

Description

This function wraps EML::read_eml() with a layer of quality control ensuring the returned emld list object has the same structure as output by EMLassemblyline::make_eml() and can be used in EMLassemblyline workflows.

Usage

read_eml(path, eml)

Arguments

path

(character) Path to the metadata template directory and where annotations.txt will be written.

eml

(file) An EML .xml file located at path.

Details

When representing EML in the emld list structure, nodes that have 1 or more children are structured as a list of unnamed lists (e.g. list(dataTable = list("dataTable1", "dataTable2"))) and this is the structure output by EMLassemblyline::make_eml(). However, EML::read_eml() removes the unnamed list when the node has only 1 child (e.g. list(dataTable = "dataTable1")), thereby breaking EMLassemblyline code using lapply() to parse such nodes. Currently this QC is selectively applied to annotatable nodes targeted by template_annotations():

  • eml/dataset/dataTable

  • eml/dataset/dataTable/attributeList/attribute

  • eml/dataset/otherEntity

  • eml/dataset/creator

  • eml/dataset/contact

  • eml/dataset/associatedParty

  • eml/dataset/project/personnel

  • eml/dataset/project/relatedProject

  • eml/dataset/project/relatedProject/personnel

Extending support to all nodes capable of having 1 or more children is welcomed.

Value

An emld list object as similarly created by EML::read_eml().

Examples

eml <- EMLassemblyline::read_eml(
  path = system.file("/examples/eml", package = "EMLassemblyline"),
  eml = "edi.260.3.xml"
)


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