/** * Create the "the crew" graph which is a TinkerPop 3.x toy graph showcasing many 3.x features like meta-properties, * multi-properties and graph variables. */ public static TinkerGraph createTheCrew() { final Configuration conf = getNumberIdManagerConfiguration(); conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, VertexProperty.Cardinality.list.name()); final TinkerGraph g = TinkerGraph.open(conf); generateTheCrew(g); return g; }
/** * Creates the "grateful dead" graph which is a larger graph than most of the toy graphs but has real-world * structure and application and is therefore useful for demonstrating more complex traversals. */ public static TinkerGraph createGratefulDead() { final TinkerGraph g = getTinkerGraphWithNumberManager(); generateGratefulDead(g); return g; }
/** * Creates the "kitchen sink" graph which is a collection of structures (e.g. self-loops) that aren't represented * in other graphs and are useful for various testing scenarios. */ public static TinkerGraph createKitchenSink() { final TinkerGraph g = getTinkerGraphWithNumberManager(); generateKitchenSink(g); return g; }
/** * Create the "modern" graph which has the same structure as the "classic" graph from TinkerPop 2.x but includes * 3.x features like vertex labels. */ public static TinkerGraph createModern() { final TinkerGraph g = getTinkerGraphWithNumberManager(); generateModern(g); return g; }
switch (commandLine.getOptionValue("graph").toLowerCase()) { case "classic": graph = TinkerFactory.createClassic(); break; case "modern": graph = TinkerFactory.createModern(); break; case "crew": graph = TinkerFactory.createTheCrew(); break; default: graph = TinkerFactory.createModern();
@Test public void tinkerGraph() { TinkerGraph tinkerGraph = TinkerFactory.createModern(); GraphTraversalSource graphTraversalSource = tinkerGraph.traversal(); GremlinGraphDriver driver = new GremlinGraphDriver(graphTraversalSource); List<Map<String, Object>> results; try (Session session = driver.session()) { StatementResult result = session.run( "MATCH (n:person) " + "WHERE n.age = $age " + "RETURN n.name", parameters("age", 29) ); results = result.list().stream() .map(Record::asMap) .collect(toList()); } assertThat(results) .extracting("n.name") .containsExactly("marko"); } }
conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, VertexProperty.Cardinality.list.name()); final TinkerGraph graph = TinkerGraph.open(conf); TinkerFactory.generateTheCrew(graph); final GraphTraversalSource g = graph.traversal();
/** * Create the "classic" graph which was the original toy graph from TinkerPop 2.x. */ 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); generateClassic(g); return g; }
private static TinkerGraph getTinkerGraphWithNumberManager() { final Configuration conf = getNumberIdManagerConfiguration(); return TinkerGraph.open(conf); }
/** * Create the "modern" graph which has the same structure as the "classic" graph from TinkerPop 2.x but includes * 3.x features like vertex labels. */ public static TinkerGraph createModern() { final TinkerGraph g = getTinkerGraphWithNumberManager(); generateModern(g); return g; }
@Test public void inMemory() throws Exception { // freshReadmeSnippet: inMemory TinkerGraph graph = TinkerFactory.createModern(); GraphTraversalSource traversal = graph.traversal(); Driver driver = GremlinDatabase.driver(traversal); // freshReadmeSnippet: inMemory try (Session session = driver.session()) { StatementResult result = session.run("RETURN 'Hello'"); String message = result.single().get(0).asString(); assertThat(message).isEqualTo("Hello"); } }
/** * Create the "classic" graph which was the original toy graph from TinkerPop 2.x. */ 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); generateClassic(g); return g; }
private static TinkerGraph getTinkerGraphWithNumberManager() { final Configuration conf = getNumberIdManagerConfiguration(); return TinkerGraph.open(conf); }
/** * Create the "the crew" graph which is a TinkerPop 3.x toy graph showcasing many 3.x features like meta-properties, * multi-properties and graph variables. */ public static TinkerGraph createTheCrew() { final Configuration conf = getNumberIdManagerConfiguration(); conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, VertexProperty.Cardinality.list.name()); final TinkerGraph g = TinkerGraph.open(conf); generateTheCrew(g); return g; }
/** * Create the "modern" graph which has the same structure as the "classic" graph from TinkerPop 2.x but includes * 3.x features like vertex labels. */ public static TinkerGraph createModern() { final TinkerGraph g = getTinkerGraphWithNumberManager(); generateModern(g); return g; }
/** * Creates the "grateful dead" graph which is a larger graph than most of the toy graphs but has real-world * structure and application and is therefore useful for demonstrating more complex traversals. */ public static TinkerGraph createGratefulDead() { final TinkerGraph g = getTinkerGraphWithNumberManager(); generateGratefulDead(g); return g; }
/** * Creates the "kitchen sink" graph which is a collection of structures (e.g. self-loops) that aren't represented * in other graphs and are useful for various testing scenarios. */ public static TinkerGraph createKitchenSink() { final TinkerGraph g = getTinkerGraphWithNumberManager(); generateKitchenSink(g); return g; }
@Test public void inMemory() { // freshReadmeSnippet: inMemory TinkerGraph graph = TinkerFactory.createModern(); GraphTraversalSource traversal = graph.traversal(); CypherGremlinClient cypherGremlinClient = CypherGremlinClient.inMemory(traversal); String cypher = "MATCH (p:person) WHERE p.age > 25 RETURN p.name"; List<Map<String, Object>> results = cypherGremlinClient.submit(cypher).all(); // freshReadmeSnippet: inMemory assertThat(results) .extracting("p.name") .containsExactly("marko", "vadas", "josh", "peter"); }
/** * Create the "classic" graph which was the original toy graph from TinkerPop 2.x. */ 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); generateClassic(g); return g; }
private static TinkerGraph getTinkerGraphWithNumberManager() { final Configuration conf = getNumberIdManagerConfiguration(); return TinkerGraph.open(conf); }