graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientBaseGraph.java
private static void removeInverseEdge(final OrientBaseGraph graph, final ODocument iVertex, final String iFieldName,
      final OIdentifiable iVertexToRemove, final OIdentifiable currentRecord, final boolean useVertexFieldsForEdgeLabels,
      final boolean autoScaleEdgeType, boolean forceReload) {

    final ODocument r = getDocument(currentRecord, forceReload);

    if (r == null)
      return;

    final String inverseFieldName = OrientVertex.getInverseConnectionFieldName(iFieldName, useVertexFieldsForEdgeLabels);
    OImmutableClass immutableClass = ODocumentInternal.getImmutableSchemaClass(r);
    OClass klass = ODocumentInternal.getImmutableSchemaClass(r);
    if (klass == null) {
      graph.getDatabase().getMetadata().reload();
      klass = graph.getDatabase().getMetadata().getSchema().getClass(inverseFieldName);
      if (klass == null) {
        OLogManager.instance().warn(null, "Removing edge, schema class not found for " + r);
        return;
      }
    }
    if (klass.isVertexType()) {
      // DIRECT VERTEX
      removeEdges(graph, r, inverseFieldName, iVertex, false, useVertexFieldsForEdgeLabels, autoScaleEdgeType, forceReload);
      r.save();

    } else if (klass.isEdgeType()) {
      // EDGE, REMOVE THE EDGE
      final OIdentifiable otherVertex = OrientEdge
          .getConnection(r, OrientVertex.getConnectionDirection(inverseFieldName, useVertexFieldsForEdgeLabels));

      if (otherVertex != null) {
        if (iVertexToRemove == null || otherVertex.equals(iVertexToRemove)) {

          final int maxRetries = graph.getMaxRetries();
          for (int retry = 0; retry < maxRetries; ++retry) {
            try {
              final ODocument otherVertexRecord = getDocument(otherVertex, forceReload);

              // BIDIRECTIONAL EDGE
              removeEdges(graph, otherVertexRecord, inverseFieldName, (OIdentifiable) currentRecord, false,
                  useVertexFieldsForEdgeLabels, autoScaleEdgeType, forceReload);

              if (otherVertexRecord != null)
                otherVertexRecord.save();

              break;

            } catch (ONeedRetryException e) {
              // RETRY
            }
          }
        }
      }
    }
  }
private static void removeInverseEdge(final OrientBaseGraph graph, final ODocument iVertex, final String iFieldName,
      final OIdentifiable iVertexToRemove, final OIdentifiable currentRecord, final boolean useVertexFieldsForEdgeLabels,
      final boolean autoScaleEdgeType, boolean forceReload) {

    final ODocument r = getDocument(currentRecord, forceReload);

    if (r == null)
      return;

    final String inverseFieldName = OrientVertex.getInverseConnectionFieldName(iFieldName, useVertexFieldsForEdgeLabels);
    OImmutableClass immutableClass = ODocumentInternal.getImmutableSchemaClass(r);
    OClass klass = ODocumentInternal.getImmutableSchemaClass(r);
    if (klass == null) {
      graph.getDatabase().getMetadata().reload();
      klass = graph.getDatabase().getMetadata().getSchema().getClass(inverseFieldName);
      if (klass == null) {
        OLogManager.instance().warn(null, "Removing edge, schema class not found for " + r);
        return;
      }
    }
    if (klass.isVertexType()) {
      // DIRECT VERTEX
      removeEdges(graph, r, inverseFieldName, iVertex, false, useVertexFieldsForEdgeLabels, autoScaleEdgeType, forceReload);
      r.save();

    } else if (klass.isEdgeType()) {
      // EDGE, REMOVE THE EDGE
      final OIdentifiable otherVertex = OrientEdge
          .getConnection(r, OrientVertex.getConnectionDirection(inverseFieldName, useVertexFieldsForEdgeLabels));

      if (otherVertex != null) {
        if (iVertexToRemove == null || otherVertex.equals(iVertexToRemove)) {

          final int maxRetries = graph.getMaxRetries();
          for (int retry = 0; retry < maxRetries; ++retry) {
            try {
              final ODocument otherVertexRecord = getDocument(otherVertex, forceReload);

              // BIDIRECTIONAL EDGE
              removeEdges(graph, otherVertexRecord, inverseFieldName, (OIdentifiable) currentRecord, false,
                  useVertexFieldsForEdgeLabels, autoScaleEdgeType, forceReload);

              if (otherVertexRecord != null)
                otherVertexRecord.save();

              break;

            } catch (ONeedRetryException e) {
              // RETRY
            }
          }
        }
      }
    }
  }
(Internal only)