Skip to content

Duplicate person when using write_eml() #339

Description

@peterdesmet

The Creating EML vignette suggests using as_emld(R_person) to efficiently code a person as an EML party.

library(EML)
me <- person("Peter", "Desmet", , "fakeaddress@email.com", "mdc", comment = c(ORCID = "0000-0002-8442-8025"))
my_eml <- list(dataset = list(
  title = "A Minimal Valid EML Dataset",
  creator = as_emld(me),
  contact = as_emld(me)
))
my_eml
#> $dataset
#> $dataset$title
#> [1] "A Minimal Valid EML Dataset"
#> 
#> $dataset$creator
#> individualName:
#>   givenName: Peter
#>   surName: Desmet
#> electronicMailAddress: fakeaddress@email.com
#> '@id': https://orcid.org/0000-0002-8442-8025
#> 
#> $dataset$contact
#> individualName:
#>   givenName: Peter
#>   surName: Desmet
#> electronicMailAddress: fakeaddress@email.com
#> '@id': https://orcid.org/0000-0002-8442-8025
write_eml(my_eml, "ex.xml")

Created on 2022-04-29 by the reprex package (v2.0.1)

That generated EML does indeed contain that info nicely. However, the written EML contains the individualName twice:

<?xml version="1.0" encoding="UTF-8"?>
<eml:eml xmlns:eml="https://eml.ecoinformatics.org/eml-2.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:stmml="http://www.xml-cml.org/schema/stmml-1.2" packageId="4ef7c004-cb89-4888-b095-240ecbf18c28" system="uuid" xsi:schemaLocation="https://eml.ecoinformatics.org/eml-2.2.0 https://eml.ecoinformatics.org/eml-2.2.0/eml.xsd">
  <dataset>
    <title>A Minimal Valid EML Dataset</title>
    <creator id="https://orcid.org/0000-0002-8442-8025">
      <individualName>
        <givenName>Peter</givenName>
        <surName>Desmet</surName>
      </individualName>
      <individualName> <-- DUPLICATE
        <givenName>Peter</givenName>
        <surName>Desmet</surName>
      </individualName>
      <electronicMailAddress>fakeaddress@email.com</electronicMailAddress>
    </creator>
    <contact id="https://orcid.org/0000-0002-8442-8025">
      <individualName>
        <givenName>Peter</givenName>
        <surName>Desmet</surName>
      </individualName>
      <individualName> <-- DUPLICATE
        <givenName>Peter</givenName>
        <surName>Desmet</surName>
      </individualName>
      <electronicMailAddress>fakeaddress@email.com</electronicMailAddress>
    </contact>
  </dataset>
</eml:eml>

Any idea why this is happening? Note, it is not happening when:

  • Only the creator or contact is set (rather than both)
  • The person only contains first and last name (not email, role, comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions