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

Creating EML elements with XML attributes #338

Open kzollove opened 2 years ago

kzollove commented 2 years ago

The ezEML web app for creating EML adds an additional metadata tag to every EML document that describes the editor used to create it:

<additionalMetadata>
    <metadata>
      <emlEditor app="ezEML" release="2022.04.13">
      </emlEditor>
    </metadata>
  </additionalMetadata>

We're trying to recreate this in EMLassemblyline using the EML/emld R package framework. We are able to create app and release as child elements of emlEditor, but not as attributes:

IN:

EML::eml$additionalMetadata(
      metadata = list(emlEditor = list(
        "app" = "EMLassemblyline",
        "release" = "2022.04.13")))

OUT:

<additionalMetadata>
    <metadata>
      <emlEditor>
        <app>EMLassemblyline</app>
        <release>2022.04.13</release>
      </emlEditor>
    </metadata>
  </additionalMetadata>

Is it possible to specify XML attributes within the EML/emld framework (we've tried many different ways?

If not, could this be implemented? Possibly to work like:

IN:

EML::eml$additionalMetadata(
      metadata = list(emlEditor = list(
        "@app" = "EMLassemblyline",
        "@release" = "2022.04.13")))

OUT:

<additionalMetadata>
    <metadata>
      <emlEditor app="EMLassemblyline" release="2022.04.13">
      </emlEditor>
    </metadata>
  </additionalMetadata>
amoeba commented 2 years ago

Hi @kzollove,

I think you're right that there's not a way to do this right now. The only list names that get treated as attributes are ones that are part of the EML schema.

That said, supporting this wouldn't be too hard and I think it'd be useful. The workaround would be to serialize your EML as XML and set your additionalMetadata element using XML-aware tools (like xml2). Not a great solution.

Thoughts, @cboettig, maybe @jeanetteclark? I kinda like how having a leading "@" before a name looks here.

peterdesmet commented 2 years ago

Would very much like this too! I like the @attribute syntax, similar to how @id is currently set.