Package com.tinkerpop.blueprints.impls.orient

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


    if (rid != null) {
      // REMOVE PUNCTUAL RID
      OGraphCommandExecutorSQLFactory.runInTx(new OGraphCommandExecutorSQLFactory.GraphCallBack<Object>() {
        @Override
        public Object call(OrientBaseGraph graph) {
          final OrientVertex v = graph.getVertex(rid);
          if (v != null) {
            v.remove();
            removed = 1;
          }

          return null;
        }
View Full Code Here


   * Delete the current vertex.
   */
  public boolean result(final Object iRecord) {
    final OIdentifiable id = (OIdentifiable) iRecord;
    if (id.getIdentity().isValid()) {
      final OrientVertex v = graph.getVertex(id);
      if (v != null) {
        v.remove();
        removed++;
      }
    }

    return true;
View Full Code Here

          System.out.println("Creating cluster: client_" + i + "...");
          clientType.addCluster("client_" + i);
        }
      }

      OrientVertex superNode = graph.addVertex("class:Client", "name", "superNode");
      final OrientVertex v = graph.addVertex("class:Client", "uid", counter.getAndIncrement());
      superNode.addEdge("test", v);

      superNodeRID = superNode.getIdentity();

    } finally {
View Full Code Here

      superNode = graph.getVertex(superNodeRID);
    }

    public void cycle() {
      final OrientVertex v = graph.addVertex("class:Client,cluster:client_" + currentThreadId(), "uid", counter.getAndIncrement());

      superNode.addEdge("test", v);
    }
View Full Code Here

    final ODocument rec = iRecord.getRecord();

    if (rec.getSchemaClass() != null)
      if (rec.getSchemaClass().isSubClassOf(OrientVertexType.CLASS_NAME)) {
        // VERTEX
        final OrientVertex vertex = graph.getVertex(rec);
        if (vertex != null)
          return vertex.getVertices(iDirection, iLabels);
      }

    return null;
  }
View Full Code Here

    final ODocument rec = iRecord.getRecord();

    if (rec.getSchemaClass() != null)
      if (rec.getSchemaClass().isSubClassOf(OrientVertexType.CLASS_NAME)) {
        // VERTEX
        final OrientVertex vertex = graph.getVertex(rec);
        if (vertex != null)
          return vertex.getEdges(iDirection, iLabels);
      }

    return null;
  }
View Full Code Here

    if (rec.getSchemaClass() != null)
      if (rec.getSchemaClass().isSubClassOf(OrientEdgeType.CLASS_NAME)) {
        // EDGE
        final OrientEdge edge = graph.getEdge(rec);
        if (edge != null) {
          final OrientVertex out = (OrientVertex) edge.getVertex(iDirection);

          return out;
        }
      }
View Full Code Here

  private Object getLabel(final OrientBaseGraph graph, final OIdentifiable iCurrentRecord) {
    final ODocument rec = iCurrentRecord.getRecord();

    if (rec.getSchemaClass().isSubClassOf(OrientVertexType.CLASS_NAME)) {
      // VERTEX
      final OrientVertex vertex = graph.getVertex(iCurrentRecord);
      return vertex.getLabel();

    } else if (rec.getSchemaClass().isSubClassOf(OrientEdgeType.CLASS_NAME)) {
      // EDGE
      final OrientEdge edge = graph.getEdge(iCurrentRecord);
      return edge.getLabel();
View Full Code Here

    if (OMultiValue.isMultiValue(source)) {
      if (OMultiValue.getSize(source) > 1)
        throw new IllegalArgumentException("Only one sourceVertex is allowed");
      source = OMultiValue.getFirstValue(source);
    }
    OrientVertex sourceVertex = graph.getVertex(OSQLHelper.getValue(source, record, iContext));

    Object dest = iParams[1];
    if (OMultiValue.isMultiValue(dest)) {
      if (OMultiValue.getSize(dest) > 1)
        throw new IllegalArgumentException("Only one destinationVertex is allowed");
      dest = OMultiValue.getFirstValue(dest);
    }
    OrientVertex destinationVertex = graph.getVertex(OSQLHelper.getValue(dest, record, iContext));

    if (sourceVertex.equals(destinationVertex)) {
      final List<ORID> result = new ArrayList<ORID>(1);
      result.add(destinationVertex.getIdentity());
      return result;
    }

    Direction direction = Direction.BOTH;
    if (iParams.length > 2)
      direction = Direction.valueOf(iParams[2].toString().toUpperCase());

    final ArrayQueue<OrientVertex> queue = new ArrayQueue<OrientVertex>();
    final Set<ORID> visited = new HashSet<ORID>();
    final Map<ORID, ORID> previouses = new HashMap<ORID, ORID>();

    queue.add(sourceVertex);
    visited.add(sourceVertex.getIdentity());

    OrientVertex current;
    while (!queue.isEmpty()) {
      current = queue.poll();

      final Iterable<Vertex> neighbors = current.getVertices(direction);
      for (Vertex neighbor : neighbors) {
        final OrientVertex v = (OrientVertex) neighbor;
        final ORID neighborIdentity = v.getIdentity();

        if (!visited.contains(neighborIdentity)) {

          previouses.put(neighborIdentity, current.getIdentity());
View Full Code Here

    int maxSettled = 0;
    int maxUnSettled = 0;
    int maxPredecessors = 0;

    while (continueTraversing()) {
      final OrientVertex node = getMinimum(unSettledNodes);
      unSettledNodes.remove(node);
      findMinimalDistances(node);

      if (distance.size() > maxDistances)
        maxDistances = distance.size();
View Full Code Here

TOP

Related Classes of com.tinkerpop.blueprints.impls.orient.OrientVertex

Copyright © 2018 www.massapicom. 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.