There has been a lot of focused work on IO in the last couple weeks with
the hope of getting it hardened and finalized for GA.  I'll start with what
the differences for end-users and then discuss changes for vendors.

The first change is to the API.  Previously, we had this approach:

g = TinkerFactory.createModern()
g.io().writeGraphML("tinkerpop-modern.xml")

Many people pointed out that we had some tight coupling here between IO
implementations and the core interfaces.  While it was recognized as
"tight" and purposely done that way at the outset, the tight coupling plus
other factors related to OLTP/OLAP serialization, changes with respect to
batch loading, etc. put things on a different track.  The interface now
looks like:

graph = TinkerFactory.createModern()
graph.io(graphml()).writeGraph("tinkerpop-modern.xml")

The specific IO Builder implementation is provided to the Graph.io() method
which in turn provides back the reader/writer/mapper for the user to work
with.  In this case graphml() is a bit of shorthand in groovy, but
graphml() is a just a static method that returns an instantiated IO
Builder.

In addition to API changes there were some adjustments to format.  For
GraphSON this meant a bit of a change in format that was more efficient and
a bit less verbose when using writeGraph, writeVertex or writeVertices.

Gryo saw similar improvements on the same methods with a far more efficient
format that cut the file size significantly (almost by a factor of three).
Throughout all this work there were a fair number of other good things that
happened, such as efficiency gained with respect to less object creation,
more javadoc overhaul around IO and additional methods on
GraphReader/Writer for serializing Property, VertexProperty and arbitrary
objects. Please check out the latest docs for more information:

http://tinkerpop.incubator.apache.org/docs/3.0.0-SNAPSHOT/#_gremlin_i_o

These good things did not come without some change for those implementing
the Graph interface.  For vendors there's a few changes to consider as you
look at SNAPSHOT and M9.  I've added a new section to the docs that
describe how this will work:

http://tinkerpop.incubator.apache.org/docs/3.0.0-SNAPSHOT/#io-implementations

Basically, the above boils down to:

1. drop your implementation of Graph.Io (that interface no longer exists)
2. create an IoRegistry implementation that has a zero-arg constructor (use
AbstractIoRegistry for convenience) to which you supply the existing
serializers you used to register in the old Graph.Io interface.
3. override the Graph.io(builder) method and supply your IoRegistry
implementation and current Graph instance to the builder and call create()
on it and return that instance.

That should be the extent of the change.  Hopefully this can close the door
on IO for GA at this point - I think it looks pretty good.  Thanks for the
many suggestions.

Stephen

Reply via email to