jung
jung copied to clipboard
Refactor GraphMLReader2
See comments in #47:
- The constructors should be able to share almost all their code.
- The init() method should be more defensive in design: right now it will throw if both inputStream and fileReader are null. (Ideally, in fact, perhaps at least that aspect of the initialization that init() does could be moved into the constructors so that we wouldn't need to have an if-else at all.)
We should probably go one step further and try to consolidate GraphMLReader
and GraphMLReader2
, especially for the next major release of JUNG.
@jbduncan you're not wrong. :) If you'd like to take a stab at a design for that, go for it. I'm currently wrapped up in other elements (specifically, stuff related to the wholesale replacement of the data model with common.graph), but I'd love to get more people involved.
Back on this task: it's been a while since I've looked at the code, but we may simply want to drop one class in favor of the other.
...but I'd love to get more people involved.
Ooh yes, I'd be rather interested in helping out!
I won't be able to do so until June or later, as I'm trying to get through my undergrad dissertation. But after that, I'll probably have the time and energy to spare.
If I could help in any way with the core model (things related to common.graph), then that would interest me the most. Otherwise I may be happy to help with other things like GraphMLReader
, readers/writers for other data formats, or even implementing graph algorithms (which would give the opportunity to study them!).
We could discuss this further offline, if you wish. :)
@jrtom Would you be interested in a JAXB - version of this GraphML parser using the official schema files? What is the advantage of your approach? Performance?
@wumpz I hacked GraphMLReader/Writer together probably ~10 years back; GraphMLReader2 was a donation. To be entirely honest I don't use GraphML (nor XML in general) myself much; I didn't know that JAXB existed when I created the GraphML classes. I don't have any particular attachment to our current implementations.
The one thing that concerns me about JAXB is that apparently it's going to stop being part of Java SE as of Java 11, according to https://en.wikipedia.org/wiki/Java_Architecture_for_XML_Binding (third paragraph); I haven't worked with Jakarta EE at all so I don't know how much of a pain it would be to have a JUNG dependency on it.
Happy to discuss this further, though; thanks for your offer! :)
@jrtom To use JAXB with java 11 one has only to add the official JAXB maven artifacts within the program. (https://stackoverflow.com/questions/52502189/java-11-package-javax-xml-bind-does-not-exist) By the way the same artifacts would work using Java 8 - 10, so no changes there.
Using it may be one would be able to generate the classes directly from GraphML - schema. Therefore it would be complete.