org.apache.tinkerpop.gremlin.process.traversal.Traversal.next()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(110)

本文整理了Java中org.apache.tinkerpop.gremlin.process.traversal.Traversal.next()方法的一些代码示例,展示了Traversal.next()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Traversal.next()方法的具体详情如下:
包路径:org.apache.tinkerpop.gremlin.process.traversal.Traversal
类名称:Traversal
方法名:next

Traversal.next介绍

[英]Get the next n-number of results from the traversal. If the traversal has less than n-results, then only that number of results are returned.
[中]从遍历中获取下一个n个结果。如果遍历的结果少于n个,则只返回该数量的结果。

代码示例

代码示例来源:origin: apache/tinkerpop

@Test
@LoadGraphWith(MODERN)
public void g_V_emit_repeatXa_outXknows_filterXloops_isX0XX_lang() {
  final Traversal<Vertex, String> traversal = get_g_V_emit_repeatXa_outXknows_filterXloops_isX0XX_lang();
  printTraversalForm(traversal);
  assertTrue(traversal.hasNext());
  String lang = traversal.next();
  assertEquals(lang, "java");
  assertTrue(traversal.hasNext());
  lang = traversal.next();
  assertEquals(lang, "java");
  assertFalse(traversal.hasNext());
}

代码示例来源:origin: apache/tinkerpop

@Test
@LoadGraphWith(MODERN)
public void g_withSackXBigInteger_TEN_powX1000X_assignX_V_localXoutXknowsX_barrierXnormSackXX_inXknowsX_barrier_sack() {
  final Traversal<Vertex, BigDecimal> traversal = get_g_withSackXBigInteger_TEN_powX1000X_assignX_V_localXoutXknowsX_barrierXnormSackXX_inXknowsX_barrier_sack();
  printTraversalForm(traversal);
  final BigDecimal half = BigDecimal.ONE.divide(BigDecimal.ONE.add(BigDecimal.ONE));
  assertTrue(traversal.hasNext());
  assertEquals(half, traversal.next());
  assertTrue(traversal.hasNext());
  assertEquals(half, traversal.next());
  assertFalse(traversal.hasNext());
}

代码示例来源:origin: apache/tinkerpop

@Test
@LoadGraphWith(MODERN)
public void g_V_hasLabelXsoftwareX_group_byXnameX_byXbothE_weight_minX() {
  final Traversal<Vertex, Map<String, Number>> traversal = get_g_V_hasLabelXsoftwareX_group_byXnameX_byXbothE_weight_minX();
  printTraversalForm(traversal);
  assertTrue(traversal.hasNext());
  final Map<String, Number> map = traversal.next();
  assertFalse(traversal.hasNext());
  assertEquals(2, map.size());
  assertEquals(1.0, map.get("ripple"));
  assertEquals(0.2, map.get("lop"));
}

代码示例来源:origin: apache/tinkerpop

private static void assertCommonB(final Traversal<Vertex, Edge> traversal) {
  assertTrue(traversal.hasNext());
  assertTrue(traversal.hasNext());
  final Edge edge = traversal.next();
  assertEquals("knows", edge.label());
  assertEquals(1.0d, edge.<Double>value("weight"), 0.00001d);
  assertFalse(traversal.hasNext());
  assertFalse(traversal.hasNext());
}

代码示例来源:origin: apache/tinkerpop

@Test
@LoadGraphWith(MODERN)
public void g_V_untilXconstantXtrueXX_repeatXrepeatXout_createdXX_untilXhasXname_rippleXXXemit_lang() {
  final Traversal<Vertex, String> traversal = get_g_V_untilXconstantXtrueXX_repeatXrepeatXout_createdXX_untilXhasXname_rippleXXXemit_lang();
  printTraversalForm(traversal);
  assertTrue(traversal.hasNext());
  String lang = traversal.next();
  assertEquals(lang, "java");
  assertTrue(traversal.hasNext());
  lang = traversal.next();
  assertEquals(lang, "java");
  assertFalse(traversal.hasNext());
}

代码示例来源:origin: apache/tinkerpop

@Test
@LoadGraphWith(MODERN)
public void g_V_hasLabelXsoftwareX_group_byXnameX_byXbothE_weight_maxX() {
  final Traversal<Vertex, Map<String, Number>> traversal = get_g_V_hasLabelXsoftwareX_group_byXnameX_byXbothE_weight_maxX();
  printTraversalForm(traversal);
  assertTrue(traversal.hasNext());
  final Map<String, Number> map = traversal.next();
  assertFalse(traversal.hasNext());
  assertEquals(2, map.size());
  assertEquals(1.0, map.get("ripple"));
  assertEquals(0.4, map.get("lop"));
}

代码示例来源:origin: apache/tinkerpop

@Test
@LoadGraphWith(MODERN)
public void g_V_hasLabelXsoftwareX_group_byXnameX_byXbothE_weight_meanX() {
  final Traversal<Vertex, Map<String, Number>> traversal = get_g_V_hasLabelXsoftwareX_group_byXnameX_byXbothE_weight_meanX();
  printTraversalForm(traversal);
  assertTrue(traversal.hasNext());
  final Map<String, Number> map = traversal.next();
  assertFalse(traversal.hasNext());
  assertEquals(2, map.size());
  assertEquals(1.0, map.get("ripple"));
  assertEquals(1.0 / 3, map.get("lop"));
}

代码示例来源:origin: apache/tinkerpop

@Test
@LoadGraphWith(MODERN)
public void g_V_out_out_matchXa_0created_b__b_0knows_cX_selectXcX_outXcreatedX_name() throws Exception {
  final Traversal<Vertex, String> traversal = get_g_V_out_out_matchXa_0created_b__b_0knows_cX_selectXcX_outXcreatedX_name();
  printTraversalForm(traversal);
  assertEquals("lop", traversal.next());
  assertEquals("lop", traversal.next());
  assertFalse(traversal.hasNext());
}

代码示例来源:origin: apache/tinkerpop

@Test
@LoadGraphWith(MODERN)
public void g_V_hasLabelXpersonX_asXpX_outXcreatedX_group_byXnameX_byXselectXpX_valuesXageX_sumX() {
  final Traversal<Vertex, Map<String, Number>> traversal = get_g_V_hasLabelXpersonX_asXpX_outXcreatedX_group_byXnameX_byXselectXpX_valuesXageX_sumX();
  printTraversalForm(traversal);
  final Map<String, Number> map = traversal.next();
  assertEquals(2, map.size());
  assertTrue(map.containsKey("ripple"));
  assertTrue(map.containsKey("lop"));
  assertEquals(32L, map.get("ripple"));
  assertEquals(96L, map.get("lop"));
  assertFalse(traversal.hasNext());
}

代码示例来源:origin: apache/tinkerpop

@Test
@LoadGraphWith(MODERN)
public void g_V_hasLabelXsoftwareX_group_byXnameX_byXbothE_weight_sumX() {
  final Traversal<Vertex, Map<String, Number>> traversal = get_g_V_hasLabelXsoftwareX_group_byXnameX_byXbothE_weight_sumX();
  printTraversalForm(traversal);
  assertTrue(traversal.hasNext());
  final Map<String, Number> map = traversal.next();
  assertFalse(traversal.hasNext());
  assertEquals(2, map.size());
  assertEquals(1.0, map.get("ripple"));
  assertEquals(1.0, map.get("lop"));
}

代码示例来源:origin: apache/tinkerpop

@Test
@LoadGraphWith(MODERN)
public void g_V_outXcreatedX_unionXasXprojectX_inXcreatedX_hasXname_markoX_selectXprojectX__asXprojectX_inXcreatedX_inXknowsX_hasXname_markoX_selectXprojectXX_groupCount_byXnameX() {
  Traversal<Vertex, Map<String, Long>> traversal = get_g_V_outXcreatedX_unionXasXprojectX_inXcreatedX_hasXname_markoX_selectXprojectX__asXprojectX_inXcreatedX_inXknowsX_hasXname_markoX_selectXprojectXX_groupCount_byXnameX();
  printTraversalForm(traversal);
  assertTrue(traversal.hasNext());
  final Map<String, Long> map = traversal.next();
  assertFalse(traversal.hasNext());
  assertEquals(2, map.size());
  assertEquals(1l, map.get("ripple").longValue());
  assertEquals(6l, map.get("lop").longValue());
}

代码示例来源:origin: apache/tinkerpop

@Test
@LoadGraphWith(MODERN)
public void g_V_label_groupCount_asXxX_selectXxX() {
  final Traversal<Vertex, Map<String, Long>> traversal = get_g_V_label_groupCount_asXxX_selectXxX();
  printTraversalForm(traversal);
  assertTrue(traversal.hasNext());
  final Map<String, Long> map1 = traversal.next();
  assertEquals(2, map1.size());
  assertTrue(map1.containsKey("person"));
  assertTrue(map1.containsKey("software"));
  assertEquals(2, map1.get("software").longValue());
  assertEquals(4, map1.get("person").longValue());
  assertFalse(traversal.hasNext());
}

代码示例来源:origin: apache/tinkerpop

@LoadGraphWith(MODERN)
public void g_V_repeatXa_outXknows_repeatXb_outXcreatedX_filterXloops_isX0XX_emit_lang() {
  final Traversal<Vertex, String> traversal = get_g_V_repeatXa_outXknows_repeatXb_outXcreatedX_filterXloops_isX0XX_emit_lang();
  printTraversalForm(traversal);
  assertTrue(traversal.hasNext());
  String lang = traversal.next();
  assertEquals(lang, "java");
  assertTrue(traversal.hasNext());
  lang = traversal.next();
  assertEquals(lang, "java");
  assertFalse(traversal.hasNext());
}

代码示例来源:origin: apache/tinkerpop

private void assert_g_EX11X(final Object edgeId, final Traversal<Edge, Edge> traversal) {
  printTraversalForm(traversal);
  assertTrue(traversal.hasNext());
  final Edge e = traversal.next();
  assertEquals(edgeId, e.id());
  assertFalse(traversal.hasNext());
}

代码示例来源:origin: apache/tinkerpop

private void assert_g_EX11X(final Object edgeId, final Traversal<Edge, Edge> traversal) {
  printTraversalForm(traversal);
  assertTrue(traversal.hasNext());
  final Edge e = traversal.next();
  assertEquals(edgeId, e.id());
  assertFalse(traversal.hasNext());
}

代码示例来源:origin: apache/tinkerpop

@Test
@LoadGraphWith(MODERN)
public void g_V_group_byXlabelX_byXbothE_weight_fold_sampleXlocal_5XX() {
  final Traversal<Vertex, Map<String, Collection<Double>>> traversal =
      get_g_V_group_byXlabelX_byXbothE_weight_fold_sampleXlocal_5XX();
  printTraversalForm(traversal);
  assertTrue(traversal.hasNext());
  final Map<String, Collection<Double>> map = traversal.next();
  assertFalse(traversal.hasNext());
  assertEquals(2, map.size());
  assertEquals(4, map.get("software").size());
  assertEquals(5, map.get("person").size());
}

代码示例来源:origin: apache/tinkerpop

@Test
@LoadGraphWith(MODERN)
public void g_V_unionXrepeatXunionXoutXcreatedX__inXcreatedXX_timesX2X__repeatXunionXinXcreatedX__outXcreatedXX_timesX2XX_label_groupCount() {
  final Traversal<Vertex, Map<String, Long>> traversal = get_g_V_unionXrepeatXunionXoutXcreatedX__inXcreatedXX_timesX2X__repeatXunionXinXcreatedX__outXcreatedXX_timesX2XX_label_groupCount();
  printTraversalForm(traversal);
  final Map<String, Long> groupCount = traversal.next();
  assertFalse(traversal.hasNext());
  assertEquals(12l, groupCount.get("software").longValue());
  assertEquals(20l, groupCount.get("person").longValue());
  assertEquals(2, groupCount.size());
}

代码示例来源:origin: apache/tinkerpop

@Test
@LoadGraphWith(MODERN)
public void g_withSackX2X_V_sackXdivX_byXconstantX3_0XX_sack() {
  final Traversal<Vertex, Double> traversal = get_g_withSackX2X_V_sackXdivX_byXconstantX3_0XX_sack();
  printTraversalForm(traversal);
  final double expected = 2.0 / 3.0;
  for (int i = 0; i < 6; i++) {
    assertTrue(traversal.hasNext());
    assertEquals(expected, ((Number) traversal.next()).doubleValue(), 0.0001);
  }
  assertFalse(traversal.hasNext());
}

代码示例来源:origin: apache/tinkerpop

@Test
@LoadGraphWith(MODERN)
public void g_VX1X_outXcreatedX_valueMap() {
  final Traversal<Vertex, Map<Object, List<String>>> traversal = get_g_VX1X_outXcreatedX_valueMap(convertToVertexId("marko"));
  printTraversalForm(traversal);
  assertTrue(traversal.hasNext());
  final Map<Object, List<String>> values = traversal.next();
  assertFalse(traversal.hasNext());
  assertEquals("lop", values.get("name").get(0));
  assertEquals("java", values.get("lang").get(0));
  assertEquals(2, values.size());
}

代码示例来源:origin: apache/tinkerpop

@Test
@LoadGraphWith(MODERN)
public void g_E_sampleX1X() {
  final Traversal<Edge, Edge> traversal = get_g_E_sampleX1X();
  assertTrue(traversal.hasNext());
  traversal.next();
  assertFalse(traversal.hasNext());
}

相关文章