@Parameterized.Parameters(name = "expectInterruption({0})") public static Iterable<Object[]> data() { return Arrays.asList(new Object[][]{ {"g_V", (Function<GraphTraversalSource, GraphTraversal<?,?>>) g -> g.V(), (UnaryOperator<GraphTraversal<?,?>>) t -> t}, {"g_V_out", (Function<GraphTraversalSource, GraphTraversal<?,?>>) g -> g.V(), (UnaryOperator<GraphTraversal<?,?>>) t -> t.out()}, {"g_V_outE", (Function<GraphTraversalSource, GraphTraversal<?,?>>) g -> g.V(), (UnaryOperator<GraphTraversal<?,?>>) t -> t.outE()}, {"g_V_in", (Function<GraphTraversalSource, GraphTraversal<?,?>>) g -> g.V(), (UnaryOperator<GraphTraversal<?,?>>) t -> t.in()}, {"g_V_inE", (Function<GraphTraversalSource, GraphTraversal<?,?>>) g -> g.V(), (UnaryOperator<GraphTraversal<?,?>>) t -> t.inE()}, {"g_V_properties", (Function<GraphTraversalSource, GraphTraversal<?,?>>) g -> g.V(), (UnaryOperator<GraphTraversal<?,?>>) t -> t.properties()}, {"g_E", (Function<GraphTraversalSource, GraphTraversal<?,?>>) g -> g.E(), (UnaryOperator<GraphTraversal<?,?>>) t -> t}, {"g_E_outV", (Function<GraphTraversalSource, GraphTraversal<?,?>>) g -> g.E(), (UnaryOperator<GraphTraversal<?,?>>) t -> t.outV()}, {"g_E_inV", (Function<GraphTraversalSource, GraphTraversal<?,?>>) g -> g.E(), (UnaryOperator<GraphTraversal<?,?>>) t -> t.inV()}, {"g_E_properties", (Function<GraphTraversalSource, GraphTraversal<?,?>>) g -> g.E(), (UnaryOperator<GraphTraversal<?,?>>) t -> t.properties()}, }); }
GraphTraversal<Vertex, Vertex> vertexs = g.V(); System.out.println(">>>> query all vertices: size=" + vertexs.toList().size()); edges.size()); List<Object> names = g.V().inE("knows").limit(2) .outV().values("name").toList(); System.out.println(">>>> query vertex(with props) of edges: " + names); assert names.size() == 2 : names.size(); names = g.V().as("a") .out("knows") .and() .out("created").in("created").as("a").values("name") .toList(); System.out.println(">>>> query with AND: " + names); assert vertex.size() == 1 && vertex.get(0).value("name").equals("lop"); List<Path> paths = g.V(markoId).out().out().path().by("name").toList(); System.out.println(">>>> test out path: " + paths); assert paths.size() == 2;
@Override public Traversal<Vertex, Map<String, String>> get_g_V_asXaX_outEXcreatedX_asXbX_inV_asXcX_inXcreatedX_asXdX_whereXa_ltXbX_orXgtXcXX_andXneqXdXXX_byXageX_byXweightX_byXinXcreatedX_valuesXageX_minX_selectXa_c_dX() { return g.V().as("a").outE("created").as("b").inV().as("c").in("created").as("d").where("a", lt("b").or(gt("c")).and(neq("d"))).by("age").by("weight").by(in("created").values("age").min()).<String>select("a", "c", "d").by("name"); }
@Override public Traversal<Vertex, Double> get_g_withBulkXfalseX_withSackX1_sumX_VX1X_localXoutEXknowsX_barrierXnormSackX_inVX_inXknowsX_barrier_sack(final Object v1Id) { return g.withBulk(false).withSack(1.0d, sum).V(v1Id).local(outE("knows").barrier(normSack).inV()).in("knows").barrier().sack(); }
@Parameterized.Parameters(name = "expectInterruption({0})") public static Iterable<Object[]> data() { return Arrays.asList(new Object[][]{ {"g_V", (Function<GraphTraversalSource, GraphTraversal<?,?>>) g -> g.V()}, {"g_V_out", (Function<GraphTraversalSource, GraphTraversal<?,?>>) g -> g.V().out()}, {"g_V_outE", (Function<GraphTraversalSource, GraphTraversal<?,?>>) g -> g.V().outE()}, {"g_V_in", (Function<GraphTraversalSource, GraphTraversal<?,?>>) g -> g.V().in()}, {"g_V_inE", (Function<GraphTraversalSource, GraphTraversal<?,?>>) g -> g.V().inE()}, {"g_V_properties", (Function<GraphTraversalSource, GraphTraversal<?,?>>) g -> g.V().properties()}, {"g_E", (Function<GraphTraversalSource, GraphTraversal<?,?>>) g -> g.E()}, {"g_E_outV", (Function<GraphTraversalSource, GraphTraversal<?,?>>) g -> g.E().outV()}, {"g_E_inV", (Function<GraphTraversalSource, GraphTraversal<?,?>>) g -> g.E().inV()}, {"g_E_properties", (Function<GraphTraversalSource, GraphTraversal<?,?>>) g -> g.E().properties()}, }); }
@Benchmark public GraphTraversal.Admin<Vertex,Vertex> testTranslationWithStrategy() { return translator.translate(g.withStrategies(ReadOnlyStrategy.instance()) .withStrategies(SubgraphStrategy.build().vertices(hasLabel("person")).create()) .V().out().in("link").out().in("link").asAdmin().getBytecode()); } }
assertEquals(6, g.V().count().next().longValue()); assertEquals(3, sg.V().count().next().longValue()); assertEquals(2, g.V(convertToVertexId("josh")).outE().count().next().longValue()); assertEquals(2, sg.V(convertToVertexId("josh")).outE().count().next().longValue()); assertEquals(2, g.V(convertToVertexId("josh")).out().count().next().longValue()); assertEquals(2, sg.V(convertToVertexId("josh")).out().count().next().longValue()); assertEquals(1, g.V(convertToVertexId("josh")).inE().count().next().longValue()); assertEquals(0, sg.V(convertToVertexId("josh")).inE().count().next().longValue()); assertEquals(1, g.V(convertToVertexId("josh")).in().count().next().longValue()); assertEquals(0, sg.V(convertToVertexId("josh")).in().count().next().longValue()); assertEquals(3, g.V(convertToVertexId("josh")).bothE().count().next().longValue()); assertEquals(2, g.V(convertToVertexId("josh")).outE("created").count().next().longValue()); assertEquals(2, sg.V(convertToVertexId("josh")).outE("created").count().next().longValue()); assertEquals(2, g.V(convertToVertexId("josh")).out("created").count().next().longValue()); assertEquals(2, sg.V(convertToVertexId("josh")).out("created").count().next().longValue()); assertEquals(2, g.V(convertToVertexId("josh")).bothE("created").count().next().longValue()); assertEquals(1, g.V(convertToVertexId("josh")).inE("knows").count().next().longValue()); assertEquals(0, sg.V(convertToVertexId("josh")).inE("knows").count().next().longValue()); assertEquals(1, g.V(convertToVertexId("josh")).in("knows").count().next().longValue()); assertEquals(0, sg.V(convertToVertexId("josh")).in("knows").count().next().longValue()); assertEquals(1, g.V(convertToVertexId("josh")).bothE("knows").count().next().longValue()); assertEquals(0, sg.V(convertToVertexId("josh")).bothE("knows").count().next().longValue());
addGraphStructureEntry(g.V().out().out().path().next(), "Path", ""); addGraphStructureEntry(graph.edges().next().properties().next(), "Property", ""); addGraphStructureEntry(graph, "TinkerGraph", "`TinkerGraph` has a custom serializer that is registered as part of the `TinkerIoRegistry`."); addEntry("Graph Structure", g.V(1).out().out().tree().next(), "Tree", "", Compatibilities.GRYO_ONLY.match()); addGraphStructureEntry(graph.vertices().next(), "Vertex", ""); addGraphStructureEntry(graph.vertices().next().properties().next(), "VertexProperty", ""); addGraphProcessEntry(bulkSet, "BulkSet", "", before3_4_0); addGraphProcessEntry(g.V().hasLabel("person").out().in().tree().asAdmin().getBytecode(), "Bytecode", "The following `Bytecode` example represents the traversal of `g.V().hasLabel('person').out().in().tree()`. Obviously the serialized `Bytecode` woudl be quite different for the endless variations of commands that could be used together in the Gremlin language.", Compatibilities.UNTYPED_GRAPHSON.matchToArray()); addGraphProcessEntry(VertexProperty.Cardinality.list, "Cardinality", "", Compatibilities.UNTYPED_GRAPHSON.matchToArray()); addGraphProcessEntry(Column.keys, "Column", "", Compatibilities.UNTYPED_GRAPHSON.matchToArray());