Package com.tinkerpop.blueprints.impls.orient

Examples of com.tinkerpop.blueprints.impls.orient.OrientGraph.commit()


    graph.addEdge(null, graph.getVertex(tomCruise), graph.getVertex(megRyan),"friend");
    totalElements++;
    graph.addEdge(null, graph.getVertex(tomCruise), graph.getVertex(nicoleKidman), "married").setProperty("year", 1990);
    totalElements++;

    graph.commit();
  }

  public void traverseSQLAllFromActorNoWhere() {
    List<ODocument> result1 = database.command(new OSQLSynchQuery<ODocument>("traverse * from " + tomCruise.getIdentity()))
        .execute();
View Full Code Here


      Map<String, Object> p2 = new HashMap<String, Object>();
      p2.put("based_on", "0002");
      OrientEdge e2 = v3.addEdge(null, v4, "TestEdge", null, p2);
      e2.save();

      graph.commit();

      graph.command(new OCommandSQL("delete edge TestEdge where based_on = '0001'")).execute();

      Iterable<OrientVertex> edges = graph.command(new OCommandSQL("select count(*) from TestEdge where based_on = '0001'"))
          .execute();
View Full Code Here

    Vertex vUser = graph.addVertex("class:User");
    Vertex vCar = graph.addVertex("class:Car");
    graph.addEdge("class:Owns", vUser, vCar, null);

    graph.commit();

    Iterable<Vertex> res = graph.command(new OCommandSQL("select expand( out('Owns') ) from User")).execute();
    assertTrue(res.iterator().hasNext());
    assertEquals("Car", res.iterator().next().getProperty("@class").toString());
View Full Code Here

    OrientBaseGraph graphPool = new OrientGraph(url);

    graphPool.setThreadMode(OrientBaseGraph.THREAD_MODE.ALWAYS_AUTOSET);
    OrientVertex superNode = graphPool.addVertex(null, "pessimisticSuperNode", true);
    graphPool.commit();

    PessimisticThread[] ops = new PessimisticThread[THREADS];
    for (int i = 0; i < THREADS; ++i)
      ops[i] = new PessimisticThread(url, superNode, i, "thread" + i);
View Full Code Here

    startedOn = System.currentTimeMillis();

    OrientBaseGraph graphPool = new OrientGraph(url);

    OrientVertex superNode = graphPool.addVertex(null, "optimisticSuperNode", true);
    graphPool.commit();

    OptimisticThread[] ops = new OptimisticThread[THREADS];
    for (int i = 0; i < THREADS; ++i)
      ops[i] = new OptimisticThread(url, superNode, i, "thread" + i);
View Full Code Here

    Vertex vertexInOne = graph.addVertex(null);
    Vertex vertexInTwo = graph.addVertex(null);

    vertexOutOne.addEdge("link", vertexInOne);
    vertexOutOne.addEdge("link", vertexInTwo);
    graph.commit();

    Vertex vertexOutTwo = graph.addVertex("class:IndexedOutVertex");
    vertexOutTwo.addEdge("link", vertexInTwo);

    try {
View Full Code Here

    Vertex vertexOutTwo = graph.addVertex("class:IndexedOutVertex");
    vertexOutTwo.addEdge("link", vertexInTwo);

    try {
      graph.commit();

      //in vertex can be linked by only one out vertex.
      Assert.fail();
    } catch (ORecordDuplicatedException e) {
    }
View Full Code Here

  }

  private void initGraph() {
    OrientGraph graph = new OrientGraph(URL);
    graph.setAutoStartTx(false);
    graph.commit();

    final OrientVertexType vertexType = graph.createVertexType("TestVertex");
    vertexType.createProperty("uuid", OType.STRING);
    vertexType.createIndex("TestVertexUuidIndex", OClass.INDEX_TYPE.UNIQUE_HASH_INDEX, "uuid");
View Full Code Here

                  graph.command(
                      new OCommandSQL("CREATE EDGE TestEdge FROM " + gFromVertex.getId() + " TO " + gToVertex.getId()
                          + " SET uuid = '" + edge.uuid + "'")).execute();
                }

                graph.commit();

                success = true;
              } catch (OConcurrentModificationException e) {
                graph.rollback();
View Full Code Here

  @Test
  public void testTraverse() {
    OrientGraph graph = new OrientGraph(url);
    graph.setAutoStartTx(false);
    graph.commit();

    OClass oc = graph.getVertexType("vertexA");
    if (oc == null)
      oc = graph.createVertexType("vertexA");
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.