public static void unlink(final ODatabaseGraphTx iDatabase, final ODocument iSourceVertex, final ODocument iTargetVertex) {
		if (iTargetVertex == null)
			throw new IllegalArgumentException("Missed the target vertex");

		if (iDatabase.existsUserObjectByRID(iSourceVertex.getIdentity())) {
			// WORK ALSO WITH IN MEMORY OBJECTS

			final OGraphVertex vertex = (OGraphVertex) iDatabase.getUserObjectByRecord(iSourceVertex, null);
			// REMOVE THE EDGE OBJECT
			if (vertex.out != null) {
				final Set<OGraphEdge> obj = vertex.out.get();
				if (obj != null)
					for (OGraphEdge e : obj)
						if (e.getIn().getDocument().equals(iTargetVertex))
							obj.remove(e);
			}
		}

		if (iDatabase.existsUserObjectByRID(iTargetVertex.getIdentity())) {
			// WORK ALSO WITH IN MEMORY OBJECTS

			final OGraphVertex vertex = (OGraphVertex) iDatabase.getUserObjectByRecord(iTargetVertex, null);
			// REMOVE THE EDGE OBJECT FROM THE TARGET VERTEX
			if (vertex.in != null) {
				final Set<OGraphEdge> obj = vertex.in.get();
				if (obj != null)
					for (OGraphEdge e : obj)
						if (e.getOut().getDocument().equals(iSourceVertex))
							obj.remove(e);
			}
		}

		final List<ODocument> edges2Remove = new ArrayList<ODocument>();

		// REMOVE THE EDGE DOCUMENT
		ODocument edge = null;
		Set<ODocument> docs = iSourceVertex.field(OGraphDatabase.VERTEX_FIELD_OUT);
		if (docs != null) {
			// USE A TEMP ARRAY TO AVOID CONCURRENT MODIFICATION TO THE ITERATOR
			for (OIdentifiable d : docs) {
				final ODocument doc = (ODocument) d.getRecord();
				if (doc.field(OGraphDatabase.EDGE_FIELD_IN).equals(iTargetVertex)) {
					edges2Remove.add(doc);
					edge = doc;
				}
			}

			for (ODocument d : edges2Remove)
				docs.remove(d);
		}

		if (edge == null)
			throw new OGraphException("Edge not found between the ougoing edges");

		iSourceVertex.setDirty();
		iSourceVertex.save();

		docs = iTargetVertex.field(OGraphDatabase.VERTEX_FIELD_IN);

		// REMOVE THE EDGE DOCUMENT FROM THE TARGET VERTEX
		if (docs != null) {
			edges2Remove.clear();

			for (OIdentifiable d : docs) {
				final ODocument doc = (ODocument) d.getRecord();
				if (doc.field(OGraphDatabase.EDGE_FIELD_IN).equals(iTargetVertex))
					edges2Remove.add(doc);
			}

			for (ODocument d : edges2Remove)
				docs.remove(d);
		}

		iTargetVertex.setDirty();
		iTargetVertex.save();

		edge.delete();
	}
public static void unlink ( final ODatabaseGraphTx iDatabase , final ODocument iSourceVertex , final ODocument iTargetVertex ) { if ( iTargetVertex == null ) throw new IllegalArgumentException ( "Missed the target vertex" ) ; if ( iDatabase . existsUserObjectByRID ( iSourceVertex . getIdentity ( ) ) ) { final OGraphVertex vertex = ( OGraphVertex ) iDatabase . getUserObjectByRecord ( iSourceVertex , null ) ; if ( vertex . out != null ) { final Set < OGraphEdge > obj = vertex . out . get ( ) ; if ( obj != null ) for ( OGraphEdge e : obj ) if ( e . getIn ( ) . getDocument ( ) . equals ( iTargetVertex ) ) obj . remove ( e ) ; } } if ( iDatabase . existsUserObjectByRID ( iTargetVertex . getIdentity ( ) ) ) { final OGraphVertex vertex = ( OGraphVertex ) iDatabase . getUserObjectByRecord ( iTargetVertex , null ) ; if ( vertex . in != null ) { final Set < OGraphEdge > obj = vertex . in . get ( ) ; if ( obj != null ) for ( OGraphEdge e : obj ) if ( e . getOut ( ) . getDocument ( ) . equals ( iSourceVertex ) ) obj . remove ( e ) ; } } final List < ODocument > edges2Remove = new ArrayList < ODocument > ( ) ; ODocument edge = null ; Set < ODocument > docs = iSourceVertex . field ( OGraphDatabase . VERTEX_FIELD_OUT ) ; if ( docs != null ) { for ( OIdentifiable d : docs ) { final ODocument doc = ( ODocument ) d . getRecord ( ) ; if ( doc . field ( OGraphDatabase . EDGE_FIELD_IN ) . equals ( iTargetVertex ) ) { edges2Remove . add ( doc ) ; edge = doc ; } } for ( ODocument d : edges2Remove ) docs . remove ( d ) ; } if ( edge == null ) throw new OGraphException ( "Edge not found between the ougoing edges" ) ; iSourceVertex . setDirty ( ) ; iSourceVertex . save ( ) ; docs = iTargetVertex . field ( OGraphDatabase . VERTEX_FIELD_IN ) ; if ( docs != null ) { edges2Remove . clear ( ) ; for ( OIdentifiable d : docs ) { final ODocument doc = ( ODocument ) d . getRecord ( ) ; if ( doc . field ( OGraphDatabase . EDGE_FIELD_IN ) . equals ( iTargetVertex ) ) edges2Remove . add ( doc ) ; } for ( ODocument d : edges2Remove ) docs . remove ( d ) ; } iTargetVertex . setDirty ( ) ; iTargetVertex . save ( ) ; edge . delete ( ) ; }
Unlinks all the edges between iSourceVertex and iTargetVertex

@param iDatabase
@param iSourceVertex
@param iTargetVertex