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/04/30 19:53:31 UTC
[1/4] incubator-tinkerpop git commit: Add an example to the javadoc
in the GryoMapper.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/master c14a5deed -> e2e76c707
Add an example to the javadoc in the GryoMapper.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/0fa302aa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/0fa302aa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/0fa302aa
Branch: refs/heads/master
Commit: 0fa302aa0f00f5e25acd59c2df0cb8b364b31fec
Parents: 2e4e2ed
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 30 13:21:25 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 30 13:21:25 2015 -0400
----------------------------------------------------------------------
.../tinkerpop/gremlin/structure/io/gryo/GryoMapper.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0fa302aa/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
index 844eea6..7587897 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
@@ -92,8 +92,9 @@ import java.util.stream.Collectors;
* A {@link Mapper} implementation for Kryo. This implementation requires that all classes to be serialized by
* Kryo are registered to it.
* <p/>
- * {@link Graph} implementations providing an {@link IoRegistry} should register their custom classs and/or
+ * {@link Graph} implementations providing an {@link IoRegistry} should register their custom classes and/or
* serializers in one of three ways:
+ * <p/>
* <ol>
* <li>Register just the custom class with a {@code null} {@link Serializer} implementation</li>
* <li>Register the custom class with a {@link Serializer} implementation</li>
@@ -102,6 +103,14 @@ import java.util.stream.Collectors;
* {@link Serializer} requires the {@link Kryo} instance to get constructed.
* </li>
* </ol>
+ * <p/>
+ * For example:
+ * <pre>
+ * {@code
+ * IoRegistry registry = new IoRegistry();
+ * registry.register(GryoIo.class, MyCustomClass.class, new MyCustomClassSerializer());
+ * }
+ * </pre>
*
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
[4/4] incubator-tinkerpop git commit: Update javadoc in IO packages.
Posted by sp...@apache.org.
Update javadoc in IO packages.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/e2e76c70
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/e2e76c70
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/e2e76c70
Branch: refs/heads/master
Commit: e2e76c707e431b92b5f59b6ca2b7a79851445a93
Parents: 290a5e3
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 30 13:53:13 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 30 13:53:13 2015 -0400
----------------------------------------------------------------------
.../gremlin/structure/io/graphml/GraphMLIo.java | 20 +++++++
.../structure/io/graphml/GraphMLMapper.java | 4 ++
.../structure/io/graphml/GraphMLReader.java | 35 +++++++++++
.../structure/io/graphml/GraphMLWriter.java | 40 +++++++++++++
.../structure/io/graphson/GraphSONIo.java | 17 +++++-
.../structure/io/graphson/GraphSONReader.java | 63 +++++++++++++++++---
.../structure/io/graphson/GraphSONWriter.java | 35 ++++++-----
.../io/graphson/LegacyGraphSONReader.java | 35 +++++++++++
.../gremlin/structure/io/gryo/GryoReader.java | 5 +-
9 files changed, 224 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e2e76c70/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLIo.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLIo.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLIo.java
index 3e7c631..e334b67 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLIo.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLIo.java
@@ -21,6 +21,7 @@ package org.apache.tinkerpop.gremlin.structure.io.graphml;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.io.Io;
import org.apache.tinkerpop.gremlin.structure.io.IoRegistry;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -29,6 +30,10 @@ import java.io.InputStream;
import java.io.OutputStream;
/**
+ * Constructs GraphML IO implementations given a {@link Graph} and {@link IoRegistry}. Implementers of the {@link Graph}
+ * interfaces do not have to register any special serializers to the {@link IoRegistry} as GraphML does not support
+ * such things.
+ *
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
public class GraphMLIo implements Io<GraphMLReader.Builder, GraphMLWriter.Builder, GraphMLMapper.Builder> {
@@ -38,21 +43,33 @@ public class GraphMLIo implements Io<GraphMLReader.Builder, GraphMLWriter.Builde
this.graph = graph;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public GraphMLReader.Builder reader() {
return GraphMLReader.build();
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public GraphMLWriter.Builder writer() {
return GraphMLWriter.build();
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public GraphMLMapper.Builder mapper() {
return GraphMLMapper.build();
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void writeGraph(final String file) throws IOException {
try (final OutputStream out = new FileOutputStream(file)) {
@@ -60,6 +77,9 @@ public class GraphMLIo implements Io<GraphMLReader.Builder, GraphMLWriter.Builde
}
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void readGraph(final String file) throws IOException {
try (final InputStream in = new FileInputStream(file)) {
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e2e76c70/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLMapper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLMapper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLMapper.java
index 1443c19..6d37c2e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLMapper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLMapper.java
@@ -18,10 +18,14 @@
*/
package org.apache.tinkerpop.gremlin.structure.io.graphml;
+import org.apache.tinkerpop.gremlin.structure.io.Io;
import org.apache.tinkerpop.gremlin.structure.io.IoRegistry;
import org.apache.tinkerpop.gremlin.structure.io.Mapper;
/**
+ * This is an "empty" implementation only present for compatibility with {@link Io}. GraphML is a "whole graph"
+ * serialization format and does not have the notion of generic serialization functions.
+ *
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
public class GraphMLMapper implements Mapper<Object> {
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e2e76c70/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
index 47a26a8..bcb462d 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
@@ -201,6 +201,11 @@ public class GraphMLReader implements GraphReader {
}
}
+ /**
+ * This method is not supported for this reader.
+ *
+ * @throws UnsupportedOperationException when called.
+ */
@Override
public Iterator<Vertex> readVertices(final InputStream inputStream,
final Function<Attachable<Vertex>, Vertex> vertexAttachMethod,
@@ -209,11 +214,21 @@ public class GraphMLReader implements GraphReader {
throw Io.Exceptions.readerFormatIsForFullGraphSerializationOnly(this.getClass());
}
+ /**
+ * This method is not supported for this reader.
+ *
+ * @throws UnsupportedOperationException when called.
+ */
@Override
public Vertex readVertex(final InputStream inputStream, final Function<Attachable<Vertex>, Vertex> vertexAttachMethod) throws IOException {
throw Io.Exceptions.readerFormatIsForFullGraphSerializationOnly(this.getClass());
}
+ /**
+ * This method is not supported for this reader.
+ *
+ * @throws UnsupportedOperationException when called.
+ */
@Override
public Vertex readVertex(final InputStream inputStream, final Function<Attachable<Vertex>, Vertex> vertexAttachMethod,
final Function<Attachable<Edge>, Edge> edgeAttachMethod,
@@ -221,23 +236,43 @@ public class GraphMLReader implements GraphReader {
throw Io.Exceptions.readerFormatIsForFullGraphSerializationOnly(this.getClass());
}
+ /**
+ * This method is not supported for this reader.
+ *
+ * @throws UnsupportedOperationException when called.
+ */
@Override
public Edge readEdge(final InputStream inputStream, final Function<Attachable<Edge>, Edge> edgeAttachMethod) throws IOException {
throw Io.Exceptions.readerFormatIsForFullGraphSerializationOnly(this.getClass());
}
+ /**
+ * This method is not supported for this reader.
+ *
+ * @throws UnsupportedOperationException when called.
+ */
@Override
public VertexProperty readVertexProperty(final InputStream inputStream,
final Function<Attachable<VertexProperty>, VertexProperty> vertexPropertyAttachMethod) throws IOException {
throw Io.Exceptions.readerFormatIsForFullGraphSerializationOnly(this.getClass());
}
+ /**
+ * This method is not supported for this reader.
+ *
+ * @throws UnsupportedOperationException when called.
+ */
@Override
public Property readProperty(final InputStream inputStream,
final Function<Attachable<Property>, Property> propertyAttachMethod) throws IOException {
throw Io.Exceptions.readerFormatIsForFullGraphSerializationOnly(this.getClass());
}
+ /**
+ * This method is not supported for this reader.
+ *
+ * @throws UnsupportedOperationException when called.
+ */
@Override
public <C> C readObject(final InputStream inputStream, final Class<? extends C> clazz) throws IOException {
throw Io.Exceptions.readerFormatIsForFullGraphSerializationOnly(this.getClass());
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e2e76c70/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLWriter.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLWriter.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLWriter.java
index b000d1e..5ff950b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLWriter.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLWriter.java
@@ -77,41 +77,81 @@ public class GraphMLWriter implements GraphWriter {
this.vertexLabelKey = vertexLabelKey;
}
+ /**
+ * This method is not supported for this writer.
+ *
+ * @throws UnsupportedOperationException when called.
+ */
@Override
public void writeVertex(final OutputStream outputStream, final Vertex v, Direction direction) throws IOException {
throw Io.Exceptions.writerFormatIsForFullGraphSerializationOnly(this.getClass());
}
+ /**
+ * This method is not supported for this writer.
+ *
+ * @throws UnsupportedOperationException when called.
+ */
@Override
public void writeVertex(final OutputStream outputStream, final Vertex v) throws IOException {
throw Io.Exceptions.writerFormatIsForFullGraphSerializationOnly(this.getClass());
}
+ /**
+ * This method is not supported for this writer.
+ *
+ * @throws UnsupportedOperationException when called.
+ */
@Override
public void writeEdge(final OutputStream outputStream, final Edge e) throws IOException {
throw Io.Exceptions.writerFormatIsForFullGraphSerializationOnly(this.getClass());
}
+ /**
+ * This method is not supported for this writer.
+ *
+ * @throws UnsupportedOperationException when called.
+ */
@Override
public void writeVertices(final OutputStream outputStream, final Iterator<Vertex> vertexIterator, final Direction direction) throws IOException {
throw Io.Exceptions.writerFormatIsForFullGraphSerializationOnly(this.getClass());
}
+ /**
+ * This method is not supported for this writer.
+ *
+ * @throws UnsupportedOperationException when called.
+ */
@Override
public void writeVertices(final OutputStream outputStream, final Iterator<Vertex> vertexIterator) throws IOException {
throw Io.Exceptions.writerFormatIsForFullGraphSerializationOnly(this.getClass());
}
+ /**
+ * This method is not supported for this writer.
+ *
+ * @throws UnsupportedOperationException when called.
+ */
@Override
public void writeVertexProperty(final OutputStream outputStream, final VertexProperty vp) throws IOException {
throw Io.Exceptions.writerFormatIsForFullGraphSerializationOnly(this.getClass());
}
+ /**
+ * This method is not supported for this writer.
+ *
+ * @throws UnsupportedOperationException when called.
+ */
@Override
public void writeProperty(final OutputStream outputStream, final Property p) throws IOException {
throw Io.Exceptions.writerFormatIsForFullGraphSerializationOnly(this.getClass());
}
+ /**
+ * This method is not supported for this writer.
+ *
+ * @throws UnsupportedOperationException when called.
+ */
@Override
public void writeObject(final OutputStream outputStream, final Object object) throws IOException {
throw Io.Exceptions.writerFormatIsForFullGraphSerializationOnly(this.getClass());
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e2e76c70/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONIo.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONIo.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONIo.java
index 3aabaf2..57cfc62 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONIo.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONIo.java
@@ -29,7 +29,7 @@ import java.io.InputStream;
import java.io.OutputStream;
/**
- * Constructs Gryo IO implementations given a {@link Graph} and {@link IoRegistry}. Implementers of the {@link Graph}
+ * Constructs GraphSON IO implementations given a {@link Graph} and {@link IoRegistry}. Implementers of the {@link Graph}
* interfaces should see the {@link GraphSONMapper} for information on the expectations for the {@link IoRegistry}.
*
* @author Stephen Mallette (http://stephen.genoprime.com)
@@ -43,21 +43,33 @@ public class GraphSONIo implements Io<GraphSONReader.Builder, GraphSONWriter.Bui
this.graph = graph;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public GraphSONReader.Builder reader() {
return GraphSONReader.build().mapper(mapper().create());
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public GraphSONWriter.Builder writer() {
return GraphSONWriter.build().mapper(mapper().create());
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public GraphSONMapper.Builder mapper() {
return GraphSONMapper.build().addRegistry(this.registry);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void writeGraph(final String file) throws IOException {
try (final OutputStream out = new FileOutputStream(file)) {
@@ -65,6 +77,9 @@ public class GraphSONIo implements Io<GraphSONReader.Builder, GraphSONWriter.Bui
}
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void readGraph(final String file) throws IOException {
try (final InputStream in = new FileInputStream(file)) {
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e2e76c70/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 fd5b12b..79365af 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
@@ -27,7 +27,10 @@ import org.apache.tinkerpop.gremlin.structure.Property;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
+import org.apache.tinkerpop.gremlin.structure.io.GraphWriter;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
import org.apache.tinkerpop.gremlin.structure.util.Attachable;
+import org.apache.tinkerpop.gremlin.structure.util.Host;
import org.apache.tinkerpop.gremlin.structure.util.batch.BatchGraph;
import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedProperty;
@@ -42,6 +45,7 @@ import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.io.OutputStream;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
@@ -72,7 +76,12 @@ public class GraphSONReader implements GraphReader {
}
/**
- * {@inheritDoc}
+ * Read data into a {@link Graph} from output generated by any of the {@link GraphSONWriter} {@code writeVertex} or
+ * {@code writeVertices} methods or by {@link GryoWriter#writeGraph(OutputStream, Graph)}.
+ *
+ * @param inputStream a stream containing an entire graph of vertices and edges as defined by the accompanying
+ * {@link GraphSONWriter#writeGraph(OutputStream, Graph)}.
+ * @param graphToWriteTo the graph to write to when reading from the stream.
*/
@Override
public void readGraph(final InputStream inputStream, final Graph graphToWriteTo) throws IOException {
@@ -98,7 +107,15 @@ public class GraphSONReader implements GraphReader {
}
/**
- * {@inheritDoc}
+ * Read {@link Vertex} objects from output generated by any of the {@link GraphSONWriter} {@code writeVertex} or
+ * {@code writeVertices} methods or by {@link GraphSONWriter#writeGraph(OutputStream, Graph)}.
+ *
+ * @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}.
*/
@Override
public Iterator<Vertex> readVertices(final InputStream inputStream,
@@ -110,7 +127,12 @@ public class GraphSONReader implements GraphReader {
}
/**
- * {@inheritDoc}
+ * Read a {@link Vertex} from output generated by any of the {@link GraphSONWriter} {@code writeVertex} or
+ * {@code writeVertices} methods or by {@link GraphSONWriter#writeGraph(OutputStream, Graph)}.
+ *
+ * @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.
*/
@Override
public Vertex readVertex(final InputStream inputStream, final Function<Attachable<Vertex>, Vertex> vertexAttachMethod) throws IOException {
@@ -118,7 +140,14 @@ public class GraphSONReader implements GraphReader {
}
/**
- * {@inheritDoc}
+ * Read a {@link Vertex} from output generated by any of the {@link GraphSONWriter} {@code writeVertex} or
+ * {@code writeVertices} methods or by {@link GraphSONWriter#writeGraph(OutputStream, Graph)}.
+ *
+ * @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}.
*/
@Override
public Vertex readVertex(final InputStream inputStream,
@@ -139,7 +168,12 @@ public class GraphSONReader implements GraphReader {
}
/**
- * {@inheritDoc}
+ * Read an {@link Edge} from output generated by {@link GraphSONWriter#writeEdge(OutputStream, Edge)} or via
+ * an {@link Edge} passed to {@link GraphSONWriter#writeObject(OutputStream, Object)}.
+ *
+ * @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.
*/
@Override
public Edge readEdge(final InputStream inputStream, final Function<Attachable<Edge>, Edge> edgeAttachMethod) throws IOException {
@@ -157,7 +191,14 @@ public class GraphSONReader implements GraphReader {
}
/**
- * {@inheritDoc}
+ * Read a {@link VertexProperty} from output generated by
+ * {@link GraphSONWriter#writeVertexProperty(OutputStream, VertexProperty)} or via an {@link VertexProperty} passed
+ * to {@link GraphSONWriter#writeObject(OutputStream, Object)}.
+ *
+ * @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.
*/
@Override
public VertexProperty readVertexProperty(final InputStream inputStream,
@@ -171,7 +212,12 @@ public class GraphSONReader implements GraphReader {
}
/**
- * {@inheritDoc}
+ * Read a {@link Property} from output generated by {@link GraphSONWriter#writeProperty(OutputStream, Property)} or
+ * via an {@link Property} passed to {@link GraphSONWriter#writeObject(OutputStream, Object)}.
+ *
+ * @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.
*/
@Override
public Property readProperty(final InputStream inputStream,
@@ -202,7 +248,8 @@ public class GraphSONReader implements GraphReader {
}
/**
- * Number of mutations to perform before a commit is executed.
+ * Number of mutations to perform before a commit is executed when using
+ * {@link GraphSONReader#readGraph(InputStream, Graph)}.
*/
public Builder batchSize(final long batchSize) {
this.batchSize = batchSize;
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e2e76c70/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONWriter.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONWriter.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONWriter.java
index d1c2430..bbbfb3b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONWriter.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONWriter.java
@@ -53,8 +53,8 @@ public class GraphSONWriter implements GraphWriter {
* Writes a {@link Graph} to stream in an adjacency list format where vertices are written with edges from both
* directions. Under this serialization model, edges are grouped by label.
*
- * @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.
*/
@Override
public void writeGraph(final OutputStream outputStream, final Graph g) throws IOException {
@@ -75,8 +75,8 @@ public class GraphSONWriter implements GraphWriter {
/**
* Writes a single {@link Vertex} with no edges serialized.
*
- * @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.
*/
@Override
public void writeVertex(final OutputStream outputStream, final Vertex v) throws IOException {
@@ -87,9 +87,9 @@ public class GraphSONWriter implements GraphWriter {
* Writes a list of vertices in adjacency list format where vertices are written with edges from both
* directions. Under this serialization model, edges are grouped by label.
*
- * @param outputStream The stream to write to.
- * @param vertexIterator A traversal that returns a list of vertices.
- * @param direction If direction is null then no edges are written.
+ * @param outputStream the stream to write to.
+ * @param vertexIterator a traversal that returns a list of vertices.
+ * @param direction if direction is null then no edges are written.
*/
@Override
public void writeVertices(final OutputStream outputStream, final Iterator<Vertex> vertexIterator, final Direction direction) throws IOException {
@@ -109,8 +109,8 @@ public class GraphSONWriter implements GraphWriter {
/**
* Writes a list of vertices without edges.
*
- * @param outputStream The stream to write to.
- * @param vertexIterator A iterator that returns a list of vertices.
+ * @param outputStream the stream to write to.
+ * @param vertexIterator a iterator that returns a list of vertices.
*/
@Override
public void writeVertices(final OutputStream outputStream, final Iterator<Vertex> vertexIterator) throws IOException {
@@ -124,8 +124,8 @@ public class GraphSONWriter implements GraphWriter {
* {@link #writeVertices(OutputStream, Iterator, Direction)} in that the edge label is part of the object and
* vertex labels are included with their identifiers.
*
- * @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.
*/
@Override
public void writeEdge(final OutputStream outputStream, final Edge e) throws IOException {
@@ -135,8 +135,8 @@ public class GraphSONWriter implements GraphWriter {
/**
* Write a {@link VertexProperty} object to the 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.
*/
@Override
public void writeVertexProperty(final OutputStream outputStream, final VertexProperty vp) throws IOException {
@@ -146,8 +146,8 @@ public class GraphSONWriter implements GraphWriter {
/**
* Write a {@link Property} object to the 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.
*/
@Override
public void writeProperty(final OutputStream outputStream, final Property p) throws IOException {
@@ -159,9 +159,8 @@ public class GraphSONWriter implements GraphWriter {
* thus the format of the GraphSON for a {@link Vertex} will be somewhat different from the format supplied
* when using {@link #writeVertex(OutputStream, Vertex, Direction)}. For example, edges will never be included.
*
- * @param outputStream The stream to write to
- * @param object The object to write which will use the standard serializer set
- * @throws IOException
+ * @param outputStream the stream to write to
+ * @param object the object to write which will use the standard serializer set
*/
@Override
public void writeObject(final OutputStream outputStream, final Object object) throws IOException {
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e2e76c70/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/LegacyGraphSONReader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/LegacyGraphSONReader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/LegacyGraphSONReader.java
index 3b37bed..11fd97b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/LegacyGraphSONReader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/LegacyGraphSONReader.java
@@ -121,6 +121,11 @@ public class LegacyGraphSONReader implements GraphReader {
}
+ /**
+ * This method is not supported for this reader.
+ *
+ * @throws UnsupportedOperationException when called.
+ */
@Override
public Iterator<Vertex> readVertices(final InputStream inputStream,
final Function<Attachable<Vertex>, Vertex> vertexAttachMethod,
@@ -129,16 +134,31 @@ public class LegacyGraphSONReader implements GraphReader {
throw Io.Exceptions.readerFormatIsForFullGraphSerializationOnly(this.getClass());
}
+ /**
+ * This method is not supported for this reader.
+ *
+ * @throws UnsupportedOperationException when called.
+ */
@Override
public Edge readEdge(final InputStream inputStream, final Function<Attachable<Edge>, Edge> edgeAttachMethod) throws IOException {
throw Io.Exceptions.readerFormatIsForFullGraphSerializationOnly(this.getClass());
}
+ /**
+ * This method is not supported for this reader.
+ *
+ * @throws UnsupportedOperationException when called.
+ */
@Override
public Vertex readVertex(final InputStream inputStream, final Function<Attachable<Vertex>, Vertex> vertexAttachMethod) throws IOException {
throw Io.Exceptions.readerFormatIsForFullGraphSerializationOnly(this.getClass());
}
+ /**
+ * This method is not supported for this reader.
+ *
+ * @throws UnsupportedOperationException when called.
+ */
@Override
public Vertex readVertex(final InputStream inputStream, final Function<Attachable<Vertex>, Vertex> vertexAttachMethod,
final Function<Attachable<Edge>, Edge> edgeAttachMethod,
@@ -146,18 +166,33 @@ public class LegacyGraphSONReader implements GraphReader {
throw Io.Exceptions.readerFormatIsForFullGraphSerializationOnly(this.getClass());
}
+ /**
+ * This method is not supported for this reader.
+ *
+ * @throws UnsupportedOperationException when called.
+ */
@Override
public VertexProperty readVertexProperty(final InputStream inputStream,
final Function<Attachable<VertexProperty>, VertexProperty> vertexPropertyAttachMethod) throws IOException {
throw Io.Exceptions.readerFormatIsForFullGraphSerializationOnly(this.getClass());
}
+ /**
+ * This method is not supported for this reader.
+ *
+ * @throws UnsupportedOperationException when called.
+ */
@Override
public Property readProperty(final InputStream inputStream,
final Function<Attachable<Property>, Property> propertyAttachMethod) throws IOException {
throw Io.Exceptions.readerFormatIsForFullGraphSerializationOnly(this.getClass());
}
+ /**
+ * This method is not supported for this reader.
+ *
+ * @throws UnsupportedOperationException when called.
+ */
@Override
public <C> C readObject(final InputStream inputStream, final Class<? extends C> clazz) throws IOException {
throw Io.Exceptions.readerFormatIsForFullGraphSerializationOnly(this.getClass());
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e2e76c70/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
index c87a73b..70eae85 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
@@ -28,7 +28,6 @@ import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertexProper
import org.apache.tinkerpop.gremlin.structure.util.star.StarGraph;
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
import org.apache.tinkerpop.shaded.kryo.Kryo;
-import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -249,8 +248,8 @@ public class GryoReader implements GraphReader {
}
/**
- * Set the size between commits when reading into the {@link Graph} instance. This value defaults to
- * {@link BatchGraph#DEFAULT_BUFFER_SIZE}.
+ * Number of mutations to perform before a commit is executed when using
+ * {@link GryoReader#readGraph(InputStream, Graph)}.
*/
public Builder batchSize(final long batchSize) {
this.batchSize = batchSize;
[2/4] incubator-tinkerpop git commit: Update javadoc for some of the
GraphSON.
Posted by sp...@apache.org.
Update javadoc for some of the GraphSON.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/e6e4e6fd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/e6e4e6fd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/e6e4e6fd
Branch: refs/heads/master
Commit: e6e4e6fdd2d34d36d407c1f691bad401f72dd396
Parents: 0fa302a
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 30 13:23:19 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 30 13:23:19 2015 -0400
----------------------------------------------------------------------
.../gremlin/structure/io/graphson/GraphSONIo.java | 3 +++
.../gremlin/structure/io/graphson/GraphSONMapper.java | 12 +++++++++++-
.../gremlin/structure/io/graphson/GraphSONModule.java | 10 +++++++++-
3 files changed, 23 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e6e4e6fd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONIo.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONIo.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONIo.java
index 480ae9e..3aabaf2 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONIo.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONIo.java
@@ -29,6 +29,9 @@ import java.io.InputStream;
import java.io.OutputStream;
/**
+ * Constructs Gryo IO implementations given a {@link Graph} and {@link IoRegistry}. Implementers of the {@link Graph}
+ * interfaces should see the {@link GraphSONMapper} for information on the expectations for the {@link IoRegistry}.
+ *
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
public class GraphSONIo implements Io<GraphSONReader.Builder, GraphSONWriter.Builder, GraphSONMapper.Builder> {
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e6e4e6fd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapper.java
index a3dab2c..03af2d4 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapper.java
@@ -23,6 +23,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider;
+import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.io.IoRegistry;
import org.apache.tinkerpop.gremlin.structure.io.Mapper;
import org.javatuples.Pair;
@@ -32,8 +33,17 @@ import java.util.List;
/**
* An extension to the standard Jackson {@code ObjectMapper} which automatically registers the standard
- * {@link GraphSONModule} for serializing {@link org.apache.tinkerpop.gremlin.structure.Graph} elements. This class
+ * {@link GraphSONModule} for serializing {@link Graph} elements. This class
* can be used for generalized JSON serialization tasks that require meeting GraphSON standards.
+ * <p/>
+ * {@link Graph} implementations providing an {@link IoRegistry} should register their {@code SimpleModule}
+ * implementations to it as follows:
+ * <pre>
+ * {@code
+ * IoRegistry registry = new IoRegistry();
+ * registry.register(GraphSONIo.class, null, new MySimpleModule());
+ * }
+ * </pre>
*
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e6e4e6fd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
index 39fe40e..1ee5137 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
@@ -28,12 +28,20 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty;
import org.apache.tinkerpop.gremlin.structure.util.star.StarGraphGraphSONSerializer;
/**
- * The set of serializers that handle the core graph interfaces.
+ * The set of serializers that handle the core graph interfaces. These serializers support normalization which
+ * ensures that generated GraphSON will be compatible with line-based versioning tools. This setting comes with
+ * some overhead, with respect to key sorting and other in-memory operations.
*
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
public class GraphSONModule extends SimpleModule {
+ /**
+ * Constructs a new object.
+ *
+ * @param normalize when set to true, keys and objects are ordered to ensure that they are the occur in
+ * the same order
+ */
public GraphSONModule(final boolean normalize) {
super("graphson");
addSerializer(Edge.class, new GraphSONSerializers.EdgeJacksonSerializer(normalize));
[3/4] incubator-tinkerpop git commit: Merge remote-tracking branch
'origin/master'
Posted by sp...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/290a5e32
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/290a5e32
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/290a5e32
Branch: refs/heads/master
Commit: 290a5e3216b5d49df50c7a25e72a09aa57e70e9f
Parents: e6e4e6f c14a5de
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 30 13:31:08 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 30 13:31:08 2015 -0400
----------------------------------------------------------------------
CHANGELOG.asciidoc | 2 +
.../traversal/TraversalScriptSupplier.java | 15 ++++--
.../traversal/TraversalVertexProgram.java | 4 +-
.../tinkerpop/gremlin/structure/Compare.java | 8 +--
.../tinkerpop/gremlin/structure/Element.java | 2 +-
.../process/computer/ComputerTestHelper.groovy | 11 +++--
.../step/branch/GroovyLocalTest.groovy | 19 ++++----
.../step/branch/GroovyRepeatTest.groovy | 12 ++---
.../step/branch/GroovyUnionTest.groovy | 10 ++--
.../step/filter/GroovyCyclicPathTest.groovy | 8 +--
.../step/filter/GroovyExceptTest.groovy | 12 ++---
.../step/filter/GroovyFilterTest.groovy | 6 +--
.../step/filter/GroovyHasNotTest.groovy | 4 +-
.../traversal/step/filter/GroovyHasTest.groovy | 29 ++++++-----
.../traversal/step/filter/GroovyIsTest.groovy | 22 +++++----
.../step/filter/GroovyRetainTest.groovy | 10 ++--
.../step/filter/GroovySimplePathTest.groovy | 6 +--
.../step/map/GroovyCoalesceTest.groovy | 8 +--
.../traversal/step/map/GroovyMapTest.groovy | 8 +--
.../traversal/step/map/GroovyPathTest.groovy | 6 +--
.../step/map/GroovyPropertiesTest.groovy | 8 +--
.../traversal/step/map/GroovySelectTest.groovy | 18 +++----
.../step/map/GroovyValueMapTest.groovy | 6 +--
.../traversal/step/map/GroovyVertexTest.groovy | 51 ++++++++++----------
.../traversal/step/branch/UnionTest.java | 3 +-
.../process/traversal/step/filter/IsTest.java | 7 ++-
26 files changed, 154 insertions(+), 141 deletions(-)
----------------------------------------------------------------------