Package com.tinkerpop.blueprints

Examples of com.tinkerpop.blueprints.Direction


        // if this is a query and the _return is "count" then we don't bother to send back the result array
        boolean countOnly = queryArguments.isCountOnly();
        // what kind of data the calling client wants back (vertices, edges, count, vertex identifiers)
        ReturnType returnType = queryArguments.getReturnType();
        // the query direction (both, out, in)
        Direction queryDirection = queryArguments.getQueryDirection();

        VertexQuery query = vertex.query().direction(queryDirection);

        JSONArray elementArray = new JSONArray();
        long counter = 0;
View Full Code Here


              removeInverseEdge(iVertex, iFieldName, iVertexToRemove, curr, useVertexFieldsForEdgeLabels);
            found = true;
            break;

          } else if (curr.getSchemaClass().isSubClassOf(OrientEdgeType.CLASS_NAME)) {
            final Direction direction = getConnectionDirection(iFieldName, useVertexFieldsForEdgeLabels);

            // EDGE, REMOVE THE EDGE
            if (iVertexToRemove.equals(OrientEdge.getConnection(curr, direction.opposite()))) {
              it.remove();
              if (iAlsoInverse)
                removeInverseEdge(iVertex, iFieldName, iVertexToRemove, curr, useVertexFieldsForEdgeLabels);
              found = true;
              break;
            }
          }
        }

        if (!found)
          OLogManager.instance()
              .warn(null, "[OrientVertex.removeEdges] edge %s not found in field %s", iVertexToRemove, iFieldName);

        deleteEdgeIfAny(iVertexToRemove);

      } else {

        // DELETE ALL THE EDGES
        for (Iterator<OIdentifiable> it = bag.rawIterator(); it.hasNext();) {
          final OIdentifiable edge = it.next();

          if (iAlsoInverse)
            removeInverseEdge(iVertex, iFieldName, null, edge, useVertexFieldsForEdgeLabels);

          deleteEdgeIfAny(edge);
        }
      }

      if (bag.isEmpty())
        // FORCE REMOVAL OF ENTIRE FIELD
        iVertex.removeField(iFieldName);
    } else if (fieldValue instanceof Collection) {
      final Collection col = (Collection) fieldValue;

      if (iVertexToRemove != null) {
        // SEARCH SEQUENTIALLY (SLOWER)
        boolean found = false;
        for (Iterator<OIdentifiable> it = col.iterator(); it.hasNext();) {
          final ODocument curr = it.next().getRecord();

          if (iVertexToRemove.equals(curr)) {
            // FOUND AS VERTEX
            it.remove();
            if (iAlsoInverse)
              removeInverseEdge(iVertex, iFieldName, iVertexToRemove, curr, useVertexFieldsForEdgeLabels);
            found = true;
            break;

          } else if (curr.getSchemaClass().isSubClassOf(OrientEdgeType.CLASS_NAME)) {
            final Direction direction = getConnectionDirection(iFieldName, useVertexFieldsForEdgeLabels);

            // EDGE, REMOVE THE EDGE
            if (iVertexToRemove.equals(OrientEdge.getConnection(curr, direction.opposite()))) {
              it.remove();
              if (iAlsoInverse)
                removeInverseEdge(iVertex, iFieldName, iVertexToRemove, curr, useVertexFieldsForEdgeLabels);
              found = true;
              break;
View Full Code Here

      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>();
View Full Code Here

            } else if (curr.getSchemaClass().isSubClassOf(
                OrientEdge.CLASS_NAME)) {
              // EDGE
              if (curr.getSchemaClass().isSubClassOf(
                  OrientEdge.CLASS_NAME)) {
                final Direction direction = getConnectionDirection(
                    iFieldName,
                    useVertexFieldsForEdgeLabels);

                // EDGE, REMOVE THE EDGE
                if (iVertexToRemove.equals(OrientEdge
                    .getConnection(curr,
                        direction.opposite()))) {
                  it.remove();
                  if (iAlsoInverse)
                    removeInverseEdge(iVertex,
                        iFieldName,
                        iVertexToRemove, curr,
View Full Code Here

            // what kind of data the calling client wants back (vertices, edges, count, vertex identifiers)
            final ReturnType returnType = queryArguments.getReturnType();

            // the query direction (both, out, in)
            final Direction queryDirection = queryArguments.getQueryDirection();

            long counter = 0l;
            final JSONArray elementArray = new JSONArray();

            VertexQuery query = vertex.query().direction(queryDirection);
View Full Code Here

    public ExtensionResponse doFramesWorkOnEdge(@RexsterContext RexsterResourceContext rexsterResourceContext,
                                                @RexsterContext Graph graph,
                                                @RexsterContext Edge edge,

                                                @ExtensionRequestParameter(name = "direction", description = "the direction of the edge (must be \"" + TOKEN_BOTH + "\", \"" + TOKEN_IN + "\", or \"" + TOKEN_OUT + "\" with the default being \"" + TOKEN_BOTH + "\"") String directionString) {
        Direction direction = Direction.BOTH;
        if (directionString != null && !directionString.isEmpty()) {
            if (directionString.equals(TOKEN_IN)) {
                direction = Direction.IN;
            } else if (directionString.equals(TOKEN_OUT)) {
                direction = Direction.OUT;
View Full Code Here

  @Override
  public Set<? extends Vertex> getOtherVertexes(final Vertex vertex) {
    Set<Vertex> result = new LinkedHashSet<Vertex>();
    Class<?> vclass = vertex.getClass();
    Direction od = null;
    if (getInType().equals(vclass))
      od = Direction.OUT;
    if (od == null && getOutType().equals(vclass))
      od = Direction.IN;
    if (od == null && getInType().isAssignableFrom(vclass))
View Full Code Here

  @Override
  public Set<Vertex> getOtherVertexesByEdge(final Vertex vertex, final String... sortproperties) {
    Set<Vertex> result = new LinkedHashSet<Vertex>();
    Class<?> vclass = vertex.getClass();
    Direction od = null;
    if (getInType().equals(vclass))
      od = Direction.OUT;
    if (od == null && getOutType().equals(vclass))
      od = Direction.IN;
    if (od == null && getInType().isAssignableFrom(vclass))
View Full Code Here

    return sub;
  }

  private void browse(Vertex from, int cursor, List<Object> edgePath) {
    if (from != null && cursor < edgePath.size()) {
      Direction edgeDirection = (Direction) edgePath.get(cursor);
      String edgeLabel = (String) edgePath.get(cursor + 1);
      Iterable<Edge> edges = from.getEdges(edgeDirection, edgeLabel);
      for (Edge edge : edges) {
        edgesToCopy.add(edge);
        Vertex tail = edge.getVertex(edgeDirection.opposite());
        copy(tail);
        browse(tail, cursor + 2, edgePath);
      }
    }
  }
View Full Code Here

                    for (InternalRelation del : deletedRelations) {
                        Preconditions.checkArgument(del.isRemoved());
                        for (int pos = 0; pos < del.getLen(); pos++) {
                            InternalVertex vertex = del.getVertex(pos);
                            if (pos == 0 || !del.isLoop()) mutations.put(vertex, del);
                            Direction dir = EdgeDirection.fromPosition(pos);
                            if (acquireLocks && del.getType().isUnique(dir) &&
                                    ((InternalType) del.getType()).uniqueLock(dir)) {
                                Entry entry = edgeSerializer.writeRelation(del, pos, tx);
                                mutator.acquireEdgeLock(IDHandler.getKey(vertex.getID()), entry.getColumn(), entry.getValue());
                            }
                        }
                        //Update Indexes
                        if (del.isProperty()) {
                            if (acquireLocks) indexSerializer.lockKeyedProperty((TitanProperty) del, mutator);
                        }

                    }
                }

                ListMultimap<InternalType, InternalRelation> otherEdgeTypes = ArrayListMultimap.create();

                //3. Sort Added Edges
                for (InternalRelation relation : addedRelations) {
                    Preconditions.checkArgument(relation.isNew());

                    TitanType type = relation.getType();

                    //Give special treatment to edge type definitions
                    if (SystemTypeManager.prepersistedSystemTypes.contains(type)) {
                        InternalType itype = (InternalType) relation.getVertex(0);
                        otherEdgeTypes.put(itype, relation);
                    } else { //STANDARD TitanRelation
                        for (int pos = 0; pos < relation.getLen(); pos++) {
                            InternalVertex vertex = relation.getVertex(pos);
                            if (pos == 0 || !relation.isLoop()) mutations.put(vertex, relation);
                            Direction dir = EdgeDirection.fromPosition(pos);
                            if (acquireLocks && relation.getType().isUnique(dir) && !vertex.isNew()
                                    && ((InternalType) relation.getType()).uniqueLock(dir)) {
                                Entry entry = edgeSerializer.writeRelation(relation, pos, tx);
                                mutator.acquireEdgeLock(IDHandler.getKey(vertex.getID()), entry.getColumn(), null);
                            }
View Full Code Here

TOP

Related Classes of com.tinkerpop.blueprints.Direction

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.