Github user twilmes commented on a diff in the pull request: https://github.com/apache/tinkerpop/pull/893#discussion_r205648775 --- Diff: docs/src/reference/the-traversal.asciidoc --- @@ -1049,6 +1050,179 @@ inject(1,2).map {it.get() + 1}.map {g.V(it.get()).next()}.values('name') link:++http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#inject-E...-++[`inject(Object)`] +[[_gremlin_i_o]] +[[io-step]] +=== IO Step + +image:gremlin-io.png[width=250,float=left] The task of importing and exporting the data of `Graph` instances is the +job of the `io()`-step. By default, TinkerPop supports three formats for importing and exporting graph data in +<<graphml,GraphML>>, <<graphson,GraphSON>>, and <<gryo,Gryo>>. + +NOTE: Additional documentation for TinkerPop IO formats can be found in the link:http://tinkerpop.apache.org/docs/x.y.z/dev/io/[IO Reference]. + +By itself the `io()` step merely configures the kind of importing and exporting that is going +to occur and it is the follow-on call to the `read()` or `write()` step that determines which of those actions will +execute. Therefore, a typical usage of the `io()` step would look like this: + +[source,java] +---- +g.io(someInputFile).read().iterate() +g.io(someOutputFile).write().iterate() +---- + +IMPORTANT: The commands above are still traversals and therefore require iteration to be executed, hence the use of +`iterate()` as a termination step. + +By default, the `io()` step will try to detect the right file format using the file name extension. To gain greater +control of the format use the `with()` step modulator to provide further information to `io()`. For example: + +[source,java] +---- +g.io(someInputFile). + with(IO.reader, IO.graphson). + read().iterate() +g.io(someOutputFile). + with(IO.writer,IO.graphml). + write().iterate() +---- + +The `IO` class is a helper for the `io()` step that provides expressions that can be used to help configure it +and in this case it allows direct specification of the "reader" or "writer" to use. The "reader" actually refers to +a `GraphReader` implementation and the `writer" refers to a `GraphWriter` implementation. The implementations of --- End diff -- Small typo here, a quote at the end of `writer"` instead of a tick.
---