当前位置: 首页>>代码示例>>Java>>正文


Java Traversal.next方法代码示例

本文整理汇总了Java中org.apache.tinkerpop.gremlin.process.traversal.Traversal.next方法的典型用法代码示例。如果您正苦于以下问题:Java Traversal.next方法的具体用法?Java Traversal.next怎么用?Java Traversal.next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tinkerpop.gremlin.process.traversal.Traversal的用法示例。


在下文中一共展示了Traversal.next方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: g_V_both_groupCountXaX_out_capXaX_selectXkeysX_unfold_both_groupCountXaX_capXaX

import org.apache.tinkerpop.gremlin.process.traversal.Traversal; //导入方法依赖的package包/类
@Test
@LoadGraphWith(MODERN)
public void g_V_both_groupCountXaX_out_capXaX_selectXkeysX_unfold_both_groupCountXaX_capXaX() {
    final Traversal<Vertex, Map<Vertex, Long>> traversal = get_g_V_both_groupCountXaX_out_capXaX_selectXkeysX_unfold_both_groupCountXaX_capXaX();
    printTraversalForm(traversal);
    //  [{v[1]=6, v[2]=2, v[3]=6, v[4]=6, v[5]=2, v[6]=2}]
    final Map<Vertex, Long> map = traversal.next();
    assertFalse(traversal.hasNext());
    assertEquals(6, map.size());
    assertEquals(6l, map.get(convertToVertex(graph, "marko")).longValue());
    assertEquals(2l, map.get(convertToVertex(graph, "vadas")).longValue());
    assertEquals(6l, map.get(convertToVertex(graph, "lop")).longValue());
    assertEquals(6l, map.get(convertToVertex(graph, "josh")).longValue());
    assertEquals(2l, map.get(convertToVertex(graph, "ripple")).longValue());
    assertEquals(6l, map.get(convertToVertex(graph, "marko")).longValue());
    checkSideEffects(traversal.asAdmin().getSideEffects(), "a", HashMap.class);
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:18,代码来源:GroupCountTest.java

示例2: g_VX1X_out_name_injectXdanielX_asXaX_mapXlengthX_path

import org.apache.tinkerpop.gremlin.process.traversal.Traversal; //导入方法依赖的package包/类
@Test
@LoadGraphWith(MODERN)
public void g_VX1X_out_name_injectXdanielX_asXaX_mapXlengthX_path() {
    final Traversal<Vertex, Path> traversal = get_g_VX1X_out_name_injectXdanielX_asXaX_mapXlengthX_path(convertToVertexId("marko"));
    printTraversalForm(traversal);
    int counter = 0;
    while (traversal.hasNext()) {
        counter++;
        final Path path = traversal.next();
        if (path.get("a").equals("daniel")) {
            assertEquals(2, path.size());
            assertEquals(6, (int) path.get(1));
        } else {
            assertEquals(4, path.size());
            assertEquals(path.<String>get("a").length(), (int) path.get(3));
        }
    }
    assertEquals(4, counter);
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:20,代码来源:InjectTest.java

示例3: g_V_hasXageX_asXaX_out_in_hasXageX_asXbX_selectXa_bX_whereXa_eqXbXX

import org.apache.tinkerpop.gremlin.process.traversal.Traversal; //导入方法依赖的package包/类
@Test
@LoadGraphWith(MODERN)
public void g_V_hasXageX_asXaX_out_in_hasXageX_asXbX_selectXa_bX_whereXa_eqXbXX() {
    final Traversal<Vertex, Map<String, Object>> traversal = get_g_V_hasXageX_asXaX_out_in_hasXageX_asXbX_selectXa_bX_whereXa_eqXbXX();
    printTraversalForm(traversal);
    int counter = 0;
    while (traversal.hasNext()) {
        counter++;
        final Map<String, Object> map = traversal.next();
        assertEquals(2, map.size());
        assertTrue(map.containsKey("a"));
        assertTrue(map.containsKey("b"));
        assertEquals(map.get("a"), map.get("b"));
    }
    assertEquals(6, counter);
    assertFalse(traversal.hasNext());
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:18,代码来源:WhereTest.java

示例4: g_VX1X_asXaX_outXcreatedX_addEXcreatedByX_toXaX

import org.apache.tinkerpop.gremlin.process.traversal.Traversal; //导入方法依赖的package包/类
@Test
@LoadGraphWith(MODERN)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
public void g_VX1X_asXaX_outXcreatedX_addEXcreatedByX_toXaX() {
    final Traversal<Vertex, Edge> traversal = get_g_VX1X_asXaX_outXcreatedX_addEXcreatedByX_toXaX(convertToVertexId("marko"));
    printTraversalForm(traversal);
    int count = 0;
    while (traversal.hasNext()) {
        final Edge edge = traversal.next();
        assertEquals("createdBy", edge.label());
        assertEquals(0, IteratorUtils.count(edge.properties()));
        count++;

    }
    assertEquals(1, count);
    assertEquals(7, IteratorUtils.count(g.E()));
    assertEquals(6, IteratorUtils.count(g.V()));
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:19,代码来源:AddEdgeTest.java

示例5: g_V_out_out

import org.apache.tinkerpop.gremlin.process.traversal.Traversal; //导入方法依赖的package包/类
@Test
@LoadGraphWith(MODERN)
public void g_V_out_out() {
    final Traversal<Vertex, Vertex> traversal = get_g_V_out_out();
    printTraversalForm(traversal);
    int counter = 0;
    final Set<Vertex> vertices = new HashSet<>();
    while (traversal.hasNext()) {
        counter++;
        final Vertex vertex = traversal.next();
        vertices.add(vertex);
        assertTrue(vertex.value("name").equals("lop") ||
                vertex.value("name").equals("ripple"));
    }
    assertEquals(2, counter);
    assertEquals(2, vertices.size());
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:18,代码来源:VertexTest.java

示例6: g_V_repeatXout_groupXaX_byXnameX_byXitX_byXsizeXX_timesX2X_capXaX

import org.apache.tinkerpop.gremlin.process.traversal.Traversal; //导入方法依赖的package包/类
@Test
@LoadGraphWith(MODERN)
public void g_V_repeatXout_groupXaX_byXnameX_byXitX_byXsizeXX_timesX2X_capXaX() {
    final Traversal<Vertex, Map<String, Long>> traversal = get_g_V_repeatXout_groupXaX_byXnameX_by_byXcountXlocalXX_timesX2X_capXaX();
    printTraversalForm(traversal);
    final Map<String, Long> map = traversal.next();
    assertFalse(traversal.hasNext());
    assertEquals(4, map.size());
    assertTrue(map.containsKey("vadas"));
    assertEquals(Long.valueOf(1), map.get("vadas"));
    assertTrue(map.containsKey("josh"));
    assertEquals(Long.valueOf(1), map.get("josh"));
    assertTrue(map.containsKey("lop"));
    assertEquals(Long.valueOf(4), map.get("lop"));
    assertTrue(map.containsKey("ripple"));
    assertEquals(Long.valueOf(2), map.get("ripple"));
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:18,代码来源:GroupTestV3d0.java

示例7: g_V_repeatXgroupCountXmX_byXnameX_outX_timesX2X_capXmX

import org.apache.tinkerpop.gremlin.process.traversal.Traversal; //导入方法依赖的package包/类
@Test
@LoadGraphWith(MODERN)
public void g_V_repeatXgroupCountXmX_byXnameX_outX_timesX2X_capXmX() {
    final Traversal<Vertex, Map<String, Long>> traversal = get_g_V_repeatXgroupCountXmX_byXnameX_outX_timesX2X_capXmX();
    printTraversalForm(traversal);
    final Map<String, Long> map = traversal.next();
    assertFalse(traversal.hasNext());
    //[ripple:2, peter:1, vadas:2, josh:2, lop:4, marko:1]
    assertEquals(6, map.size());
    assertEquals(1l, map.get("marko").longValue());
    assertEquals(2l, map.get("vadas").longValue());
    assertEquals(2l, map.get("josh").longValue());
    assertEquals(4l, map.get("lop").longValue());
    assertEquals(2l, map.get("ripple").longValue());
    assertEquals(1l, map.get("peter").longValue());
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:17,代码来源:RepeatTest.java

示例8: g_V_hasLabelXpersonX_asXpX_VXsoftwareX_addInEXuses_pX

import org.apache.tinkerpop.gremlin.process.traversal.Traversal; //导入方法依赖的package包/类
@Test
@LoadGraphWith(MODERN)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
public void g_V_hasLabelXpersonX_asXpX_VXsoftwareX_addInEXuses_pX() {
    final Traversal<Vertex, Edge> traversal = get_g_V_hasLabelXpersonX_asXpX_VXsoftwareX_addInEXuses_pX();
    printTraversalForm(traversal);
    int counter = 0;
    while (traversal.hasNext()) {
        final Edge edge = traversal.next();
        assertEquals("uses", edge.label());
        assertEquals("person", edge.outVertex().label());
        assertEquals("software", edge.inVertex().label());
        counter++;
    }
    assertEquals(8, counter);
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:17,代码来源:GraphTest.java

示例9: g_V_asXaX_hasXname_markoX_asXbX_hasXage_29X_asXcX_path

import org.apache.tinkerpop.gremlin.process.traversal.Traversal; //导入方法依赖的package包/类
@Test
@LoadGraphWith(MODERN)
public void g_V_asXaX_hasXname_markoX_asXbX_hasXage_29X_asXcX_path() {
    final Traversal<Vertex, Path> traversal = get_g_V_asXaX_hasXname_markoX_asXbX_hasXage_29X_asXcX_path();
    printTraversalForm(traversal);
    final Path path = traversal.next();
    assertFalse(traversal.hasNext());
    assertEquals(1, path.size());
    assertTrue(path.hasLabel("a"));
    assertTrue(path.hasLabel("b"));
    assertTrue(path.hasLabel("c"));
    assertEquals(1, path.labels().size());
    assertEquals(3, path.labels().get(0).size());
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:15,代码来源:PathTest.java

示例10: g_V_hasXlangX_groupXaX_byXlangX_byXnameX_out_capXaX

import org.apache.tinkerpop.gremlin.process.traversal.Traversal; //导入方法依赖的package包/类
@Test
@LoadGraphWith(MODERN)
public void g_V_hasXlangX_groupXaX_byXlangX_byXnameX_out_capXaX() {
    final Traversal<Vertex, Map<String, Collection<String>>> traversal = get_g_V_hasXlangX_groupXaX_byXlangX_byXnameX_out_capXaX();
    printTraversalForm(traversal);
    final Map<String, Collection<String>> map = traversal.next();
    assertFalse(traversal.hasNext());
    assertEquals(1, map.size());
    assertTrue(map.containsKey("java"));
    assertEquals(2, map.get("java").size());
    assertTrue(map.get("java").contains("ripple"));
    assertTrue(map.get("java").contains("lop"));
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:14,代码来源:GroupTestV3d0.java

示例11: g_V_hasXageX_propertiesXnameX

import org.apache.tinkerpop.gremlin.process.traversal.Traversal; //导入方法依赖的package包/类
@Test
@LoadGraphWith(MODERN)
public void g_V_hasXageX_propertiesXnameX() {
    final Traversal<Vertex, VertexProperty<String>> traversal = get_g_V_hasXageX_propertiesXnameX();
    printTraversalForm(traversal);
    final Set<String> keys = new HashSet<>();
    final Set<String> values = new HashSet<>();
    final Set<Object> ids = new HashSet<>();
    int counter = 0;
    while (traversal.hasNext()) {
        counter++;
        final VertexProperty<String> vertexProperty = traversal.next();
        keys.add(vertexProperty.key());
        values.add(vertexProperty.value());
        ids.add(vertexProperty.id());
        assertEquals("name", vertexProperty.key());
        assertEquals(convertToVertex(graph, vertexProperty.value()).values("name").next(), vertexProperty.value());
        // compare the ids as longs. assumes modern graph uses numeric ids only (long/integer).
        assertEquals(Long.valueOf(convertToVertex(graph, vertexProperty.value()).properties("name").next().id().toString()), Long.valueOf(vertexProperty.id().toString()));
    }
    assertEquals(4, counter);
    assertEquals(1, keys.size());
    assertTrue(keys.contains("name"));
    assertEquals(4, values.size());
    assertTrue(values.contains("marko"));
    assertTrue(values.contains("vadas"));
    assertTrue(values.contains("josh"));
    assertTrue(values.contains("peter"));
    assertEquals(4, ids.size());

}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:32,代码来源:PropertiesTest.java

示例12: g_V_age_foldX0_plusX

import org.apache.tinkerpop.gremlin.process.traversal.Traversal; //导入方法依赖的package包/类
@Test
@LoadGraphWith(MODERN)
public void g_V_age_foldX0_plusX() {
    final Traversal<Vertex, Integer> traversal = get_g_V_age_foldX0_plusX();
    printTraversalForm(traversal);
    final Integer ageSum = traversal.next();
    assertFalse(traversal.hasNext());
    assertEquals(Integer.valueOf(123), ageSum);
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:10,代码来源:FoldTest.java

示例13: g_V_localXoutE_limitX1X_inVX_limitX3X

import org.apache.tinkerpop.gremlin.process.traversal.Traversal; //导入方法依赖的package包/类
@Test
@LoadGraphWith(MODERN)
public void g_V_localXoutE_limitX1X_inVX_limitX3X() {
    final Traversal<Vertex, Vertex> traversal = get_g_V_localXoutE_limitX1X_inVX_limitX3X();
    printTraversalForm(traversal);
    int counter = 0;
    while (traversal.hasNext()) {
        counter++;
        traversal.next();
    }
    assertEquals(3, counter);
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:13,代码来源:RangeTest.java

示例14: assertCommonA

import org.apache.tinkerpop.gremlin.process.traversal.Traversal; //导入方法依赖的package包/类
private void assertCommonA(Traversal<Vertex, Map<String, Collection<Vertex>>> traversal) {
    final Map<String, Collection<Vertex>> map = traversal.next();
    assertEquals(6, map.size());
    map.forEach((key, values) -> {
        assertEquals(1, values.size());
        assertEquals(convertToVertexId(key), values.iterator().next().id());
    });
    assertFalse(traversal.hasNext());
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:10,代码来源:GroupTestV3d0.java

示例15: g_VX1X_outXcreatedX_valueMap

import org.apache.tinkerpop.gremlin.process.traversal.Traversal; //导入方法依赖的package包/类
@Test
@LoadGraphWith(MODERN)
public void g_VX1X_outXcreatedX_valueMap() {
    final Traversal<Vertex, Map<String, List<String>>> traversal = get_g_VX1X_outXcreatedX_valueMap(convertToVertexId("marko"));
    printTraversalForm(traversal);
    assertTrue(traversal.hasNext());
    final Map<String, 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());

}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:14,代码来源:ValueMapTest.java


注:本文中的org.apache.tinkerpop.gremlin.process.traversal.Traversal.next方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。