ropensci / RNeXML

Implementing semantically rich NeXML I/O in R
https://docs.ropensci.org/RNeXML
Other
13 stars 9 forks source link

Includes nested meta elements in get_metadata() result #198

Closed hlapp closed 5 years ago

hlapp commented 5 years ago

With #197 nested meta elements get parsed and serialized, but they still aren't getting returned by get_metadata(), leaving traversal of the R object hierarchy "by hand" the only way to get at them. (Using "nexml/meta" for the level to get the "meta for meta" actually fails, for example, because not all meta elements have nested meta elements.)

This change returns the nested meta elements as well. This requires a number of changes because that meta can be nested within meta is unique to the NeXML structure (there is no other element that can be nested within itself), and the code, especially in managing ID and IDREF columns, had been assuming that an element and one nested within it are never of the same type.

Includes a test, although arguably there should be more extensive testing of this. Also updates the get_metadata() manpage to explain the additional columns being returned (for ID and IDREF to allow a self-join).

cboettig commented 5 years ago

@hlapp Nice work, I was wondering about this when writing the previous unit test. great fix. This looks good to me, so go ahead and merge in when ready