Package com.tinkerpop.blueprints.impls.tg

Examples of com.tinkerpop.blueprints.impls.tg.TinkerGraph.addEdge()


    FramedGraphFactory factory = new FramedGraphFactory(new TypedGraphModuleBuilder().withClass(A.class).withClass(B.class)
        .withClass(C.class).build());
    FramedGraph<Graph> framedGraph = factory.create(graph);
    Vertex v1 = graph.addVertex(null);
    Vertex v2 = graph.addVertex(null);
    Edge cE = graph.addEdge(null, v1, v2, "label");
    cE.setProperty("type", "C");
    Base c = framedGraph.getEdge(cE.getId(), Direction.OUT, Base.class);
    assertTrue(c instanceof C);
  }
View Full Code Here


        FramedGraph<Graph> framedGraph = factory.create(graph);
        Vertex v1 = graph.addVertex(null);

        Vertex v2 = graph.addVertex(null);
        v2.setProperty("type", "A");
        Edge cE = graph.addEdge(null, v1, v2, "label");
        cE.setProperty("type", "C");
        Base c = framedGraph.getEdge(cE.getId(), Direction.OUT, Base.class);
        assertTrue(c instanceof C);
        assertTrue(((C) c).getInVertex() instanceof A);
View Full Code Here

        utf8Name.setProperty("name", "轉注");
        utf8Name.setProperty("age", 32);
        index.put("name", "轉注", utf8Name);
        graph.addVertex(utf8Name);

        graph.addEdge("12", nonUtf8, utf8Name, "created").setProperty("weight", 0.2f);

        ScriptEngine engine = new GremlinGroovyScriptEngine();

        engine.put("g", graph);
        Pipeline eval = (Pipeline) engine.eval("g.idx(\"nodes\")[['name' : 'marko']]");
View Full Code Here

        marko.setProperty("age", 32);
        Vertex stephen = graph.addVertex(3);
        stephen.setProperty("name", "stephen");
        stephen.setProperty("weight", 160.42);
        stephen.setProperty("male", true);
        Edge e = graph.addEdge(null, marko, stephen, "knows");
        e.setProperty("weight", 0.2);
        e.setProperty("type", "coworker");

        ByteArrayOutputStream bytes1 = new ByteArrayOutputStream();
        DataOutput out = new DataOutputStream(bytes1);
View Full Code Here

  public void uniqueAdjacent() {
    TinkerGraph graph = new TinkerGraph();
    Vertex a = graph.addVertex(null);
    Vertex b = graph.addVertex(null);
    Vertex c = graph.addVertex(null);
    graph.addEdge(null, a, b, "likes");
    graph.addEdge(null, a, c, "hates");

    assertThat(GraphUtil.singleAdjacent(a, Direction.OUT, "likes")).isEqualTo(b);
    assertThat(GraphUtil.singleAdjacent(a, Direction.OUT, "likes", "other")).isEqualTo(b);
    assertThat(GraphUtil.singleAdjacent(a, Direction.OUT, "other")).isNull();
View Full Code Here

    TinkerGraph graph = new TinkerGraph();
    Vertex a = graph.addVertex(null);
    Vertex b = graph.addVertex(null);
    Vertex c = graph.addVertex(null);
    graph.addEdge(null, a, b, "likes");
    graph.addEdge(null, a, c, "hates");

    assertThat(GraphUtil.singleAdjacent(a, Direction.OUT, "likes")).isEqualTo(b);
    assertThat(GraphUtil.singleAdjacent(a, Direction.OUT, "likes", "other")).isEqualTo(b);
    assertThat(GraphUtil.singleAdjacent(a, Direction.OUT, "other")).isNull();
    assertThat(GraphUtil.singleAdjacent(a, Direction.IN, "likes")).isNull();
View Full Code Here

    TinkerGraph graph = new TinkerGraph();
    Vertex a = graph.addVertex(null);
    Vertex b = graph.addVertex(null);
    Vertex c = graph.addVertex(null);
    graph.addEdge(null, a, b, "likes");
    graph.addEdge(null, a, c, "likes");

    GraphUtil.singleAdjacent(a, Direction.OUT, "likes", "hates");
  }
View Full Code Here

    TinkerGraph graph = new TinkerGraph();
    Vertex a = graph.addVertex(null);
    Vertex b = graph.addVertex(null);
    Vertex c = graph.addVertex(null);
    graph.addEdge(null, a, b, "likes");
    graph.addEdge(null, a, c, "likes");

    GraphUtil.singleAdjacent(a, Direction.OUT, "likes", "hates");
  }

  @Test
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.