• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EmptyGraph类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph的典型用法代码示例。如果您正苦于以下问题:Java EmptyGraph类的具体用法?Java EmptyGraph怎么用?Java EmptyGraph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EmptyGraph类属于org.apache.tinkerpop.gremlin.structure.util.empty包,在下文中一共展示了EmptyGraph类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: apply

import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    if (TraversalHelper.getStepsOfAssignableClass(VertexProgramStep.class, traversal).size() > 1)  // do not do if there is an OLAP chain
        return;
    final Graph graph = traversal.getGraph().orElse(EmptyGraph.instance()); // given that this strategy only works for single OLAP jobs, the graph is the traversal graph
    for (final TraversalVertexProgramStep step : TraversalHelper.getStepsOfClass(TraversalVertexProgramStep.class, traversal)) {   // will be zero or one step
        final Traversal.Admin<?, ?> computerTraversal = step.generateProgram(graph, EmptyMemory.instance()).getTraversal().get().clone();
        if (!computerTraversal.isLocked())
            computerTraversal.applyStrategies();
        final Computer computer = step.getComputer();
        if (null == computer.getEdges() && !GraphComputer.Persist.EDGES.equals(computer.getPersist())) {  // if edges() already set, use it
            final Traversal.Admin<Vertex, Edge> edgeFilter = getEdgeFilter(computerTraversal);
            if (null != edgeFilter)  // if no edges can be filtered, then don't set edges()
                step.setComputer(computer.edges(edgeFilter));
        }
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:18,代码来源:GraphFilterStrategy.java


示例2: data

import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; //导入依赖的package包/类
@Parameterized.Parameters(name = "{0}")
public static Iterable<Object[]> data() {
    return Arrays.asList(new Object[][]{
            {"addE(test).from(x)", new DefaultGraphTraversal<>(EmptyGraph.instance()).addE("test").from("x"), 1},
            {"addE(test).from(x).property(this,that)", new DefaultGraphTraversal<>(EmptyGraph.instance()).addE("test").from("x").property("this", "that"), 1},
            {"addE(test).to(x)", new DefaultGraphTraversal<>(EmptyGraph.instance()).addE("test").to("x"), 1},
            {"addE(test).to(x).property(this,that)", new DefaultGraphTraversal<>(EmptyGraph.instance()).addE("test").to("x").property("this", "that"), 1},
            {"addV()", new DefaultGraphTraversal<>(EmptyGraph.instance()).addV(), 1},
            {"addV(args)", new DefaultGraphTraversal<>(EmptyGraph.instance()).addV("test", "this"), 1},
            {"addV().property(k,v)", new DefaultGraphTraversal<>(EmptyGraph.instance()).addV().property("test", "that"), 1},
            {"properties().drop()", new DefaultGraphTraversal<>(EmptyGraph.instance()).properties().drop(), 1},
            {"properties(k).drop()", new DefaultGraphTraversal<>(EmptyGraph.instance()).properties("test").drop(), 1},
            {"out().drop()", new DefaultGraphTraversal<>(EmptyGraph.instance()).out().drop(), 1},
            {"out(args).drop()", new DefaultGraphTraversal<>(EmptyGraph.instance()).out("test").drop(), 1},
            {"outE().drop()", new DefaultGraphTraversal<>(EmptyGraph.instance()).outE().drop(), 1},
            {"outE().properties().drop()", new DefaultGraphTraversal<>(EmptyGraph.instance()).outE().properties().drop(), 1},
            {"outE(args).drop()", new DefaultGraphTraversal<>(EmptyGraph.instance()).outE("test").drop(), 1}});
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:19,代码来源:EventStrategyTest.java


示例3: shouldEventOnMutatingSteps

import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; //导入依赖的package包/类
@Test
public void shouldEventOnMutatingSteps() {
    final MutationListener listener1 = new ConsoleMutationListener(EmptyGraph.instance());
    final EventStrategy eventStrategy = EventStrategy.build()
            .addListener(listener1).create();

    eventStrategy.apply(traversal.asAdmin());

    final AtomicInteger mutatingStepsFound = new AtomicInteger(0);
    traversal.asAdmin().getSteps().stream()
            .filter(s -> s instanceof Mutating)
            .forEach(s -> {
                final Mutating mutating = (Mutating) s;
                assertEquals(1, mutating.getMutatingCallbackRegistry().getCallbacks().size());
                mutatingStepsFound.incrementAndGet();
            });

    assertEquals(expectedMutatingStepsFound, mutatingStepsFound.get());
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:20,代码来源:EventStrategyTest.java


示例4: shouldRemoveStepsCorrectly

import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; //导入依赖的package包/类
@Test
public void shouldRemoveStepsCorrectly() {
    final Traversal.Admin traversal = new DefaultTraversal<>(EmptyGraph.instance());
    traversal.asAdmin().addStep(new IdentityStep(traversal));
    traversal.asAdmin().addStep(new HasStep(traversal));
    traversal.asAdmin().addStep(new LambdaFilterStep(traversal, traverser -> true));

    traversal.asAdmin().addStep(new PropertiesStep(traversal, PropertyType.VALUE, "marko"));
    traversal.asAdmin().removeStep(3);
    validateToyTraversal(traversal);

    traversal.asAdmin().addStep(0, new PropertiesStep(traversal, PropertyType.PROPERTY, "marko"));
    traversal.asAdmin().removeStep(0);
    validateToyTraversal(traversal);

    traversal.asAdmin().removeStep(1);
    traversal.asAdmin().addStep(1, new HasStep(traversal));
    validateToyTraversal(traversal);
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:20,代码来源:TraversalHelperTest.java


示例5: apply

import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    final Graph graph = traversal.getGraph().orElse(EmptyGraph.instance()); // best guess at what the graph will be as its dynamically determined
    for (final TraversalVertexProgramStep step : TraversalHelper.getStepsOfClass(TraversalVertexProgramStep.class, traversal)) {
        final Traversal.Admin<?, ?> computerTraversal = step.generateProgram(graph, EmptyMemory.instance()).getTraversal().get().clone();
        if (!computerTraversal.isLocked())
            computerTraversal.applyStrategies();
        boolean doesMessagePass = TraversalHelper.hasStepOfAssignableClassRecursively(Scope.global, MULTI_ITERATION_CLASSES, computerTraversal);
        if (!doesMessagePass) {
            for (final VertexStep vertexStep : TraversalHelper.getStepsOfAssignableClassRecursively(Scope.global, VertexStep.class, computerTraversal)) {
                if (vertexStep.returnsVertex() || !vertexStep.getDirection().equals(Direction.OUT)) { // in-edges require message pass in OLAP
                    doesMessagePass = true;
                    break;
                }
            }
        }
        if (!doesMessagePass) {
            step.setComputer(step.getComputer()
                    // if no message passing, don't partition the loaded graph
                    .configure(Constants.GREMLIN_SPARK_SKIP_PARTITIONER, true)
                            // if no message passing, don't cache the loaded graph
                    .configure(Constants.GREMLIN_SPARK_SKIP_GRAPH_CACHE, true));
        }
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:26,代码来源:SparkSingleIterationStrategy.java


示例6: processNextStart

import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; //导入依赖的package包/类
@Override
protected Traverser.Admin<Edge> processNextStart() {
    if (this.first) {
        this.first = false;
        final TraverserGenerator generator = this.getTraversal().getTraverserGenerator();
        final Traverser.Admin traverser = generator.generate(1, (Step) this, 1); // a dead traverser to trigger the traversal
        Vertex toVertex = (Vertex) this.parameters.get(traverser, TO, Collections::emptyList).get(0);
        Vertex fromVertex = (Vertex) this.parameters.get(traverser, FROM, Collections::emptyList).get(0);
        if (toVertex instanceof Attachable)
            toVertex = ((Attachable<Vertex>) toVertex)
                    .attach(Attachable.Method.get(this.getTraversal().getGraph().orElse(EmptyGraph.instance())));
        if (fromVertex instanceof Attachable)
            fromVertex = ((Attachable<Vertex>) fromVertex)
                    .attach(Attachable.Method.get(this.getTraversal().getGraph().orElse(EmptyGraph.instance())));
        final String edgeLabel = (String) this.parameters.get(traverser, T.label, () -> Edge.DEFAULT_LABEL).get(0);
        final Edge edge = fromVertex.addEdge(edgeLabel, toVertex, this.parameters.getKeyValues(traverser, TO, FROM, T.label));
        if (callbackRegistry != null) {
            final Event.EdgeAddedEvent vae = new Event.EdgeAddedEvent(DetachedFactory.detach(edge, true));
            callbackRegistry.getCallbacks().forEach(c -> c.accept(vae));
        }
        return generator.generate(edge, this, 1L);
    } else
        throw FastNoSuchElementException.instance();


}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:27,代码来源:AddEdgeStartStep.java


示例7: map

import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; //导入依赖的package包/类
@Override
protected Edge map(final Traverser.Admin<S> traverser) {
    Vertex toVertex = this.parameters.get(traverser, TO, () -> (Vertex) traverser.get()).get(0);
    Vertex fromVertex = this.parameters.get(traverser, FROM, () -> (Vertex) traverser.get()).get(0);
    if (toVertex instanceof Attachable)
        toVertex = ((Attachable<Vertex>) toVertex)
                .attach(Attachable.Method.get(this.getTraversal().getGraph().orElse(EmptyGraph.instance())));
    if (fromVertex instanceof Attachable)
        fromVertex = ((Attachable<Vertex>) fromVertex)
                .attach(Attachable.Method.get(this.getTraversal().getGraph().orElse(EmptyGraph.instance())));
    final String edgeLabel = this.parameters.get(traverser, T.label, () -> Edge.DEFAULT_LABEL).get(0);

    final Edge edge = fromVertex.addEdge(edgeLabel, toVertex, this.parameters.getKeyValues(traverser, TO, FROM, T.label));
    if (callbackRegistry != null) {
        final EventStrategy eventStrategy = getTraversal().getStrategies().getStrategy(EventStrategy.class).get();
        final Event.EdgeAddedEvent vae = new Event.EdgeAddedEvent(eventStrategy.detach(edge));
        callbackRegistry.getCallbacks().forEach(c -> c.accept(vae));
    }
    return edge;
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:21,代码来源:AddEdgeStep.java


示例8: shouldSupportMapBasedStrategies

import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; //导入依赖的package包/类
@Test
public void shouldSupportMapBasedStrategies() throws Exception {
    GraphTraversalSource g = EmptyGraph.instance().traversal();
    assertFalse(g.getStrategies().getStrategy(SubgraphStrategy.class).isPresent());
    g = g.withStrategies(SubgraphStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
        put("vertices", __.hasLabel("person"));
        put("vertexProperties", __.limit(0));
        put("edges", __.hasLabel("knows"));
    }})));
    assertTrue(g.getStrategies().getStrategy(SubgraphStrategy.class).isPresent());
    g = g.withoutStrategies(SubgraphStrategy.class);
    assertFalse(g.getStrategies().getStrategy(SubgraphStrategy.class).isPresent());
    //
    assertFalse(g.getStrategies().getStrategy(ReadOnlyStrategy.class).isPresent());
    g = g.withStrategies(ReadOnlyStrategy.instance());
    assertTrue(g.getStrategies().getStrategy(ReadOnlyStrategy.class).isPresent());
    g = g.withoutStrategies(ReadOnlyStrategy.class);
    assertFalse(g.getStrategies().getStrategy(ReadOnlyStrategy.class).isPresent());
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:20,代码来源:GraphTraversalSourceTest.java


示例9: shouldHaveProperHashAndEquality

import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; //导入依赖的package包/类
@Test
public void shouldHaveProperHashAndEquality() {
    final GraphTraversalSource g = EmptyGraph.instance().traversal();
    final Traversal.Admin traversal1 = g.V().out().repeat(__.out().in()).times(2).groupCount().by(__.outE().count()).select(Column.keys).order().by(Order.decr).asAdmin();
    final Traversal.Admin traversal2 = g.V().out().repeat(__.out().in()).times(2).groupCount().by(__.outE().count()).select(Column.keys).order().by(Order.decr).asAdmin();
    final Traversal.Admin traversal3 = g.V().out().repeat(__.out().in()).times(2).groupCount().by(__.outE().count()).select(Column.values).order().by(Order.decr).asAdmin();

    assertEquals(traversal1, traversal2);
    assertNotEquals(traversal1, traversal3);
    assertNotEquals(traversal2, traversal3);
    //
    assertEquals(traversal1.hashCode(), traversal2.hashCode());
    assertNotEquals(traversal1.hashCode(), traversal3.hashCode());
    assertNotEquals(traversal2.hashCode(), traversal3.hashCode());
    //
    assertEquals(traversal1.getBytecode(), traversal2.getBytecode());
    assertNotEquals(traversal1.getBytecode(), traversal3.getBytecode());
    assertNotEquals(traversal2.getBytecode(), traversal3.getBytecode());
    //
    assertEquals(traversal1.getBytecode().hashCode(), traversal2.getBytecode().hashCode());
    assertNotEquals(traversal1.getBytecode().hashCode(), traversal3.getBytecode().hashCode());
    assertNotEquals(traversal2.getBytecode().hashCode(), traversal3.getBytecode().hashCode());

}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:25,代码来源:BytecodeTest.java


示例10: shouldIncludeBindingsInEquality

import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; //导入依赖的package包/类
@Test
public void shouldIncludeBindingsInEquality() {
    final Bindings b = Bindings.instance();
    final GraphTraversalSource g = EmptyGraph.instance().traversal();

    final Bytecode bytecode1 = g.V().out(b.of("a", "created")).asAdmin().getBytecode();
    final Bytecode bytecode2 = g.V().out(b.of("a", "knows")).asAdmin().getBytecode();
    final Bytecode bytecode3 = g.V().out(b.of("b", "knows")).asAdmin().getBytecode();
    final Bytecode bytecode4 = g.V().out(b.of("b", "knows")).asAdmin().getBytecode();

    assertNotEquals(bytecode1, bytecode2);
    assertNotEquals(bytecode1, bytecode3);
    assertNotEquals(bytecode2, bytecode3);
    assertNotEquals(bytecode2, bytecode4);
    assertNotEquals(bytecode1, bytecode4);
    assertEquals(bytecode3, bytecode4);

    assertEquals(1, bytecode1.getBindings().size());
    assertEquals("created", bytecode1.getBindings().get("a"));
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:21,代码来源:BytecodeTest.java


示例11: shouldIncludeBindingsInNestedTraversals

import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; //导入依赖的package包/类
@Test
public void shouldIncludeBindingsInNestedTraversals() {
    final Bindings b = Bindings.instance();
    final GraphTraversalSource g = EmptyGraph.instance().traversal();
    final Bytecode bytecode = g.V().in(b.of("a","created")).where(__.out(b.of("b","knows")).has("age",b.of("c",P.gt(32))).map(__.values(b.of("d","name")))).asAdmin().getBytecode();
    assertEquals(4, bytecode.getBindings().size());
    assertEquals("created", bytecode.getBindings().get("a"));
    assertEquals("knows", bytecode.getBindings().get("b"));
    assertEquals(P.gt(32), bytecode.getBindings().get("c"));
    assertEquals("name", bytecode.getBindings().get("d"));
    //
    Bytecode.Binding binding = (Bytecode.Binding)((List<Bytecode.Instruction>)bytecode.getStepInstructions()).get(1).getArguments()[0];
    assertEquals("a", binding.variable());
    assertEquals("created", binding.value());
    binding = (Bytecode.Binding) ((List<Bytecode.Instruction>)((Bytecode)((List<Bytecode.Instruction>)bytecode.getStepInstructions()).get(2).getArguments()[0]).getStepInstructions()).get(0).getArguments()[0];
    assertEquals("b", binding.variable());
    assertEquals("knows", binding.value());
    binding = (Bytecode.Binding) ((List<Bytecode.Instruction>)((Bytecode)((List<Bytecode.Instruction>)bytecode.getStepInstructions()).get(2).getArguments()[0]).getStepInstructions()).get(1).getArguments()[1];
    assertEquals("c", binding.variable());
    assertEquals(P.gt(32), binding.value());
    binding = (Bytecode.Binding) ((List<Bytecode.Instruction>)((Bytecode)((List<Bytecode.Instruction>)((Bytecode)((List<Bytecode.Instruction>)bytecode.getStepInstructions()).get(2).getArguments()[0]).getStepInstructions()).get(2).getArguments()[0]).getStepInstructions()).get(0).getArguments()[0];
    assertEquals("d", binding.variable());
    assertEquals("name", binding.value());
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:25,代码来源:BytecodeTest.java


示例12: data

import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; //导入依赖的package包/类
@Parameterized.Parameters(name = "{0}")
public static Iterable<Object[]> data() {
    return Arrays.asList(new Object[][]{
            {"addE(test).from(x)", new DefaultGraphTraversal<>(EmptyGraph.instance()).addE("test").from("x"), 1},
            {"addE(test).from(x).property(this,that)", new DefaultGraphTraversal<>(EmptyGraph.instance()).addE("test").from("x").property("this", "that"), 1},
            {"addE(test).to(x)", new DefaultGraphTraversal<>(EmptyGraph.instance()).addE("test").to("x"), 1},
            {"addE(test).to(x).property(this,that)", new DefaultGraphTraversal<>(EmptyGraph.instance()).addE("test").to("x").property("this", "that"), 1},
            {"addV()", new DefaultGraphTraversal<>(EmptyGraph.instance()).addV(), 1},
            {"addV().property(k,v)", new DefaultGraphTraversal<>(EmptyGraph.instance()).addV().property("test", "that"), 1},
            {"properties().drop()", new DefaultGraphTraversal<>(EmptyGraph.instance()).properties().drop(), 1},
            {"properties(k).drop()", new DefaultGraphTraversal<>(EmptyGraph.instance()).properties("test").drop(), 1},
            {"out().drop()", new DefaultGraphTraversal<>(EmptyGraph.instance()).out().drop(), 1},
            {"out(args).drop()", new DefaultGraphTraversal<>(EmptyGraph.instance()).out("test").drop(), 1},
            {"outE().drop()", new DefaultGraphTraversal<>(EmptyGraph.instance()).outE().drop(), 1},
            {"outE().properties().drop()", new DefaultGraphTraversal<>(EmptyGraph.instance()).outE().properties().drop(), 1},
            {"outE(args).drop()", new DefaultGraphTraversal<>(EmptyGraph.instance()).outE("test").drop(), 1}});
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:18,代码来源:EventStrategyTest.java


示例13: shouldEvalBytecode

import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; //导入依赖的package包/类
@Test
public void shouldEvalBytecode() throws Exception {
    final GremlinScriptEngine scriptEngine = manager.getEngineByName(ENGINE_TO_TEST);
    final Graph graph = EmptyGraph.instance();
    final GraphTraversalSource g = graph.traversal();

    // purposefully use "x" to match the name of the traversal source binding for "x" below and
    // thus tests the alias added for "x"
    final GraphTraversal t = getTraversalWithLambda(g);

    final Bindings bindings = new SimpleBindings();
    bindings.put("x", g);

    final Traversal evald = scriptEngine.eval(t.asAdmin().getBytecode(), bindings, "x");

    assertTraversals(t, evald);

    assertThat(manager.getBindings().containsKey(GremlinScriptEngine.HIDDEN_G), is(false));
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:20,代码来源:GremlinEnabledScriptEngineTest.java


示例14: shouldNotAllowBytecodeEvalWithAliasInBindings

import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void shouldNotAllowBytecodeEvalWithAliasInBindings() throws Exception {
    final GremlinScriptEngine scriptEngine = manager.getEngineByName(ENGINE_TO_TEST);
    final Graph graph = EmptyGraph.instance();
    final GraphTraversalSource g = graph.traversal();

    // purposefully use "x" to match the name of the traversal source binding for "x" below and
    // thus tests the alias added for "x"
    final GraphTraversal t = getTraversalWithLambda(g);

    final Bindings bindings = new SimpleBindings();
    bindings.put("x", g);
    bindings.put(GremlinScriptEngine.HIDDEN_G, g);

    scriptEngine.eval(t.asAdmin().getBytecode(), bindings, "x");
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:17,代码来源:GremlinEnabledScriptEngineTest.java


示例15: shouldNotAllowBytecodeEvalWithInvalidBinding

import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void shouldNotAllowBytecodeEvalWithInvalidBinding() throws Exception {
    final GremlinScriptEngine scriptEngine = manager.getEngineByName(ENGINE_TO_TEST);
    final Graph graph = EmptyGraph.instance();
    final GraphTraversalSource g = graph.traversal();

    // purposefully use "x" to match the name of the traversal source binding for "x" below and
    // thus tests the alias added for "x"
    final GraphTraversal t = getTraversalWithLambda(g);

    final Bindings bindings = new SimpleBindings();
    bindings.put("z", g);
    bindings.put("x", "invalid-binding-for-x-given-x-should-be-traversal-source");

    scriptEngine.eval(t.asAdmin().getBytecode(), bindings, "x");
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:17,代码来源:GremlinEnabledScriptEngineTest.java


示例16: formatTo

import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; //导入依赖的package包/类
/**
 * Reveal the steps in the {@link SubTraversal} by passing a {@link DefaultGraphTraversal} to it,
 * and outputting it's string representation.
 */
@Override
@SneakyThrows
default void formatTo(Formatter formatter, int flags, int width, int precision) {
  GraphTraversalSource g = new GraphTraversalSource(EmptyGraph.instance());
  GraphTraversal<?, ?> graphTraversal = apply(g);
  formatter.out().append(graphTraversal.toString());
}
 
开发者ID:karthicks,项目名称:gremlin-ogm,代码行数:12,代码来源:AnyTraversal.java


示例17: main

import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; //导入依赖的package包/类
/**
 * Run every example query, outputting results via @LOGGER
 *
 * @param argv
 * @throws Exception
 */
public static void main(String[] argv) throws Exception {
  Graph graph = EmptyGraph.instance();
  GraphTraversalSource graphTraversalSource = graph.traversal().withRemote(CONFIG_FILE);

  QueryRunner queryRunner = new QueryRunner(graphTraversalSource, "testUser0");

  LOGGER.info("Initialized the remote query executor");

  queryRunner.runQueries();

  queryRunner.close();
  // we don't need to close our graph because it is an empty graph.
}
 
开发者ID:marcelocf,项目名称:janusgraph_tutorial,代码行数:20,代码来源:RemoteQueries.java


示例18: data

import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; //导入依赖的package包/类
@Parameterized.Parameters(name = "{0}")
public static Iterable<Object[]> data() {
    return Arrays.asList(new Object[][]{
            {"addE(test).from(x)", new DefaultGraphTraversal<>(EmptyGraph.instance()).addE("test").from("x")},
            {"addE(test).from(x).property(this,that)", new DefaultGraphTraversal<>(EmptyGraph.instance()).addE("test").from("x").property("this", "that")},
            {"addE(test).to(x)", new DefaultGraphTraversal<>(EmptyGraph.instance()).addE("test").to("x")},
            {"addE(test).to(x).property(this,that)", new DefaultGraphTraversal<>(EmptyGraph.instance()).addE("test").to("x").property("this", "that")},
            {"outE().property(k,v)", new DefaultGraphTraversal<>(EmptyGraph.instance()).outE().property("test", "test")},
            {"out().properties(k).property(k,v)", new DefaultGraphTraversal<>(EmptyGraph.instance()).out().properties("test").property("test", "that")},
            {"out().property(k,v)", new DefaultGraphTraversal<>(EmptyGraph.instance()).out().property("test", "test")},
            {"out().property(Cardinality,k,v)", new DefaultGraphTraversal<>(EmptyGraph.instance()).out().property(VertexProperty.Cardinality.list, "test", "test")},
            {"addV(person)", new DefaultGraphTraversal<>(EmptyGraph.instance()).addV("person")},
            {"addV()", new DefaultGraphTraversal<>(EmptyGraph.instance()).addV()}});
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:15,代码来源:ReadOnlyStrategyTest.java


示例19: shouldNotFindStepOfClassInTraversal

import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; //导入依赖的package包/类
@Test
public void shouldNotFindStepOfClassInTraversal() {
    final Traversal.Admin traversal = new DefaultTraversal<>(EmptyGraph.instance());
    traversal.asAdmin().addStep(0, new HasStep(traversal));
    traversal.asAdmin().addStep(0, new HasStep(traversal));
    traversal.asAdmin().addStep(0, new HasStep(traversal));

    assertThat(TraversalHelper.hasStepOfClass(FilterStep.class, traversal), is(false));
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:10,代码来源:TraversalHelperTest.java


示例20: shouldFindStepOfClassInTraversal

import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; //导入依赖的package包/类
@Test
public void shouldFindStepOfClassInTraversal() {
    final Traversal.Admin traversal = new DefaultTraversal<>(EmptyGraph.instance());
    traversal.asAdmin().addStep(0, new HasStep(traversal));
    traversal.asAdmin().addStep(0, new IdentityStep<>(traversal));
    traversal.asAdmin().addStep(0, new HasStep(traversal));

    assertThat(TraversalHelper.hasStepOfClass(IdentityStep.class, traversal), is(true));
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:10,代码来源:TraversalHelperTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ActiveMQObjectMessage类代码示例发布时间:2022-05-22
下一篇:
Java AbstractConnectionAnchor类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap