You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2015/04/24 22:07:46 UTC
[1/7] incubator-tinkerpop git commit: Changed StarGraphSerialization
registration approach in readVertices/Vertex.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/p-predicate-model d67884402 -> 4be24b610
Changed StarGraphSerialization registration approach in readVertices/Vertex.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/f9f98bdf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/f9f98bdf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/f9f98bdf
Branch: refs/heads/p-predicate-model
Commit: f9f98bdf16a6f3523ef86f09c2b89f2bd29467a5
Parents: 86b78b7
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 24 15:40:40 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 24 15:40:40 2015 -0400
----------------------------------------------------------------------
.../gremlin/structure/io/gryo/GryoWriter.java | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/f9f98bdf/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
index 88fb325..0e4e311 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
@@ -57,15 +57,13 @@ public class GryoWriter implements GraphWriter {
}
public void writeVertices(final OutputStream outputStream, final Iterator<Vertex> vertexIterator, final Direction direction) throws IOException {
- // todo: can we wrap this up in a function somehow - withRegistration(r, stream... -> ....)
- final Registration oldRegistration = kryo.getRegistration(StarGraph.class);
- kryo.register(StarGraph.class, StarGraphSerializer.with(direction), oldRegistration.getId());
+ kryo.getRegistration(StarGraph.class).setSerializer(StarGraphSerializer.with(direction));
final Output output = new Output(outputStream);
while (vertexIterator.hasNext()) {
writeVertexInternal(output, vertexIterator.next());
}
output.flush();
- kryo.register(oldRegistration);
+ kryo.getRegistration(StarGraph.class).setSerializer(StarGraphSerializer.with(Direction.BOTH));
}
public void writeVertices(final OutputStream outputStream, final Iterator<Vertex> vertexIterator) throws IOException {
@@ -74,15 +72,11 @@ public class GryoWriter implements GraphWriter {
@Override
public void writeVertex(final OutputStream outputStream, final Vertex v, final Direction direction) throws IOException {
- // todo: figure out how to not keep creating Registration objects?
- final Registration oldRegistration = kryo.getRegistration(StarGraph.class);
- kryo.register(StarGraph.class, StarGraphSerializer.with(direction), oldRegistration.getId());
-
+ kryo.getRegistration(StarGraph.class).setSerializer(StarGraphSerializer.with(direction));
final Output output = new Output(outputStream);
writeVertexInternal(output, v);
output.flush();
-
- kryo.register(oldRegistration);
+ kryo.getRegistration(StarGraph.class).setSerializer(StarGraphSerializer.with(Direction.BOTH));
}
@Override
[6/7] incubator-tinkerpop git commit: Merge branch 'master' into
p-predicate-model
Posted by ok...@apache.org.
Merge branch 'master' into p-predicate-model
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/1cdcf1fd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/1cdcf1fd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/1cdcf1fd
Branch: refs/heads/p-predicate-model
Commit: 1cdcf1fdde0f93dec18c4a7fc9adc8eb68f7ea5b
Parents: d678844 bd182de
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Apr 24 14:04:31 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri Apr 24 14:04:31 2015 -0600
----------------------------------------------------------------------
.../gremlin/structure/io/GraphReader.java | 19 ++--
.../gremlin/structure/io/gryo/GryoMapper.java | 6 +-
.../gremlin/structure/io/gryo/GryoWriter.java | 14 +--
.../gremlin/structure/util/star/StarGraph.java | 23 ++---
.../util/star/StarGraphSerializer.java | 17 ++--
.../tinkerpop/gremlin/util/tools/BiMap.java | 92 --------------------
.../io/gryo/GryoRecordReaderWriterTest.java | 1 -
7 files changed, 32 insertions(+), 140 deletions(-)
----------------------------------------------------------------------
[5/7] incubator-tinkerpop git commit: back to original serialization
model for StarGraph now that adjacent labels are not required.
Posted by ok...@apache.org.
back to original serialization model for StarGraph now that adjacent labels are not required.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/bd182de8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/bd182de8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/bd182de8
Branch: refs/heads/p-predicate-model
Commit: bd182de88b7bc8f24ee9261fb8e4f80914fc172a
Parents: 8048b1e
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Apr 24 14:01:29 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri Apr 24 14:01:43 2015 -0600
----------------------------------------------------------------------
.../gremlin/structure/io/gryo/GryoMapper.java | 6 +-
.../gremlin/structure/util/star/StarGraph.java | 23 ++---
.../util/star/StarGraphSerializer.java | 17 ++--
.../tinkerpop/gremlin/util/tools/BiMap.java | 92 --------------------
4 files changed, 14 insertions(+), 124 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/bd182de8/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 85b599a..9297f50 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
@@ -23,8 +23,8 @@ import org.apache.tinkerpop.gremlin.process.computer.util.MapMemory;
import org.apache.tinkerpop.gremlin.process.traversal.Path;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
-import org.apache.tinkerpop.gremlin.process.traversal.traverser.B_O_S_SE_SL_Traverser;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.B_O_P_S_SE_SL_Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.B_O_S_SE_SL_Traverser;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.B_O_Traverser;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.O_Traverser;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet;
@@ -52,7 +52,6 @@ import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertex;
import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertexProperty;
import org.apache.tinkerpop.gremlin.structure.util.star.StarGraph;
import org.apache.tinkerpop.gremlin.structure.util.star.StarGraphSerializer;
-import org.apache.tinkerpop.gremlin.util.tools.BiMap;
import org.apache.tinkerpop.shaded.kryo.Kryo;
import org.apache.tinkerpop.shaded.kryo.KryoSerializable;
import org.apache.tinkerpop.shaded.kryo.Serializer;
@@ -199,8 +198,7 @@ public final class GryoMapper implements Mapper<Kryo> {
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(ReferenceVertex.class, null, 84));
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(ReferencePath.class, null, 85));
- add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(StarGraph.class, kryo -> StarGraphSerializer.with(Direction.BOTH), 86));
- add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(BiMap.class, null, 87));// ***LAST ID**
+ add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(StarGraph.class, kryo -> StarGraphSerializer.with(Direction.BOTH), 86)); // ***LAST ID**
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Edge.class, kryo -> new GraphSerializer.EdgeSerializer(), 65));
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Vertex.class, kryo -> new GraphSerializer.VertexSerializer(), 66));
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/bd182de8/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
index 98e745c..d7562fb 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
@@ -37,7 +37,6 @@ import org.apache.tinkerpop.gremlin.structure.util.Attachable;
import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
-import org.apache.tinkerpop.gremlin.util.tools.BiMap;
import java.io.Serializable;
import java.util.ArrayList;
@@ -64,8 +63,6 @@ public final class StarGraph implements Graph, Serializable {
protected StarVertex starVertex = null;
protected Map<Object, Map<String, Object>> edgeProperties = null;
protected Map<Object, Map<String, Object>> metaProperties = null;
- protected BiMap<Short, String> labelsAndKeys = new BiMap<>();
- protected short nextLabelsAndKeysId = Short.MIN_VALUE; // 64k unique labels allowed
private StarGraph() {
}
@@ -202,15 +199,11 @@ public final class StarGraph implements Graph, Serializable {
public abstract class StarElement<E extends Element> implements Element, Attachable<E> {
protected final Object id;
- protected final short labelId;
+ protected final String label;
protected StarElement(final Object id, final String label) {
this.id = id;
- if (!labelsAndKeys.containsValue(label.intern())) {
- this.labelId = nextLabelsAndKeysId++;
- labelsAndKeys.put(this.labelId, label.intern());
- } else
- this.labelId = labelsAndKeys.getKey(label.intern());
+ this.label = label.intern();
}
@Override
@@ -220,7 +213,7 @@ public final class StarGraph implements Graph, Serializable {
@Override
public String label() {
- return labelsAndKeys.getValue(this.labelId);
+ return this.label;
}
@Override
@@ -659,23 +652,19 @@ public final class StarGraph implements Graph, Serializable {
public final class StarProperty<V> implements Property<V>, Attachable<Property<V>> {
- private final short keyId;
+ private final String key;
private final V value;
private final Element element;
private StarProperty(final String key, final V value, final Element element) {
- if (!labelsAndKeys.containsValue(key.intern())) {
- this.keyId = nextLabelsAndKeysId++;
- labelsAndKeys.put(this.keyId, key.intern());
- } else
- this.keyId = labelsAndKeys.getKey(key.intern());
+ this.key = key.intern();
this.value = value;
this.element = element;
}
@Override
public String key() {
- return labelsAndKeys.getValue(this.keyId);
+ return this.key();
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/bd182de8/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphSerializer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphSerializer.java
index 9107142..8ab1d4b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphSerializer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphSerializer.java
@@ -25,7 +25,6 @@ import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
-import org.apache.tinkerpop.gremlin.util.tools.BiMap;
import org.apache.tinkerpop.shaded.kryo.Kryo;
import org.apache.tinkerpop.shaded.kryo.Serializer;
import org.apache.tinkerpop.shaded.kryo.io.Input;
@@ -69,17 +68,15 @@ public final class StarGraphSerializer extends Serializer<StarGraph> {
kryo.writeObject(output, starGraph.nextId);
kryo.writeObjectOrNull(output, starGraph.edgeProperties, HashMap.class);
kryo.writeObjectOrNull(output, starGraph.metaProperties, HashMap.class);
- kryo.writeObject(output, starGraph.labelsAndKeys);
- kryo.writeObject(output, starGraph.nextLabelsAndKeysId);
kryo.writeClassAndObject(output, starGraph.starVertex.id);
- kryo.writeObject(output, starGraph.starVertex.labelId);
+ kryo.writeObject(output, starGraph.starVertex.label);
writeEdges(kryo, output, starGraph, Direction.IN);
writeEdges(kryo, output, starGraph, Direction.OUT);
kryo.writeObject(output, null != starGraph.starVertex.vertexProperties);
if (null != starGraph.starVertex.vertexProperties) {
kryo.writeObject(output, starGraph.starVertex.vertexProperties.size());
for (final Map.Entry<String, List<VertexProperty>> vertexProperties : starGraph.starVertex.vertexProperties.entrySet()) {
- kryo.writeObject(output, starGraph.labelsAndKeys.getKey(vertexProperties.getKey()));
+ kryo.writeObject(output, vertexProperties.getKey());
kryo.writeObject(output, vertexProperties.getValue().size());
for (final VertexProperty vertexProperty : vertexProperties.getValue()) {
kryo.writeClassAndObject(output, vertexProperty.id());
@@ -95,15 +92,13 @@ public final class StarGraphSerializer extends Serializer<StarGraph> {
starGraph.nextId = kryo.readObject(input, Long.class);
starGraph.edgeProperties = kryo.readObjectOrNull(input, HashMap.class);
starGraph.metaProperties = kryo.readObjectOrNull(input, HashMap.class);
- starGraph.labelsAndKeys = kryo.readObject(input, BiMap.class);
- starGraph.nextLabelsAndKeysId = kryo.readObject(input, Short.class);
- starGraph.addVertex(T.id, kryo.readClassAndObject(input), T.label, starGraph.labelsAndKeys.getValue(kryo.readObject(input, Short.class)));
+ starGraph.addVertex(T.id, kryo.readClassAndObject(input), T.label, kryo.readObject(input, String.class));
readEdges(kryo, input, starGraph, Direction.IN);
readEdges(kryo, input, starGraph, Direction.OUT);
if (kryo.readObject(input, Boolean.class)) {
final int numberOfUniqueKeys = kryo.readObject(input, Integer.class);
for (int i = 0; i < numberOfUniqueKeys; i++) {
- final String vertexPropertyKey = starGraph.labelsAndKeys.getValue(kryo.readObject(input, Short.class));
+ final String vertexPropertyKey = kryo.readObject(input, String.class);
final int numberOfVertexPropertiesWithKey = kryo.readObject(input, Integer.class);
for (int j = 0; j < numberOfVertexPropertiesWithKey; j++) {
final Object id = kryo.readClassAndObject(input);
@@ -125,7 +120,7 @@ public final class StarGraphSerializer extends Serializer<StarGraph> {
if (writeEdges) {
kryo.writeObject(output, starEdges.size());
for (final Map.Entry<String, List<Edge>> edges : starEdges.entrySet()) {
- kryo.writeObject(output, starGraph.labelsAndKeys.getKey(edges.getKey()));
+ kryo.writeObject(output, edges.getKey());
kryo.writeObject(output, edges.getValue().size());
for (final Edge edge : edges.getValue()) {
kryo.writeClassAndObject(output, edge.id());
@@ -139,7 +134,7 @@ public final class StarGraphSerializer extends Serializer<StarGraph> {
if (kryo.readObject(input, Boolean.class)) {
final int numberOfUniqueLabels = kryo.readObject(input, Integer.class);
for (int i = 0; i < numberOfUniqueLabels; i++) {
- final String edgeLabel = starGraph.labelsAndKeys.getValue(kryo.readObject(input, Short.class));
+ final String edgeLabel = kryo.readObject(input, String.class);
final int numberOfEdgesWithLabel = kryo.readObject(input, Integer.class);
for (int j = 0; j < numberOfEdgesWithLabel; j++) {
final Object edgeId = kryo.readClassAndObject(input);
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/bd182de8/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/tools/BiMap.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/tools/BiMap.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/tools/BiMap.java
deleted file mode 100644
index 29dc4cf..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/tools/BiMap.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *
- * * Licensed to the Apache Software Foundation (ASF) under one
- * * or more contributor license agreements. See the NOTICE file
- * * distributed with this work for additional information
- * * regarding copyright ownership. The ASF licenses this file
- * * to you under the Apache License, Version 2.0 (the
- * * "License"); you may not use this file except in compliance
- * * with the License. You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing,
- * * software distributed under the License is distributed on an
- * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * * KIND, either express or implied. See the License for the
- * * specific language governing permissions and limitations
- * * under the License.
- *
- */
-
-package org.apache.tinkerpop.gremlin.util.tools;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class BiMap<K, V> implements Serializable {
-
- private Map<K, V> leftMap = new HashMap<>();
- private Map<V, K> rightMap = new HashMap<>();
-
- public int size() {
- return this.leftMap.size();
- }
-
- public boolean isEmpty() {
- return this.leftMap.isEmpty();
- }
-
- public boolean containsKey(final K key) {
- return this.leftMap.containsKey(key);
- }
-
- public boolean containsValue(final V value) {
- return this.rightMap.containsKey(value);
- }
-
- public V getValue(final K key) {
- return this.leftMap.get(key);
- }
-
- public K getKey(final V value) {
- return this.rightMap.get(value);
- }
-
- public V put(final K key, final V value) {
- this.rightMap.put(value, key);
- return this.leftMap.put(key, value);
- }
-
- public V removeKey(final K key) {
- final V v = this.leftMap.remove(key);
- if (null != v)
- this.rightMap.remove(v);
- return v;
- }
-
- public K removeValue(final V value) {
- final K k = this.rightMap.remove(value);
- if (null != k)
- this.leftMap.remove(k);
- return k;
- }
-
- public void clear() {
- this.leftMap.clear();
- this.rightMap.clear();
- }
-
- public Set<K> keySet() {
- return this.leftMap.keySet();
- }
-
- public Set<V> valueSet() {
- return this.rightMap.keySet();
- }
-}
[3/7] incubator-tinkerpop git commit: Minor updates to GraphReader
javadoc.
Posted by ok...@apache.org.
Minor updates to GraphReader javadoc.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/9de25cfa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/9de25cfa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/9de25cfa
Branch: refs/heads/p-predicate-model
Commit: 9de25cfa5ad994082aa627b0f9251b58424877aa
Parents: f9f98bd
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 24 15:55:57 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 24 15:55:57 2015 -0400
----------------------------------------------------------------------
.../gremlin/structure/io/GraphReader.java | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9de25cfa/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 5aad86f..5682c19 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
@@ -38,7 +38,9 @@ import java.util.function.Function;
public interface GraphReader {
/**
- * Reads an entire graph from an {@link InputStream}.
+ * Reads an entire graph from an {@link InputStream}. This method is mean to load an empty {@link Graph}.
+ * 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}
*/
@@ -46,6 +48,8 @@ public interface GraphReader {
/**
* Reads a single vertex from an {@link InputStream}. This method will read vertex properties but not edges.
+ * 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
@@ -55,7 +59,8 @@ public interface GraphReader {
/**
* Reads a single vertex from an {@link InputStream}. This method will read vertex properties as well as edges
- * given the direction supplied as an argument.
+ * 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
@@ -72,8 +77,10 @@ public interface GraphReader {
/**
* Reads a set of 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.
+ * {@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
@@ -89,7 +96,9 @@ public interface GraphReader {
final Direction attachEdgesOfThisDirection) throws IOException;
/**
- * Reads a single edge from an {@link InputStream}.
+ * Reads a single edge from an {@link InputStream}. 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 edgeAttachMethod a function that creates an edge from the stream where the first argument is the edge
[7/7] incubator-tinkerpop git commit: P now has toString(), hashCode(),
and equals() implemented.
Posted by ok...@apache.org.
P now has toString(), hashCode(), and equals() implemented.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/4be24b61
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/4be24b61
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/4be24b61
Branch: refs/heads/p-predicate-model
Commit: 4be24b6109b832c073f0c863c0d6d752d3e15f90
Parents: 1cdcf1f
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Apr 24 14:07:41 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri Apr 24 14:07:41 2015 -0600
----------------------------------------------------------------------
.../org/apache/tinkerpop/gremlin/structure/P.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4be24b61/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/P.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/P.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/P.java
index 43fcd5a..f0e162e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/P.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/P.java
@@ -48,10 +48,28 @@ public class P<V> implements Predicate<V>, Serializable {
return this.value;
}
+ @Override
public boolean test(final V testValue) {
return this.biPredicate.test(testValue, this.value);
}
+ @Override
+ public int hashCode() {
+ return this.biPredicate.hashCode() + this.value.hashCode();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ return other instanceof P && (
+ (P) other).getBiPredicate().equals(this.biPredicate) &&
+ ((((P) other).getValue() == null && this.getValue() == null) || ((P) other).getValue().equals(this.getValue()));
+ }
+
+ @Override
+ public String toString() {
+ return this.biPredicate.toString() + "(" + this.value + ")";
+ }
+
//////////////// statics
public static <V> P<V> eq(final V value) {
[2/7] incubator-tinkerpop git commit: unignored Joshs
GryoReaderRecordWriterTest.
Posted by ok...@apache.org.
unignored Joshs GryoReaderRecordWriterTest.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/506f6323
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/506f6323
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/506f6323
Branch: refs/heads/p-predicate-model
Commit: 506f6323c632a42e0a5db703a40a104816476007
Parents: f9f98bd
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Apr 24 13:53:55 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri Apr 24 13:54:14 2015 -0600
----------------------------------------------------------------------
.../hadoop/structure/io/gryo/GryoRecordReaderWriterTest.java | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/506f6323/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReaderWriterTest.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReaderWriterTest.java b/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReaderWriterTest.java
index cf15b2f..656bc96 100644
--- a/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReaderWriterTest.java
+++ b/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReaderWriterTest.java
@@ -48,7 +48,6 @@ import static org.junit.Assert.assertTrue;
*/
public class GryoRecordReaderWriterTest {
@Test
- @org.junit.Ignore
public void testAll() throws Exception {
final Configuration configuration = new Configuration(false);
configuration.set("fs.file.impl", LocalFileSystem.class.getName());
[4/7] incubator-tinkerpop git commit: Merge remote-tracking branch
'origin/master'
Posted by ok...@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/8048b1e1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/8048b1e1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/8048b1e1
Branch: refs/heads/p-predicate-model
Commit: 8048b1e11ab8efd2947e3a048162b885920c16ad
Parents: 9de25cf 506f632
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 24 15:56:14 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 24 15:56:14 2015 -0400
----------------------------------------------------------------------
.../hadoop/structure/io/gryo/GryoRecordReaderWriterTest.java | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------