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

example in readme produces invalid EML #257

Closed jeanetteclark closed 5 years ago

jeanetteclark commented 5 years ago
me <- list(individualName = list(givenName = "Carl", surName = "Boettiger"), id="cboettig")
my_eml <- list(dataset = list(
              title = "A Mimimal Valid EML Dataset",
              creator = me,
              contact = me)
            )

write_eml(my_eml, "ex.xml")
eml_validate("ex.xml")

Produces:

#> Document is invalid. Found the following errors:
#>  all id attributes must be unique[1] FALSE
#> attr(,"errors")
#> [1] "all id attributes must be unique"

I believe the purpose of the id attribute is to set internal references in the EML document (consistent with example above), although I have been confused by this attribute before, thinking it was meant to act as a packageId or objectId within a system like DataONE.

cboettig commented 5 years ago

Thanks for the bug report! The error is correct; earlier versions of validation routine simply forgot to check for this condition.

I've updated the example to make it valid merely by dropping the id, which is an optional element anyway and thus arguably out of place in a minimal example.

As discussed in Slack channel, this could still be dealt with much more elegantly, and hopefully will be once emld learns the relevant semantics; see https://github.com/cboettig/emld/issues/2 and https://github.com/cboettig/emld/issues/5. The use of an id here is of course generally still preferable, because the current semantics will see these as a creator and a contact who just happen to have the same name, but lacks the stronger assertion that those really are the same person.

jeanetteclark commented 5 years ago

Sounds good @cboettig - thanks for clearing it up!

jeanetteclark commented 5 years ago

the readme is fixed so I'll close my issue 👍