本文整理了Java中org.apache.tinkerpop.gremlin.process.traversal.Traversal.iterate()
方法的一些代码示例,展示了Traversal.iterate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Traversal.iterate()
方法的具体详情如下:
包路径:org.apache.tinkerpop.gremlin.process.traversal.Traversal
类名称:Traversal
方法名:iterate
[英]Iterate all the Traverser instances in the traversal. What is returned is the empty traversal. It is assumed that what is desired from the computation is are the sideEffects yielded by the traversal.
[中]迭代遍历中的所有遍历器实例。返回的是空遍历。假设计算所需的是遍历产生的副作用。
代码示例来源:origin: apache/tinkerpop
/**
* Iterates the traversal presumably for the generation of side-effects.
*/
@Override
public default SparqlTraversal<S, E> iterate() {
Traversal.super.iterate();
return this;
}
}
代码示例来源:origin: apache/tinkerpop
/**
* Iterates the traversal presumably for the generation of side-effects.
*/
@Override
public default GraphTraversal<S, E> iterate() {
Traversal.super.iterate();
return this;
}
代码示例来源:origin: apache/tinkerpop
@Test
@LoadGraphWith(LoadGraphWith.GraphData.MODERN)
@FeatureRequirement(featureClass = Graph.Features.GraphFeatures.class, feature = Graph.Features.GraphFeatures.FEATURE_IO_WRITE)
public void g_io_write_withXwriter_graphsonX() throws IOException {
final String fileToWrite = TestHelper.generateTempFile(WriteTest.class,"tinkerpop-modern-v3d0", ".json").getAbsolutePath().replace('\\', '/');
final File f = new File(fileToWrite);
assertThat(f.length() == 0, is(true));
final Traversal<Object,Object> traversal = get_g_io_write_withXwriter_graphsonX(fileToWrite);
printTraversalForm(traversal);
traversal.iterate();
assertThat(f.length() > 0, is(true));
}
代码示例来源:origin: apache/tinkerpop
@Test
@LoadGraphWith(LoadGraphWith.GraphData.MODERN)
@FeatureRequirement(featureClass = Graph.Features.GraphFeatures.class, feature = Graph.Features.GraphFeatures.FEATURE_IO_WRITE)
public void g_io_writeXkryoX() throws IOException {
final String fileToWrite = TestHelper.generateTempFile(WriteTest.class, "tinkerpop-modern-v3d0", ".kryo").getAbsolutePath().replace('\\', '/');
final File f = new File(fileToWrite);
assertThat(f.length() == 0, is(true));
final Traversal<Object,Object> traversal = get_g_io_writeXkryoX(fileToWrite);
printTraversalForm(traversal);
traversal.iterate();
assertThat(f.length() > 0, is(true));
}
代码示例来源:origin: apache/tinkerpop
@Test
@LoadGraphWith(LoadGraphWith.GraphData.MODERN)
@FeatureRequirement(featureClass = Graph.Features.GraphFeatures.class, feature = Graph.Features.GraphFeatures.FEATURE_IO_WRITE)
public void g_io_write_withXwrite_gryoX() throws IOException {
final String fileToWrite = TestHelper.generateTempFile(WriteTest.class, "tinkerpop-modern-v3d0", ".kryo").getAbsolutePath().replace('\\', '/');
final File f = new File(fileToWrite);
assertThat(f.length() == 0, is(true));
final Traversal<Object,Object> traversal = get_g_io_write_withXwriter_gryoX(fileToWrite);
printTraversalForm(traversal);
traversal.iterate();
assertThat(f.length() > 0, is(true));
}
代码示例来源:origin: apache/tinkerpop
@Test
@LoadGraphWith(LoadGraphWith.GraphData.MODERN)
@FeatureRequirement(featureClass = Graph.Features.GraphFeatures.class, feature = Graph.Features.GraphFeatures.FEATURE_IO_WRITE)
public void g_io_writeXjsonX() throws IOException {
final String fileToWrite = TestHelper.generateTempFile(WriteTest.class,"tinkerpop-modern-v3d0", ".json").getAbsolutePath().replace('\\', '/');
final File f = new File(fileToWrite);
assertThat(f.length() == 0, is(true));
final Traversal<Object,Object> traversal = get_g_io_writeXjsonX(fileToWrite);
printTraversalForm(traversal);
traversal.iterate();
assertThat(f.length() > 0, is(true));
}
代码示例来源:origin: apache/tinkerpop
@Test
@LoadGraphWith(LoadGraphWith.GraphData.MODERN)
@FeatureRequirement(featureClass = Graph.Features.GraphFeatures.class, feature = Graph.Features.GraphFeatures.FEATURE_IO_WRITE)
public void g_io_writeXxmlX() throws IOException {
final String fileToWrite = TestHelper.generateTempFile(WriteTest.class,"tinkerpop-modern", ".xml").getAbsolutePath().replace('\\', '/');
final File f = new File(fileToWrite);
assertThat(f.length() == 0, is(true));
final Traversal<Object,Object> traversal = get_g_io_writeXxmlX(fileToWrite);
printTraversalForm(traversal);
traversal.iterate();
assertThat(f.length() > 0, is(true));
}
代码示例来源:origin: apache/tinkerpop
@LoadGraphWith(MODERN)
public void g_V_out_asXcX_matchXb_knows_a__c_created_eX_selectXcX() throws Exception {
final Traversal<Vertex, String> traversal = get_g_V_out_asXcX_matchXb_knows_a__c_created_eX_selectXcX();
try {
printTraversalForm(traversal);
traversal.iterate();
fail("Should have tossed an exception because match pattern is not solvable");
} catch (Exception ex) {
//final Throwable root = ExceptionUtils.getRootCause(ex);
//assertThat(root.getMessage(), startsWith("The provided match pattern is unsolvable:"));
}
}
代码示例来源:origin: apache/tinkerpop
@LoadGraphWith(MODERN)
public void g_V_matchXa_created_b__c_created_bX_selectXa_b_cX_byXnameX() throws Exception {
final Traversal<Vertex, Map<String, String>> traversal = get_g_V_matchXa_created_b__c_created_bX_selectXa_b_cX_byXnameX();
try {
printTraversalForm(traversal);
traversal.iterate();
fail("Should have tossed an exception because match pattern is not solvable");
} catch (Exception ex) {
//final Throwable root = ExceptionUtils.getRootCause(ex);
//assertThat(root.getMessage(), startsWith("The provided match pattern is unsolvable:"));
}
}
代码示例来源:origin: apache/tinkerpop
@Test
@LoadGraphWith(MODERN)
public void g_V_matchXa_created_b__b_in_count_isXeqX1XXX_selectXa_bX_profileXmetricsX() {
final Traversal<Vertex, Map<String, String>> traversal = get_g_V_matchXa_created_b__b_in_count_isXeqX1XXX_selectXa_bX_profileXmetricsX();
printTraversalForm(traversal);
traversal.iterate();
}
代码示例来源:origin: apache/tinkerpop
@LoadGraphWith(MODERN)
public void g_V_matchXa_knows_b__c_knows_bX() {
final Traversal<Vertex, Map<String, Vertex>> traversal = get_g_V_matchXa_knows_b__c_knows_bX();
try {
printTraversalForm(traversal);
traversal.iterate();
fail("Should have tossed an exception because match pattern is not solvable");
} catch (Exception ex) {
//final Throwable root = ExceptionUtils.getRootCause(ex);
//assertThat(root.getMessage(), startsWith("The provided match pattern is unsolvable:"));
}
}
代码示例来源:origin: apache/tinkerpop
@Test
@LoadGraphWith(MODERN)
public void g_V_matchXa_created_b__b_in_count_isXeqX1XXX_selectXa_bX_profile() {
final Traversal<Vertex, TraversalMetrics> traversal = get_g_V_matchXa_created_b__b_in_count_isXeqX1XXX_selectXa_bX_profile();
printTraversalForm(traversal);
traversal.iterate();
}
代码示例来源:origin: apache/tinkerpop
@Test
@LoadGraphWith(MODERN)
@IgnoreEngine(TraversalEngine.Type.COMPUTER)
public void g_V_sideEffectXThread_sleepX10XX_sideEffectXThread_sleepX5XX_profileXmetricsX() {
final Traversal<Vertex, Vertex> traversal = get_g_V_sideEffectXThread_sleepX10XX_sideEffectXThread_sleepX5XX_profileXmetricsX();
printTraversalForm(traversal);
traversal.iterate();
// This assertion is really only meant for tinkergraph
if (graph.getClass().getSimpleName().equals("TinkerGraph"))
assertEquals("There should be 7 steps in this traversal (counting injected profile steps).", 7, traversal.asAdmin().getSteps().size());
final TraversalMetrics traversalMetrics = traversal.asAdmin().getSideEffects().get(METRICS_KEY);
validate_g_V_sideEffectXThread_sleepX10XX_sideEffectXThread_sleepX5XX_profile(traversalMetrics);
}
代码示例来源:origin: apache/tinkerpop
@Test
@FeatureRequirement(featureClass = Graph.Features.GraphFeatures.class, feature = Graph.Features.GraphFeatures.FEATURE_IO_READ)
public void g_io_readXkryoX() throws IOException {
final String fileToRead = TestHelper.generateTempFileFromResource(ReadTest.class, GryoResourceAccess.class, "tinkerpop-modern-v3d0.kryo", "").getAbsolutePath().replace('\\', '/');
final Traversal<Object,Object> traversal = get_g_io_readXkryoX(fileToRead);
printTraversalForm(traversal);
traversal.iterate();
if (graph instanceof RemoteGraph) {
assertEquals(6L, g.V().count().next().longValue());
assertEquals(6L, g.E().count().next().longValue());
} else {
IoTest.assertModernGraph(graph, false, true);
}
}
代码示例来源:origin: apache/tinkerpop
@Test
@FeatureRequirement(featureClass = Graph.Features.GraphFeatures.class, feature = Graph.Features.GraphFeatures.FEATURE_IO_READ)
public void g_io_read_withXreader_gryoX() throws IOException {
final String fileToRead = TestHelper.generateTempFileFromResource(ReadTest.class, GryoResourceAccess.class, "tinkerpop-modern-v3d0.kryo", "").getAbsolutePath().replace('\\', '/');
final Traversal<Object,Object> traversal = get_g_io_read_withXreader_gryoX(fileToRead);
printTraversalForm(traversal);
traversal.iterate();
if (graph instanceof RemoteGraph) {
assertEquals(6L, g.V().count().next().longValue());
assertEquals(6L, g.E().count().next().longValue());
} else {
IoTest.assertModernGraph(graph, false, true);
}
}
代码示例来源:origin: apache/tinkerpop
@Test
@LoadGraphWith(GRATEFUL)
public void grateful_V_out_out_profileXmetricsX() {
final Traversal<Vertex, Vertex> traversal = get_g_V_out_out_profileXmetricsX();
printTraversalForm(traversal);
traversal.iterate();
final TraversalMetrics traversalMetrics = traversal.asAdmin().getSideEffects().get(METRICS_KEY);
validate_g_V_out_out_profile_grateful(traversalMetrics);
}
代码示例来源:origin: apache/tinkerpop
@Test
@LoadGraphWith(MODERN)
public void g_V_whereXinXcreatedX_count_isX1XX_name_profileXmetricsX() {
final Traversal<Vertex, String> traversal = get_g_V_whereXinXcreatedX_count_isX1XX_name_profileXmetricsX();
printTraversalForm(traversal);
traversal.iterate();
final TraversalMetrics traversalMetrics = traversal.asAdmin().getSideEffects().get(METRICS_KEY);
validate_g_V_whereXinXcreatedX_count_isX1XX_name_profile(traversal, traversalMetrics);
}
代码示例来源:origin: apache/tinkerpop
@Test
@LoadGraphWith(MODERN)
public void modern_V_out_out_profileXmetricsX() {
final Traversal<Vertex, Vertex> traversal = get_g_V_out_out_profileXmetricsX();
printTraversalForm(traversal);
traversal.iterate();
validate_g_V_out_out_profile_modern(traversal, traversal.asAdmin().getSideEffects().get(METRICS_KEY));
}
代码示例来源:origin: apache/tinkerpop
@Test
@LoadGraphWith(MODERN)
public void g_V_repeat_both_profileXmetricsX() {
final Traversal<Vertex, Vertex> traversal = get_g_V_repeatXbothX_timesX3X_profileXmetricsX();
printTraversalForm(traversal);
traversal.iterate();
final TraversalMetrics traversalMetrics = traversal.asAdmin().getSideEffects().get(METRICS_KEY);
validate_g_V_repeat_both_modern_profile(traversalMetrics,
traversal.asAdmin().getStrategies().toList().contains(RepeatUnrollStrategy.instance()) &&
!traversal.asAdmin().getStrategies().toList().contains(ComputerVerificationStrategy.instance()));
}
代码示例来源:origin: apache/tinkerpop
@Test
@LoadGraphWith(MODERN)
public void testProfileStrategyCallbackSideEffect() {
final Traversal<Vertex, Vertex> t = get_g_V_out_out_profileXmetricsX();
MockStep mockStep = new MockStep(t.asAdmin());
t.asAdmin().addStep(3, mockStep);
t.iterate();
assertTrue(mockStep.callbackCalled);
if (!onGraphComputer(t.asAdmin())) {
final TraversalMetrics traversalMetrics = t.asAdmin().getSideEffects().get(METRICS_KEY);
assertEquals(100, traversalMetrics.getMetrics(3).getCount("bogusCount").longValue());
}
}
内容来源于网络,如有侵权,请联系作者删除!