@Procedure @PerformsWrites @Description("apoc.refactor.from(rel, startNode) redirect relationship to use new start-node") public Stream<RelationshipRefactorResult> from(@Name("relationship") Relationship rel,@Name("newNode") Node newNode){
  RelationshipRefactorResult result=new RelationshipRefactorResult(rel.getId());
  try {
    Relationship newRel=newNode.createRelationshipTo(rel.getEndNode(),rel.getType());
    copyProperties(rel,newRel);
    rel.delete();
    return Stream.of(result.withOther(newRel));
  }
 catch (  Exception e) {
    return Stream.of(result.withError(e));
  }
}

@ Procedure @ PerformsWrites @ Description ( "apoc.refactor.from(rel, startNode) redirect relationship to use new start-node" ) public Stream < RelationshipRefactorResult > from ( @ Name ( "relationship" ) Relationship rel , @ Name ( "newNode" ) Node newNode ) { RelationshipRefactorResult result = new RelationshipRefactorResult ( rel . getId ( ) ) ; try { Relationship newRel = newNode . createRelationshipTo ( rel . getEndNode ( ) , rel . getType ( ) ) ; copyProperties ( rel , newRel ) ; rel . delete ( ) ; return Stream . of ( result . withOther ( newRel ) ) ; } catch ( Exception e ) { return Stream . of ( result . withError ( e ) ) ; } }
redirects a relationships to a new target node .
