ropensci / RNeXML

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

Makes most S4 classes in the package pseudo-namespaced #201

Closed hlapp closed 5 years ago

hlapp commented 5 years ago

In response to already encountered and possible future clashes of S4 class names defined here and elsewhere (see #169), this prefixes most of the classes defined here with "nexml:". The only classes left unchanged (for now?) are the ListOfxxxx classes, which have only minor roles as glorified lists, and the "nexml" root class.

Arguably most if not all clients shouldn't be interacting directly with classes other than the "nexml" class, and hence all others should arguably be considered internal to the package. Hence, how nice and short their names are shouldn't matter to anyone outside the package, whereas short and attractive names ("tree", "meta", "char", "row", "seq", others anyone?) do provide for a heightened risk of clashing with classes defined elsewhere.

Originally, the class hierarchy seems to have been designed with the desire to have a 1:1 correspondence with the NeXML schema. I would argue that makes the mistake of overloading and conflating the concern about mapping properly to and from NeXML schema elements with properly naming S4 classes. This change set solves this by introducing (also pseudo-namespaced, for easy removal in data extractions) slots xmlName and idrefName. For the most part these have the same value for now, but there is no need for them to do so now (unlike previously, where this was all tied to the S4 class name).

Obviously, this change required changes to the test suite across the board because the test suite does a lot of type testing. I tried not to change anything else (for now).

In particular, this maintains the behavior and result returned by get_metadata(), although it would be very straightforward now (and eliminate some code) to automatically consolidate the LiteralMeta and ResourceMeta columns into one and the same column (such as Meta), making metadata considerably less snowflake-like in how they are dealt with. Hence this would make most of #199 superfluous (though not all – the consolidation of property and rel would remain, which one could argue is easy enough to do to simply be left in the hands of a client).

This fixes #169, and in fact also fixes #183, not just in part but all failures reported there.

cboettig commented 5 years ago

Nice, an ambitious update probably well-warranted. Will break backwards compatability with any script calling the base constructors, but probably not likely to be a major issue.

Looks like Travis is upset about the "S4 vignette" not also being patched ...

hlapp commented 5 years ago

I have a fix for the S4 vignette, that's the easy part.

The other problem is the simmap vignette, which is much harder, for several reasons. Specifically:

I can take a crack at fixing meta() and simmap, but I feel this is significant enough in its own right that it exceeds the scope of this PR. I'd therefore suggest that I simply disable the simmap vignette code, and then work through being able to re-enable it.

cboettig commented 5 years ago

Yup, these sound like pretty major issues in the simmap implementation which will have to be addressed separately. Deprecating the simmap vignette (and associated simmap functions/tests (?) ) so that we can get a clean check on this PR (while also quarantining simmap) seems reasonable.

hlapp commented 5 years ago

Given that we have chosen to merge the alternative in #205, this is now obsolete and I am going to close the PR.