本文整理汇总了Java中org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies.addStrategies方法的典型用法代码示例。如果您正苦于以下问题:Java TraversalStrategies.addStrategies方法的具体用法?Java TraversalStrategies.addStrategies怎么用?Java TraversalStrategies.addStrategies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies
的用法示例。
在下文中一共展示了TraversalStrategies.addStrategies方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testWellDefinedDependency3
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void testWellDefinedDependency3() {
//Dependency well defined
TraversalStrategies s = new DefaultTraversalStrategies();
s.addStrategies(d, c, a, e, b);
assertEquals(5, s.toList().size());
assertEquals(a, s.toList().get(0));
assertEquals(b, s.toList().get(1));
assertEquals(d, s.toList().get(2));
assertEquals(c, s.toList().get(3));
assertEquals(e, s.toList().get(4));
s = s.clone();
assertEquals(5, s.toList().size());
assertEquals(a, s.toList().get(0));
assertEquals(b, s.toList().get(1));
assertEquals(d, s.toList().get(2));
assertEquals(c, s.toList().get(3));
assertEquals(e, s.toList().get(4));
}
示例2: shouldBeVerifiedIllegal
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void shouldBeVerifiedIllegal() {
final TraversalStrategies strategies = new DefaultTraversalStrategies();
strategies.addStrategies(ComputerVerificationStrategy.instance());
this.traversal.asAdmin().setParent(new TraversalVertexProgramStep(EmptyTraversal.instance(), EmptyTraversal.instance())); // trick it
this.traversal.asAdmin().setStrategies(strategies);
try {
this.traversal.asAdmin().applyStrategies();
if (!this.legal)
fail("The traversal should not be allowed: " + this.traversal);
} catch (final VerificationException ise) {
if (this.legal)
fail("The traversal should be allowed: " + this.traversal);
}
}
示例3: shouldBeVerifiedIllegal
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void shouldBeVerifiedIllegal() {
final TraversalStrategies strategies = new DefaultTraversalStrategies();
strategies.addStrategies(LambdaRestrictionStrategy.instance());
traversal.asAdmin().setStrategies(strategies);
if (allow) {
traversal.asAdmin().applyStrategies();
} else {
try {
traversal.asAdmin().applyStrategies();
fail("The strategy should not allow lambdas: " + this.traversal);
} catch (VerificationException ise) {
assertTrue(ise.getMessage().contains("lambda"));
}
}
}
示例4: shouldBeVerifiedIllegal
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void shouldBeVerifiedIllegal() {
final TraversalStrategies strategies = new DefaultTraversalStrategies();
strategies.addStrategies(ProfileStrategy.instance());
strategies.addStrategies(LambdaRestrictionStrategy.instance());
traversal.asAdmin().setStrategies(strategies);
if (allow) {
traversal.asAdmin().applyStrategies();
} else {
try {
traversal.asAdmin().applyStrategies();
fail("The strategy should not allow lambdas: " + this.traversal);
} catch (VerificationException ise) {
assertTrue(ise.getMessage().contains("lambda"));
}
}
}
示例5: doTest
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void doTest() {
final TraversalStrategies strategies = new DefaultTraversalStrategies();
strategies.addStrategies(TinkerGraphCountStrategy.instance());
for (final TraversalStrategy strategy : this.otherStrategies) {
strategies.addStrategies(strategy);
}
this.original.asAdmin().setStrategies(strategies);
this.original.asAdmin().applyStrategies();
assertEquals(this.optimized, this.original);
}
示例6: doTest
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void doTest() {
final TraversalStrategies strategies = new DefaultTraversalStrategies();
strategies.addStrategies(TinkerGraphStepStrategy.instance());
for (final TraversalStrategy strategy : this.otherStrategies) {
strategies.addStrategies(strategy);
}
this.original.asAdmin().setStrategies(strategies);
this.original.asAdmin().applyStrategies();
assertEquals(this.optimized, this.original);
}
示例7: TraversalExplanation
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
public TraversalExplanation(final Traversal.Admin<?, ?> traversal) {
this.traversal = traversal.clone();
TraversalStrategies mutatingStrategies = new DefaultTraversalStrategies();
for (final TraversalStrategy strategy : this.traversal.getStrategies().toList()) {
final Traversal.Admin<?, ?> mutatingTraversal = this.traversal.clone();
mutatingStrategies.addStrategies(strategy);
mutatingTraversal.setStrategies(mutatingStrategies);
mutatingTraversal.applyStrategies();
this.strategyTraversals.add(Pair.with(strategy, mutatingTraversal));
}
}
示例8: doTest
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void doTest() {
final TraversalStrategies strategies = new DefaultTraversalStrategies();
strategies.addStrategies(new VertexProgramStrategy(Computer.compute()), ComputerVerificationStrategy.instance());
original.asAdmin().setStrategies(strategies);
original.asAdmin().applyStrategies();
assertEquals(optimized, original);
}
示例9: addRequirements
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
public static void addRequirements(final TraversalStrategies traversalStrategies, final TraverserRequirement... requirements) {
RequirementsStrategy strategy = (RequirementsStrategy) traversalStrategies.toList().stream().filter(s -> s instanceof RequirementsStrategy).findAny().orElse(null);
if (null == strategy) {
strategy = new RequirementsStrategy();
traversalStrategies.addStrategies(strategy);
} else {
final RequirementsStrategy cloneStrategy = new RequirementsStrategy();
cloneStrategy.requirements.addAll(strategy.requirements);
strategy = cloneStrategy;
traversalStrategies.addStrategies(strategy);
}
Collections.addAll(strategy.requirements, requirements);
}
示例10: testWellDefinedDependency
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void testWellDefinedDependency() {
//Dependency well defined
TraversalStrategies s = new DefaultTraversalStrategies();
s.addStrategies(b, a);
assertEquals(2, s.toList().size());
assertEquals(a, s.toList().get(0));
assertEquals(b, s.toList().get(1));
}
示例11: testNoDependency
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void testNoDependency() {
//No dependency
TraversalStrategies s = new DefaultTraversalStrategies();
s.addStrategies(c, a);
assertEquals(2, s.toList().size());
}
示例12: shouldBeVerifiedIllegal
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void shouldBeVerifiedIllegal() {
try {
final TraversalStrategies strategies = new DefaultTraversalStrategies();
strategies.addStrategies(StandardVerificationStrategy.instance());
traversal.asAdmin().setStrategies(strategies);
traversal.asAdmin().applyStrategies();
fail("The strategy should not allow traversal: " + this.traversal);
} catch (IllegalStateException ise) {
assertTrue(true);
}
}
示例13: testCircularDependency
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void testCircularDependency() {
//Circular dependency => throws exception
TraversalStrategies s = new DefaultTraversalStrategies();
try {
s.addStrategies(c, k, a, b);
fail();
} catch (IllegalStateException ex) {
assertTrue(ex.getMessage().toLowerCase().contains("cyclic"));
}
}
示例14: testCircularDependency2
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void testCircularDependency2() {
//Circular dependency => throws exception
TraversalStrategies s = new DefaultTraversalStrategies();
try {
s.addStrategies(d, c, k, a, e, b);
fail();
} catch (IllegalStateException ex) {
assertTrue(ex.getMessage().toLowerCase().contains("cyclic"));
}
}
示例15: testLotsOfStrategies
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void testLotsOfStrategies() {
//Lots of strategies
TraversalStrategies s = new DefaultTraversalStrategies();
s = s.addStrategies(b, l, m, n, o, a);
assertTrue(s.toList().indexOf(a) < s.toList().indexOf(b));
s = s.clone();
assertTrue(s.toList().indexOf(a) < s.toList().indexOf(b));
// sort and then add more
s = new DefaultTraversalStrategies();
s.addStrategies(b, a, c);
assertEquals(3, s.toList().size());
assertEquals(a, s.toList().get(0));
assertEquals(b, s.toList().get(1));
assertEquals(c, s.toList().get(2));
s.addStrategies(d);
s = s.clone();
assertEquals(4, s.toList().size());
assertEquals(a, s.toList().get(0));
assertEquals(b, s.toList().get(1));
assertEquals(d, s.toList().get(2));
assertEquals(c, s.toList().get(3));
s.addStrategies(e);
assertEquals(5, s.toList().size());
assertEquals(a, s.toList().get(0));
assertEquals(b, s.toList().get(1));
assertEquals(d, s.toList().get(2));
assertEquals(c, s.toList().get(3));
assertEquals(e, s.toList().get(4));
}