Examples of OrientBaseGraph


Examples of com.tinkerpop.blueprints.impls.orient.OrientBaseGraph

  }

  @Override
  public long countVertices(String iClassName) {

    final OrientBaseGraph g = acquire();
    try {
      return g.countVertices(iClassName);
    } finally {
      g.shutdown();
    }
  }
View Full Code Here

Examples of com.tinkerpop.blueprints.impls.orient.OrientBaseGraph

    }
  }

  public long countEdges() {

    final OrientBaseGraph g = acquire();
    try {
      return g.countEdges();
    } finally {
      g.shutdown();
    }
  }
View Full Code Here

Examples of com.tinkerpop.blueprints.impls.orient.OrientBaseGraph

  }

  @Override
  public long countEdges(String iClassName) {

    final OrientBaseGraph g = acquire();
    try {
      return g.countEdges(iClassName);
    } finally {
      g.shutdown();
    }
  }
View Full Code Here

Examples of com.tinkerpop.blueprints.impls.orient.OrientBaseGraph

      g.shutdown();
    }
  }

  public <V> V execute(final OCallable<V, OrientBaseGraph> iCallable) {
    final OrientBaseGraph graph = acquire();
    try {
      return iCallable.call(graph);
    } finally {
      graph.shutdown();
    }
  }
View Full Code Here

Examples of com.tinkerpop.blueprints.impls.orient.OrientBaseGraph

    beginAsynchOperation();

    return new OrientVertexFuture(Orient.instance().getWorkers().submit(new Callable<OrientVertex>() {
      @Override
      public OrientVertex call() throws Exception {
        final OrientBaseGraph g = acquire();
        try {
          OrientVertex v = (OrientVertex) getVertex(id);
          if (v != null) {
            // System.out.printf("\nVertex loaded key=%d, v=%s", id, v);
            for (int retry = 0;; retry++) {
              MERGE_RESULT result = mergeAndSaveRecord(retry, v.getRecord(), prop);
              switch (result) {
              case MERGED:
                return v;
              case ERROR:
                throw new ORecordDuplicatedException("Cannot create a new vertices", v.getIdentity());
              case RETRY:
                if (retry > maxRetries)
                  break;
              }
            }
          }

          v = g.addVertex(id, prop);

          // System.out.printf("\nCreated vertex key=%d, v=%s", id, v);

          verticesCreated.incrementAndGet();

          return v;

        } catch (ORecordDuplicatedException e) {
          System.out.printf("\n*** Vertex already exists key=%d, v=%s", id, e.getRid());

          // ALREADY EXISTS, TRY TO MERGE IT
          for (int retry = 0;; retry++) {
            indexUniqueException.incrementAndGet();

            if (OLogManager.instance().isDebugEnabled())
              OLogManager.instance().debug(this, "Vertex %s already created, merge it and retry again (retry=%d/%d)", id, retry,
                  maxRetries);

            final ODocument existent = e.getRid().getRecord();

            final MERGE_RESULT result = mergeAndSaveRecord(retry, existent, prop);

            switch (result) {
            case MERGED:
              OrientVertex v = (OrientVertex) getVertex(existent);
              return v;
            case RETRY:
              break;
            case ERROR:
              throw e;
            }
          }
        } finally {
          g.shutdown();
          endAsynchOperation();
        }
      }
    }));
  }
View Full Code Here

Examples of com.tinkerpop.blueprints.impls.orient.OrientBaseGraph

    beginAsynchOperation();

    return new OrientVertexFuture(Orient.instance().getWorkers().submit(new Callable<OrientVertex>() {
      @Override
      public OrientVertex call() throws Exception {
        final OrientBaseGraph g = acquire();
        try {
          OrientVertex v = g.addVertex(id, prop);

          verticesCreated.incrementAndGet();

          return v;

        } finally {
          g.shutdown();
          endAsynchOperation();
        }
      }
    }));
  }
View Full Code Here

Examples of com.tinkerpop.blueprints.impls.orient.OrientBaseGraph

      }
    }));
  }

  public OrientVertex getOrAddVertex(final Object id) {
    final OrientBaseGraph g = acquire();
    try {
      OrientVertex v = getFromCache(id);
      if (v != null)
        return v;

      v = g.addVertex(id);

      verticesCreated.incrementAndGet();

      return v;

    } finally {
      g.shutdown();
    }
  }
View Full Code Here

Examples of com.tinkerpop.blueprints.impls.orient.OrientBaseGraph

    beginAsynchOperation();

    return new OrientVertexFuture(Orient.instance().getWorkers().submit(new Callable<OrientVertex>() {
      @Override
      public OrientVertex call() throws Exception {
        final OrientBaseGraph g = acquire();
        try {
          final OrientVertex v = g.addVertex(id);

          verticesCreated.incrementAndGet();

          return v;
        } finally {
          g.shutdown();
          endAsynchOperation();
        }
      }
    }));
  }
View Full Code Here

Examples of com.tinkerpop.blueprints.impls.orient.OrientBaseGraph

  public static OGremlinEngineThreadLocal INSTANCE = new OGremlinEngineThreadLocal();

  public ScriptEngine get(final OrientBaseGraph iGraph) {
    ScriptEngine engine = super.get();
    if (engine != null) {
      final OrientBaseGraph currGraph = (OrientBaseGraph) engine.getBindings(ScriptContext.ENGINE_SCOPE).get("g");
      if (currGraph == iGraph || (currGraph != null && currGraph.getRawGraph().getURL().equals(iGraph.getRawGraph().getURL())))
        // REUSE IT
        return engine;
    }

    // CREATE A NEW ONE
View Full Code Here

Examples of com.tinkerpop.blueprints.impls.orient.OrientBaseGraph

    return "Syntax error: " + name + "([<labels>])";
  }

  public Object execute(final Object iThis, final OIdentifiable iCurrentRecord, final Object iCurrentResult,
      final Object[] iParameters, final OCommandContext iContext) {
    final OrientBaseGraph graph = OGraphCommandExecutorSQLFactory.getGraph(false);

    final String[] labels;
    if (iParameters != null && iParameters.length > 0 && iParameters[0] != null)
      labels = OMultiValue.array(iParameters, String.class, new OCallable<Object, Object>() {
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.