Repository: tinkerpop Updated Branches: refs/heads/tp32 f6ce25fca -> 8637b951a
Configured integer IdManager for Modern toy graph Not sure why this was never set up this way from the start. Classic graph was already working as expected. CTR Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/bb2d1804 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/bb2d1804 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/bb2d1804 Branch: refs/heads/tp32 Commit: bb2d18042af0ff930700731b9b26f74e9d2b1502 Parents: 7a08077 Author: Stephen Mallette <[email protected]> Authored: Fri Jun 2 19:43:17 2017 -0400 Committer: Stephen Mallette <[email protected]> Committed: Fri Jun 2 19:43:17 2017 -0400 ---------------------------------------------------------------------- CHANGELOG.asciidoc | 1 + .../tinkergraph/structure/TinkerFactory.java | 49 ++++---------------- 2 files changed, 10 insertions(+), 40 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bb2d1804/CHANGELOG.asciidoc ---------------------------------------------------------------------- diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 9bb0f47..7da968e 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima TinkerPop 3.1.7 (Release Date: NOT OFFICIALLY RELEASED YET) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* Configured Modern graph to work with a integer `IdManager` when `TinkerFactory.createModern()` is called. * Added XSLT transform option to convert TinkerPop 2.x GraphML to 3.x GraphML. * Added validation to `StarVertexProperty`. * Bumped to Jackson 2.8.7. http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bb2d1804/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java ---------------------------------------------------------------------- diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java index a1a1cad..4c38070 100644 --- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java +++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java @@ -40,12 +40,7 @@ public final class TinkerFactory { private TinkerFactory() {} public static TinkerGraph createClassic() { - final Configuration conf = new BaseConfiguration(); - conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_VERTEX_ID_MANAGER, TinkerGraph.DefaultIdManager.INTEGER.name()); - conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_EDGE_ID_MANAGER, TinkerGraph.DefaultIdManager.INTEGER.name()); - conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_VERTEX_PROPERTY_ID_MANAGER, TinkerGraph.DefaultIdManager.INTEGER.name()); - - final TinkerGraph g = TinkerGraph.open(conf); + final TinkerGraph g = getTinkerGraphWithIntegerManager(); generateClassic(g); return g; } @@ -66,7 +61,7 @@ public final class TinkerFactory { } public static TinkerGraph createModern() { - final TinkerGraph g = TinkerGraph.open(); + final TinkerGraph g = getTinkerGraphWithIntegerManager(); generateModern(g); return g; } @@ -144,38 +139,12 @@ public final class TinkerFactory { g.variables().set("comment", "this graph was created to provide examples and test coverage for tinkerpop3 api advances"); } - /*public interface SocialTraversal<S, E> extends Traversal.Admin<S, E> { - - public SocialTraversal<S, Vertex> people(final String name); - - public default SocialTraversal<S, Vertex> knows() { - return (SocialTraversal) this.addStep(new LambdaFlatMapStep<Vertex, Vertex>(this, v -> v.get().vertices(Direction.OUT, "knows"))); - } - - public default SocialTraversal<S, Vertex> created() { - return (SocialTraversal) this.addStep(new LambdaFlatMapStep<Vertex, Vertex>(this, v -> v.get().vertices(Direction.OUT, "created"))); - } - - public default SocialTraversal<S, String> name() { - return (SocialTraversal) this.addStep(new LambdaMapStep<Vertex, String>(this, v -> v.get().<String>value("name"))); - } - - public static <S> SocialTraversal<S, S> of(final Graph graph) { - return new DefaultSocialTraversal<>(graph); - } - - public class DefaultSocialTraversal<S, E> extends DefaultTraversal<S, E> implements SocialTraversal<S, E> { - private final Graph graph; - - public DefaultSocialTraversal(final Graph graph) { - super(graph); // should be SocialGraph.class, SocialVertex.class, etc. Perhaps... - this.graph = graph; - } - - public SocialTraversal<S, Vertex> people(final String name) { - return (SocialTraversal) this.addStep(new StartStep<>(this, this.graph.traversal().V().has("name", name))); - } + private static TinkerGraph getTinkerGraphWithIntegerManager() { + final Configuration conf = new BaseConfiguration(); + conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_VERTEX_ID_MANAGER, TinkerGraph.DefaultIdManager.INTEGER.name()); + conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_EDGE_ID_MANAGER, TinkerGraph.DefaultIdManager.INTEGER.name()); + conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_VERTEX_PROPERTY_ID_MANAGER, TinkerGraph.DefaultIdManager.INTEGER.name()); - } - }*/ + return TinkerGraph.open(conf); + } }
