本文整理汇总了Java中org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine类的典型用法代码示例。如果您正苦于以下问题:Java TraversalEngine类的具体用法?Java TraversalEngine怎么用?Java TraversalEngine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TraversalEngine类属于org.apache.tinkerpop.gremlin.process.traversal包,在下文中一共展示了TraversalEngine类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: g_V_asXaX_out_mapXa_nameX
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; //导入依赖的package包/类
@Test
@LoadGraphWith(MODERN)
@IgnoreEngine(TraversalEngine.Type.COMPUTER)
public void g_V_asXaX_out_mapXa_nameX() {
int marko = 0;
int peter = 0;
int josh = 0;
int other = 0;
final Traversal<Vertex, String> traversal = get_g_withPath_V_asXaX_out_mapXa_nameX();
printTraversalForm(traversal);
while (traversal.hasNext()) {
final String name = traversal.next();
if (name.equals("marko")) marko++;
else if (name.equals("peter")) peter++;
else if (name.equals("josh")) josh++;
else other++;
}
assertEquals(marko, 3);
assertEquals(josh, 2);
assertEquals(peter, 1);
assertEquals(other, 0);
}
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:24,代码来源:MapTest.java
示例2: shouldFilterVertexCriterionAndKeepLabels
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; //导入依赖的package包/类
@Test
@LoadGraphWith(MODERN)
@IgnoreEngine(TraversalEngine.Type.COMPUTER)
public void shouldFilterVertexCriterionAndKeepLabels() throws Exception {
// this will exclude "peter"
final Traversal<Vertex, ?> vertexCriterion = __.has("name", P.within("ripple", "josh", "marko"));
final SubgraphStrategy strategy = SubgraphStrategy.build().vertexCriterion(vertexCriterion).create();
final GraphTraversalSource sg = create(strategy);
assertEquals(9, g.V().as("a").out().in().as("b").dedup("a", "b").count().next().intValue());
assertEquals(2, sg.V().as("a").out().in().as("b").dedup("a", "b").count().next().intValue());
final List<Object> list = sg.V().as("a").out().in().as("b").dedup("a", "b").values("name").toList();
assertThat(list, hasItems("marko", "josh"));
}
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:17,代码来源:SubgraphStrategyProcessTest.java
示例3: registerOptOuts
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; //导入依赖的package包/类
private void registerOptOuts(final Class<? extends Graph> graphClass,
final Optional<GraphProvider.Descriptor> graphProviderDescriptor,
final TraversalEngine.Type traversalEngineType) throws InitializationError {
final Graph.OptOut[] optOuts = graphClass.getAnnotationsByType(Graph.OptOut.class);
if (optOuts != null && optOuts.length > 0) {
// validate annotation - test class and reason must be set
if (!Arrays.stream(optOuts).allMatch(ignore -> ignore.test() != null && ignore.reason() != null && !ignore.reason().isEmpty()))
throw new InitializationError("Check @IgnoreTest annotations - all must have a 'test' and 'reason' set");
try {
filter(new OptOutTestFilter(optOuts, graphProviderDescriptor, traversalEngineType));
} catch (NoTestsRemainException ex) {
throw new InitializationError(ex);
}
}
}
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:18,代码来源:AbstractGremlinSuite.java
示例4: checkGraphProviderDescriptorForComputer
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; //导入依赖的package包/类
private boolean checkGraphProviderDescriptorForComputer(final Graph.OptOut optOut) {
// immediately include the ignore if this is a standard tests suite (i.e. not computer)
// or if the OptOut doesn't specify any computers to filter
if (traversalEngineType == TraversalEngine.Type.STANDARD
|| optOut.computers().length == 0) {
return true;
}
// can assume that that GraphProvider.Descriptor is not null at this point. a test should
// only opt out if it matches the expected computer
return Stream.of(optOut.computers()).map(c -> {
try {
return Class.forName(c);
} catch (ClassNotFoundException e) {
return Object.class;
}
}).filter(c -> !c.equals(Object.class)).anyMatch(c -> c == graphProviderDescriptor.get().computer());
}
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:18,代码来源:AbstractGremlinSuite.java
示例5: g_withPath_V_asXaX_out_mapXa_nameX
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; //导入依赖的package包/类
@Test
@LoadGraphWith(MODERN)
@IgnoreEngine(TraversalEngine.Type.COMPUTER)
public void g_withPath_V_asXaX_out_mapXa_nameX() {
int marko = 0;
int peter = 0;
int josh = 0;
int other = 0;
final Traversal<Vertex, String> traversal = get_g_withPath_V_asXaX_out_mapXa_nameX();
printTraversalForm(traversal);
while (traversal.hasNext()) {
final String name = traversal.next();
if (name.equals("marko")) marko++;
else if (name.equals("peter")) peter++;
else if (name.equals("josh")) josh++;
else other++;
}
assertEquals(marko, 3);
assertEquals(josh, 2);
assertEquals(peter, 1);
assertEquals(other, 0);
}
开发者ID:apache,项目名称:tinkerpop,代码行数:24,代码来源:MapTest.java
示例6: CustomSuite
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public CustomSuite(final Class<?> klass, final RunnerBuilder builder) throws InitializationError {
super(klass, builder,
new Class<?>[]{
CustomTest.class,
},
null,
false,
TraversalEngine.Type.STANDARD);
}
开发者ID:rayokota,项目名称:hgraphdb,代码行数:11,代码来源:CustomSuite.java
示例7: engine
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; //导入依赖的package包/类
/**
* @deprecated As of release 3.2.0. Please use {@link Graph#traversal(Class)}.
*/
@Deprecated
@Override
public Builder engine(final TraversalEngine.Builder engineBuilder) {
this.engineBuilder = engineBuilder;
return this;
}
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:10,代码来源:GraphTraversalSource.java
示例8: initializeMatchAlgorithm
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; //导入依赖的package包/类
private void initializeMatchAlgorithm(final TraversalEngine.Type traversalEngineType) {
try {
this.matchAlgorithm = this.matchAlgorithmClass.getConstructor().newInstance();
} catch (final NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException e) {
throw new IllegalStateException(e.getMessage(), e);
}
this.matchAlgorithm.initialize(traversalEngineType, this.matchTraversals);
}
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:9,代码来源:MatchStep.java
示例9: g_V_asXaX_out_out_mapXa_name_it_nameX
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; //导入依赖的package包/类
@Test
@LoadGraphWith(MODERN)
@IgnoreEngine(TraversalEngine.Type.COMPUTER)
public void g_V_asXaX_out_out_mapXa_name_it_nameX() {
final Traversal<Vertex, String> traversal = get_g_withPath_V_asXaX_out_out_mapXa_name_it_nameX();
int counter = 0;
while (traversal.hasNext()) {
counter++;
final String doubleName = traversal.next();
assertTrue("markoripple".equals(doubleName) || "markolop".equals(doubleName));
}
assertEquals(2, counter);
assertFalse(traversal.hasNext());
}
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:15,代码来源:MapTest.java
示例10: g_VX1_2_3_4X_name
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; //导入依赖的package包/类
@Test
@LoadGraphWith
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_REMOVE_VERTICES)
@IgnoreEngine(TraversalEngine.Type.COMPUTER)
public void g_VX1_2_3_4X_name() {
final Traversal<Vertex, String> traversal = get_g_VX1_2_3_4X_name(convertToVertexId("marko"), convertToVertexId("vadas"), convertToVertexId("lop"), convertToVertexId("josh"));
printTraversalForm(traversal);
checkResults(Arrays.asList("marko", "vadas", "josh"), traversal);
assertFalse(traversal.hasNext());
}
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:11,代码来源:VertexTest.java
示例11: g_V_both_hasLabelXpersonX_order_byXage_decrX_name
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; //导入依赖的package包/类
@Test
@IgnoreEngine(TraversalEngine.Type.STANDARD) // validating the internal sort/limit works in GraphComputer
@LoadGraphWith(MODERN)
public void g_V_both_hasLabelXpersonX_order_byXage_decrX_name() {
final Traversal<Vertex, String> traversal = get_g_V_both_hasLabelXpersonX_order_byXage_decrX_name();
traversal.asAdmin().applyStrategies();
if (!TraversalHelper.getFirstStepOfAssignableClass(OrderGlobalStep.class, traversal.asAdmin()).isPresent())
return; // total hack to avoid providers that don't compile to OrderGlobalStep
TraversalHelper.getFirstStepOfAssignableClass(OrderGlobalStep.class, traversal.asAdmin()).get().setLimit(1);
printTraversalForm(traversal);
final List<String> results = traversal.toList();
assertTrue(results.size() < 8);
assertFalse(traversal.hasNext());
}
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:15,代码来源:OrderTest.java
示例12: g_V_sideEffectXThread_sleepX10XX_sideEffectXThread_sleepX5XX_profile
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; //导入依赖的package包/类
@Test
@LoadGraphWith(MODERN)
@IgnoreEngine(TraversalEngine.Type.COMPUTER)
public void g_V_sideEffectXThread_sleepX10XX_sideEffectXThread_sleepX5XX_profile() {
final Traversal<Vertex, TraversalMetrics> traversal = get_g_V_sideEffectXThread_sleepX10XX_sideEffectXThread_sleepX5XX_profile();
printTraversalForm(traversal);
TraversalMetrics traversalMetrics = traversal.next();
assertEquals("There should be 8 steps in this traversal (counting injected profile steps).", 8, traversal.asAdmin().getSteps().size());
validate_g_V_sideEffectXThread_sleepX10XX_sideEffectXThread_sleepX5XX_profile(traversalMetrics);
}
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:11,代码来源:ProfileTest.java
示例13: g_V_sideEffectXThread_sleepX10XX_sideEffectXThread_sleepX5XX_profileXmetricsX
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; //导入依赖的package包/类
@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();
assertEquals("There should be 7 steps in this traversal (counting injected profile steps).", 7, traversal.asAdmin().getSteps().size());
TraversalMetrics traversalMetrics = traversal.asAdmin().getSideEffects().<TraversalMetrics>get(METRICS_KEY);
validate_g_V_sideEffectXThread_sleepX10XX_sideEffectXThread_sleepX5XX_profile(traversalMetrics);
}
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:12,代码来源:ProfileTest.java
示例14: g_V_hasLabelXpersonX_pageRank_byXrankX_byXbothEX_rank_profile
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; //导入依赖的package包/类
@Test
@LoadGraphWith(MODERN)
@IgnoreEngine(TraversalEngine.Type.STANDARD)
public void g_V_hasLabelXpersonX_pageRank_byXrankX_byXbothEX_rank_profile() {
final Traversal<Vertex, TraversalMetrics> traversal = get_g_V_hasLabelXpersonX_pageRank_byXrankX_byXbothEX_rank_profile();
//printTraversalForm(traversal);
try {
traversal.iterate();
fail("Should have tossed an exception because multi-OLAP is unsolvable");
} catch (Exception ex) {
assertTrue(ex instanceof VerificationException || ExceptionUtils.getRootCause(ex) instanceof VerificationException);
}
}
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:14,代码来源:ProfileTest.java
示例15: g_VX1X_sideEffectXstore_aX_name
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; //导入依赖的package包/类
@Test
@LoadGraphWith(MODERN)
@IgnoreEngine(TraversalEngine.Type.COMPUTER)
public void g_VX1X_sideEffectXstore_aX_name() {
final Traversal<Vertex, String> traversal = get_g_VX1X_sideEffectXstore_aX_name(convertToVertexId("marko"));
printTraversalForm(traversal);
assertEquals(traversal.next(), "marko");
assertFalse(traversal.hasNext());
assertEquals(convertToVertexId("marko"), traversal.asAdmin().getSideEffects().<List<Vertex>>get("a").get(0).id());
checkSideEffects(traversal.asAdmin().getSideEffects(), "a", ArrayList.class);
}
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:12,代码来源:SideEffectTest.java
示例16: g_VX1X_out_sideEffectXincr_cX_name
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; //导入依赖的package包/类
@Test
@LoadGraphWith(MODERN)
@IgnoreEngine(TraversalEngine.Type.COMPUTER)
public void g_VX1X_out_sideEffectXincr_cX_name() {
final Traversal<Vertex, String> traversal = get_g_VX1X_out_sideEffectXincr_cX_name(convertToVertexId("marko"));
printTraversalForm(traversal);
assert_g_v1_out_sideEffectXincr_cX_valueXnameX(traversal);
assertEquals(new Integer(3), traversal.asAdmin().getSideEffects().<List<Integer>>get("c").get(0));
checkSideEffects(traversal.asAdmin().getSideEffects(), "c", ArrayList.class);
}
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:11,代码来源:SideEffectTest.java
示例17: g_V_outE_identity_inV_explain
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; //导入依赖的package包/类
@Test
@LoadGraphWith(MODERN)
@IgnoreEngine(TraversalEngine.Type.COMPUTER)
public void g_V_outE_identity_inV_explain() {
final TraversalExplanation explanation = get_g_V_outE_identity_inV_explain();
if (explanation.getStrategyTraversals().stream().map(Pair::getValue0).filter(s -> s instanceof IdentityRemovalStrategy || s instanceof IncidentToAdjacentStrategy).count() == 2) {
printTraversalForm(explanation.getOriginalTraversal());
boolean beforeIncident = true;
boolean beforeIdentity = true;
for (final Pair<TraversalStrategy, Traversal.Admin<?, ?>> pair : explanation.getStrategyTraversals()) {
if (pair.getValue0().getClass().equals(IncidentToAdjacentStrategy.class))
beforeIncident = false;
if (pair.getValue0().getClass().equals(IdentityRemovalStrategy.class))
beforeIdentity = false;
if (beforeIdentity)
assertEquals(1, TraversalHelper.getStepsOfClass(IdentityStep.class, pair.getValue1()).size());
if (beforeIncident)
assertEquals(1, TraversalHelper.getStepsOfClass(EdgeVertexStep.class, pair.getValue1()).size());
if (!beforeIdentity)
assertEquals(0, TraversalHelper.getStepsOfClass(IdentityStep.class, pair.getValue1()).size());
if (!beforeIncident)
assertEquals(0, TraversalHelper.getStepsOfClass(EdgeVertexStep.class, pair.getValue1()).size());
}
assertFalse(beforeIncident);
}
}
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:31,代码来源:ExplainTest.java
示例18: g_V_hasId_compilationEquality
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; //导入依赖的package包/类
@Test
@LoadGraphWith(MODERN)
@IgnoreEngine(TraversalEngine.Type.COMPUTER) // only validate for OLTP
public void g_V_hasId_compilationEquality() {
final Traversal<Vertex, Vertex> traversala1 = get_g_VX1X(convertToVertexId("marko"));
final Traversal<Vertex, Vertex> traversala2 = get_g_V_hasIdX1X(convertToVertexId("marko"));
final Traversal<Vertex, Vertex> traversalb1 = get_g_VX1_2X(convertToVertexId("marko"), convertToVertexId("vadas"));
final Traversal<Vertex, Vertex> traversalb2 = get_g_V_hasIdX1_2X(convertToVertexId("marko"), convertToVertexId("vadas"));
printTraversalForm(traversala1);
printTraversalForm(traversala2);
printTraversalForm(traversalb1);
printTraversalForm(traversalb2);
checkResults(Collections.singletonList(convertToVertex(graph, "marko")), traversala1);
checkResults(Collections.singletonList(convertToVertex(graph, "marko")), traversala2);
checkResults(Arrays.asList(convertToVertex(graph, "marko"), convertToVertex(graph, "vadas")), traversalb1);
checkResults(Arrays.asList(convertToVertex(graph, "marko"), convertToVertex(graph, "vadas")), traversalb2);
// if providers don't have their own custom GraphStep, then ignore validating compilation equality
if ((traversala1.asAdmin().getStartStep() instanceof GraphStep) &&
!traversala1.asAdmin().getStartStep().getClass().equals(GraphStep.class)) {
assertEquals(traversala1, traversala2);
assertEquals(traversalb1, traversalb2);
assertNotEquals(traversala1, traversalb1);
assertNotEquals(traversala1, traversalb2);
assertNotEquals(traversala2, traversalb1);
assertNotEquals(traversala2, traversalb2);
}
}
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:28,代码来源:HasTest.java
示例19: shouldProperlyHandleMetaProperties
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; //导入依赖的package包/类
@Test
@LoadGraphWith(MODERN)
@IgnoreEngine(TraversalEngine.Type.COMPUTER) // we can't modify the graph in computer mode
public void shouldProperlyHandleMetaProperties() throws Exception {
graph.traversal().V().has("name", "marko").properties("name").property("alias", "okram").iterate();
final BulkLoaderVertexProgram blvp = BulkLoaderVertexProgram.build()
.userSuppliedIds(true)
.writeGraph(getWriteGraphConfiguration()).create(graph);
graphProvider.getGraphComputer(graph).workers(1).program(blvp).submit().get();
assertGraphEquality(graph, getWriteGraph());
}
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:12,代码来源:BulkLoaderVertexProgramTest.java
示例20: AbstractGremlinSuite
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; //导入依赖的package包/类
/**
* Constructs a Gremlin Test Suite implementation.
*
* @param klass Required for JUnit Suite construction
* @param builder Required for JUnit Suite construction
* @param testsToExecute The list of tests to execute
* @param testsToEnforce The list of tests to "enforce" such that a check is made to ensure that in this list,
* there exists an implementation in the testsToExecute (use {@code null} for no
* enforcement).
* @param gremlinFlavorSuite Ignore validation of {@link org.apache.tinkerpop.gremlin.structure.Graph.OptIn}
* annotations which is typically reserved for structure tests
* @param traversalEngineType The {@link org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine.Type} to
* enforce on this suite
*/
public AbstractGremlinSuite(final Class<?> klass, final RunnerBuilder builder, final Class<?>[] testsToExecute,
final Class<?>[] testsToEnforce, final boolean gremlinFlavorSuite,
final TraversalEngine.Type traversalEngineType) throws InitializationError {
super(builder, klass, enforce(testsToExecute, testsToEnforce));
this.gremlinFlavorSuite = gremlinFlavorSuite;
// figures out what the implementer assigned as the GraphProvider class and make it available to tests.
// the klass is the Suite that implements this suite (e.g. GroovyTinkerGraphProcessStandardTest).
// this class should be annotated with GraphProviderClass. Failure to do so will toss an InitializationError
final Pair<Class<? extends GraphProvider>, Class<? extends Graph>> pair = getGraphProviderClass(klass);
// the GraphProvider.Descriptor is only needed right now if the test if for a computer engine - an
// exception is thrown if it isn't present.
final Optional<GraphProvider.Descriptor> graphProviderDescriptor = getGraphProviderDescriptor(traversalEngineType, pair.getValue0());
// validate public acknowledgement of the test suite and filter out tests ignored by the implementation
validateOptInToSuite(pair.getValue1());
validateOptInAndOutAnnotationsOnGraph(pair.getValue1());
registerOptOuts(pair.getValue1(), graphProviderDescriptor, traversalEngineType);
try {
final GraphProvider graphProvider = pair.getValue0().newInstance();
GraphManager.setGraphProvider(graphProvider);
GraphManager.setTraversalEngineType(traversalEngineType);
} catch (Exception ex) {
throw new InitializationError(ex);
}
}
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:45,代码来源:AbstractGremlinSuite.java
注:本文中的org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论