You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2015/05/01 17:52:49 UTC
[18/50] [abbrv] incubator-tinkerpop git commit: Update javadoc on
GraphReader/Writer a bit.
Update javadoc on GraphReader/Writer a bit.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/cd2cf0fc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/cd2cf0fc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/cd2cf0fc
Branch: refs/heads/variables
Commit: cd2cf0fc94ade9c5faabf49ebd776a990ae86b0a
Parents: ef0b93f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Apr 29 15:53:22 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Apr 29 15:53:22 2015 -0400
----------------------------------------------------------------------
.../gremlin/structure/io/GraphReader.java | 59 ++++++++++----------
.../gremlin/structure/io/GraphWriter.java | 37 ++++++------
.../structure/io/graphson/GraphSONReader.java | 6 ++
3 files changed, 53 insertions(+), 49 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/cd2cf0fc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphReader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphReader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphReader.java
index ebcdf2f..dc4a1d7 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphReader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphReader.java
@@ -55,7 +55,8 @@ public interface GraphReader {
* It is up to individual implementations to manage transactions, but it is not required or enforced. Consult
* the documentation of an implementation to understand the approach it takes.
*
- * @param inputStream a stream containing a single vertex as defined by the accompanying {@link GraphWriter}
+ * @param inputStream a stream containing an entire graph of vertices and edges as defined by the accompanying
+ * {@link GraphWriter#writeGraph(OutputStream, Graph)}.
* @param graphToWriteTo the graph to write to when reading from the stream.
*/
public void readGraph(final InputStream inputStream, final Graph graphToWriteTo) throws IOException;
@@ -65,9 +66,9 @@ public interface GraphReader {
* It is expected that the user will manager their own transaction context with respect to this method (i.e.
* implementations should not commit the transaction for the user).
*
- * @param inputStream a stream containing a single vertex as defined by the accompanying {@link GraphWriter}
- * @param vertexAttachMethod a function to create a vertex where the first argument is the vertex identifier, the
- * second argument is vertex label and the last is the list of properties for it
+ * @param inputStream a stream containing at least a single vertex as defined by the accompanying
+ * {@link GraphWriter#writeVertex(OutputStream, Vertex)}.
+ * @param vertexAttachMethod a function that creates re-attaches a {@link Vertex} to a {@link Host} object.
*/
public Vertex readVertex(final InputStream inputStream, final Function<Attachable<Vertex>, Vertex> vertexAttachMethod) throws IOException;
@@ -76,12 +77,10 @@ public interface GraphReader {
* given the direction supplied as an argument. It is expected that the user will manager their own transaction
* context with respect to this method (i.e. implementations should not commit the transaction for the user).
*
- * @param inputStream a stream containing a single vertex as defined by the accompanying {@link GraphWriter}
- * @param vertexAttachMethod a function to create a vertex where the first argument is the vertex identifier, the
- * second argument is vertex label and the last is the list of properties for it
- * @param edgeAttachMethod a function that creates an edge from the stream where the first argument is the edge
- * identifier, the second argument is the out vertex id, the third is the in vertex id,
- * the fourth is the label, and the fifth is the list of properties as key/value pairs.
+ * @param inputStream a stream containing at least one {@link Vertex} as defined by the accompanying
+ * {@link GraphWriter#writeVertices(OutputStream, Iterator, Direction)} method.
+ * @param vertexAttachMethod a function that creates re-attaches a {@link Vertex} to a {@link Host} object.
+ * @param edgeAttachMethod a function that creates re-attaches a {@link Edge} to a {@link Host} object.
* @param attachEdgesOfThisDirection only edges of this direction are passed to the {@code edgeMaker}.
*/
public Vertex readVertex(final InputStream inputStream,
@@ -90,18 +89,17 @@ public interface GraphReader {
final Direction attachEdgesOfThisDirection) throws IOException;
/**
- * Reads a set of vertices from an {@link InputStream} which were written by
+ * Reads a set of one or more vertices from an {@link InputStream} which were written by
* {@link GraphWriter#writeVertices(OutputStream, Iterator)}. This method will read vertex properties as well as
* edges given the direction supplied as an argument. It is expected that the user will manager their own
* transaction context with respect to this method (i.e. implementations should not commit the transaction for
* the user).
*
- * @param inputStream a stream containing a single vertex as defined by the accompanying {@link GraphWriter}
- * @param vertexAttachMethod a function to create a vertex where the first argument is the vertex identifier, the
- * second argument is vertex label and the last is the list of properties for it
- * @param edgeAttachMethod a function that creates an edge from the stream where the first argument is the edge
- * identifier, the second argument is the out vertex id, the third is the in vertex id,
- * the fourth is the label, and the fifth is the list of properties as key/value pairs.
+ * @param inputStream a stream containing at least one {@link Vertex} as defined by the accompanying
+ * {@link GraphWriter#writeVertices(OutputStream, Iterator, Direction)} or
+ * {@link GraphWriter#writeVertices(OutputStream, Iterator)} methods.
+ * @param vertexAttachMethod a function that creates re-attaches a {@link Vertex} to a {@link Host} object.
+ * @param edgeAttachMethod a function that creates re-attaches a {@link Edge} to a {@link Host} object.
* @param attachEdgesOfThisDirection only edges of this direction are passed to the {@code edgeMaker}.
*/
public Iterator<Vertex> readVertices(final InputStream inputStream,
@@ -114,10 +112,9 @@ public interface GraphReader {
* transaction context with respect to this method (i.e. implementations should not commit the transaction for
* the user).
*
- * @param inputStream a stream containing at least one vertex as defined by the accompanying {@link GraphWriter}
- * @param edgeAttachMethod a function that creates an edge from the stream where the first argument is the edge
- * identifier, the second argument is the out vertex id, the third is the in vertex id,
- * the fourth is the label, and the fifth is the list of properties as key/value pairs.
+ * @param inputStream a stream containing at least one {@link Edge} as defined by the accompanying
+ * {@link GraphWriter#writeEdge(OutputStream, Edge)} method.
+ * @param edgeAttachMethod a function that creates re-attaches a {@link Edge} to a {@link Host} object.
*/
public Edge readEdge(final InputStream inputStream, final Function<Attachable<Edge>, Edge> edgeAttachMethod) throws IOException;
@@ -126,10 +123,11 @@ public interface GraphReader {
* transaction context with respect to this method (i.e. implementations should not commit the transaction for
* the user).
*
- * @param inputStream a stream containing at least one vertex property as written by the accompanying
- * {@link GraphWriter#writeVertexProperty(OutputStream, VertexProperty)} method
- * @param vertexPropertyAttachMethod a function that creates re-attaches a vertex property to a {@link Host} object
- * @return the value returned by the attach method
+ * @param inputStream a stream containing at least one {@link VertexProperty} as written by the accompanying
+ * {@link GraphWriter#writeVertexProperty(OutputStream, VertexProperty)} method.
+ * @param vertexPropertyAttachMethod a function that creates re-attaches a {@link VertexProperty} to a
+ * {@link Host} object.
+ * @return the value returned by the attach method.
*/
public VertexProperty readVertexProperty(final InputStream inputStream,
final Function<Attachable<VertexProperty>, VertexProperty> vertexPropertyAttachMethod) throws IOException;
@@ -139,18 +137,19 @@ public interface GraphReader {
* transaction context with respect to this method (i.e. implementations should not commit the transaction for
* the user).
*
- * @param inputStream a stream containing at least one property as written by the accompanying
- * {@link GraphWriter#writeProperty(OutputStream, Property)} method
- * @param propertyAttachMethod a function that creates re-attaches a property to a {@link Host} object
- * @return the value returned by the attach method
+ * @param inputStream a stream containing at least one {@link Property} as written by the accompanying
+ * {@link GraphWriter#writeProperty(OutputStream, Property)} method.
+ * @param propertyAttachMethod a function that creates re-attaches a {@link Property} to a {@link Host} object .
+ * @return the value returned by the attach method.
*/
public Property readProperty(final InputStream inputStream,
final Function<Attachable<Property>, Property> propertyAttachMethod) throws IOException;
/**
- * Reads an arbitrary object using the standard serializers.
+ * Reads an arbitrary object using the registered serializers.
*
* @param inputStream a stream containing an object.
+ * @param clazz the class expected to be in the stream - may or may not be used by the underlying implementation.
*/
public <C> C readObject(final InputStream inputStream, final Class<? extends C> clazz) throws IOException;
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/cd2cf0fc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphWriter.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphWriter.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphWriter.java
index 67e0c25..8ae4b4e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphWriter.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphWriter.java
@@ -26,7 +26,6 @@ import org.apache.tinkerpop.gremlin.structure.Property;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -53,25 +52,25 @@ public interface GraphWriter {
/**
* Write the entire graph to a stream.
*
- * @param outputStream The stream to write to.
- * @param g The graph to write to stream.
+ * @param outputStream the stream to write to.
+ * @param g the graph to write to stream.
*/
public void writeGraph(final OutputStream outputStream, final Graph g) throws IOException;
/**
* Write a vertex to a stream with its associated edges. Only write edges as defined by the requested direction.
*
- * @param outputStream The stream to write to.
- * @param v The vertex to write.
- * @param direction The direction of edges to write or null if no edges are to be written.
+ * @param outputStream the stream to write to.
+ * @param v the vertex to write.
+ * @param direction the direction of edges to write or null if no edges are to be written.
*/
public void writeVertex(final OutputStream outputStream, final Vertex v, final Direction direction) throws IOException;
/**
* Write a vertex to a stream without writing its edges.
*
- * @param outputStream The stream to write to.
- * @param v The vertex to write.
+ * @param outputStream the stream to write to.
+ * @param v the vertex to write.
*/
public void writeVertex(final OutputStream outputStream, final Vertex v) throws IOException;
@@ -80,9 +79,9 @@ public interface GraphWriter {
* Write a list of vertices from a {@link Traversal} to a stream with its associated edges. Only write edges as
* defined by the requested direction.
*
- * @param outputStream The stream to write to.
+ * @param outputStream the stream to write to.
* @param vertexIterator A traversal that returns a list of vertices.
- * @param direction The direction of edges to write or null if no edges are to be written.
+ * @param direction the direction of edges to write or null if no edges are to be written.
*/
public default void writeVertices(final OutputStream outputStream, final Iterator<Vertex> vertexIterator, final Direction direction) throws IOException {
while (vertexIterator.hasNext()) {
@@ -93,7 +92,7 @@ public interface GraphWriter {
/**
* Write a vertex to a stream without writing its edges.
*
- * @param outputStream The stream to write to.
+ * @param outputStream the stream to write to.
* @param vertexIterator A iterator that returns a list of vertices.
*/
public default void writeVertices(final OutputStream outputStream, final Iterator<Vertex> vertexIterator) throws IOException {
@@ -105,32 +104,32 @@ public interface GraphWriter {
/**
* Write an edge to a stream.
*
- * @param outputStream The stream to write to.
- * @param e The edge to write.
+ * @param outputStream the stream to write to.
+ * @param e the edge to write.
*/
public void writeEdge(final OutputStream outputStream, final Edge e) throws IOException;
/**
* Write a vertex property to a stream.
*
- * @param outputStream The stream to write to.
- * @param vp The vertex property to write.
+ * @param outputStream the stream to write to.
+ * @param vp the vertex property to write.
*/
public void writeVertexProperty(final OutputStream outputStream, final VertexProperty vp) throws IOException;
/**
* Write a property to a stream.
*
- * @param outputStream The stream to write to.
- * @param p The property to write.
+ * @param outputStream the stream to write to.
+ * @param p the property to write.
*/
public void writeProperty(final OutputStream outputStream, final Property p) throws IOException;
/**
* Writes an arbitrary object to the stream.
*
- * @param outputStream The stream to write to
- * @param object The object to write which will use the standard serializer set
+ * @param outputStream the stream to write to.
+ * @param object the object to write which will use the standard serializer set.
*/
public void writeObject(final OutputStream outputStream, final Object object) throws IOException;
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/cd2cf0fc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java
index 7e767d7..fd5b12b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java
@@ -156,6 +156,9 @@ public class GraphSONReader implements GraphReader {
return edgeAttachMethod.apply(edge);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public VertexProperty readVertexProperty(final InputStream inputStream,
final Function<Attachable<VertexProperty>, VertexProperty> vertexPropertyAttachMethod) throws IOException {
@@ -167,6 +170,9 @@ public class GraphSONReader implements GraphReader {
return vertexPropertyAttachMethod.apply(vp);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public Property readProperty(final InputStream inputStream,
final Function<Attachable<Property>, Property> propertyAttachMethod) throws IOException {