ropensci / EML

Ecological Metadata Language interface for R: synthesis and integration of heterogenous data
https://docs.ropensci.org/EML
Other
97 stars 33 forks source link

Set attributes for properties, e.g. `<title xml:lang="eng">` #340

Closed peterdesmet closed 2 years ago

peterdesmet commented 2 years ago

Is it possible to define attributes for properties? My use case is that I want to generate an EML file that can be uploaded and understood by a GBIF IPT. The IPT has a particular way of setting userId, by assigning a directory attribute. Is there a way to replicate that (in e.g. set_responsibleParty)?

<creator>
  <individualName>
    <givenName>Peter</givenName>
    <surName>Desmet</surName>
  </individualName>
  <userId directory="http://orcid.org/">0000-0002-8442-8025</userId>
</creator>
peterdesmet commented 2 years ago

Ha, I see this is a duplicate of #338. Closing here.

mbjones commented 2 years ago

@peterdesmet I think this is different from #338, which addresses attributes inside of additionalMetadata, which is handled differently from the rest of the EML schema. The @directory attribute is a standard part of the EML schema on the userId elelment and should be able to be set without a problem. We use it exactly as you described in our documents in the Arctic Data Center (it is recommended best practice for ORCIDs). The one difference is that DataONE, LTER, and other networks have converged on using the full ORCID in the userId value. Here's an example with directory set correctly:

me <- list(
    individualName = list(
        givenName = "Peter", 
        surName = "Desmet"), 
    userId = list(
        directory="https://orcid.org/", 
        'https://orcid.org/0000-0002-8442-8025'))
eml <- list(dataset = list(
    title = "dataset title",
    contact = me,
    creator = me),
    system = "doi",
    packageId = "10.xxx")
doc <- as_emld(eml)
eml_validate(doc)
peterdesmet commented 2 years ago

Oh excellent! Thanks!