Examples of TransactionalGraph


Examples of com.tinkerpop.blueprints.TransactionalGraph

    /**
     * Stops a transaction with failure if the graph is transactional.  If the graph is not transactional,
     * the method does nothing.
     */
    public void tryRollback() {
        final TransactionalGraph transactionalGraph = tryGetTransactionalGraph();
        if (transactionalGraph != null) {
            // will leave this as stopTransaction until we completely remove it from blueprints so as to get as
            // much backward compatibility as we can
            //transactionalGraph.rollback();
            transactionalGraph.stopTransaction(TransactionalGraph.Conclusion.FAILURE);
        }
    }
View Full Code Here

Examples of com.tinkerpop.blueprints.TransactionalGraph

    @RexsterContext Graph graph) {

    ExtensionResponse response = handlePost(graph, context, VERTEX);

    if (graph instanceof TransactionalGraph) {
      TransactionalGraph tgraph = (TransactionalGraph) graph;
      tgraph.commit();
    }

    return response;
  }
View Full Code Here

Examples of com.tinkerpop.blueprints.TransactionalGraph

      }

      edge = graph.addEdge(null, out, in, label);
      accumulateAttributes(edge, element);
      if (graph instanceof TransactionalGraph) {
        TransactionalGraph tgraph = (TransactionalGraph) graph;
        try {
          tgraph.commit();
          return;
        } catch (Exception e) {
          tgraph.rollback();
          logger.warn("Exception thrown while saving edge: " + e.toString());
          logger.warn("retry: " + retryCount);
          /* need to work out the Exceptions to handle?! */
          prevException = e;
        }
View Full Code Here

Examples of com.tinkerpop.blueprints.TransactionalGraph

        g.createKeyIndex("name", Vertex.class);
        Vertex juno = g.addVertex(null);
        juno.setProperty("name", "juno");
        juno = g.getVertices("name", "juno").iterator().next();

        TransactionalGraph tx = g.newTransaction();
        Thread[] threads = new Thread[10];
        for (int i = 0; i < threads.length; i++) {
            //threads[i]=new Thread(new DoSomething(tx));
            threads[i].start();
        }
        for (int i = 0; i < threads.length; i++) threads[i].join();
        tx.commit();
    }
View Full Code Here

Examples of com.tinkerpop.blueprints.pgm.TransactionalGraph

        // Since we already have a dependency on Gremlin, we use the GraphML
        // export functionality from
        // there.

        TransactionalGraph graph = GremlinFactory.getGremlinWrappedGraph();

        try
        {

            new File( target.getParent() ).mkdir();
View Full Code Here

Examples of com.tinkerpop.blueprints.pgm.TransactionalGraph

    public static TransactionalGraph getGremlinWrappedGraph()
            throws DatabaseBlockedException
    {
        GraphDatabaseService dbInstance = DatabaseLocator.getGraphDatabase();
        System.out.println("GremlinFactory: " + dbInstance);
        TransactionalGraph graph;
        try
        {
            graph = new Neo4jGraph( dbInstance,
                    DatabaseLocator.getIndexService() );
View Full Code Here

Examples of com.tinkerpop.blueprints.pgm.TransactionalGraph

        try
        {
            ScriptEngine engine = new GremlinScriptEngine();

            // Inject the local database
            TransactionalGraph graph = getGremlinWrappedGraph();

            engine.getBindings( ScriptContext.ENGINE_SCOPE ).put( "$_g", graph );

            try
            {
                engine.getBindings( ScriptContext.ENGINE_SCOPE ).put( "$_",
                        graph.getVertex( 0l ) );
            }
            catch ( Exception e )
            {
                // Om-nom-nom
            }
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.