If I have a graph by executing this query, then i want to delete a middle node say 'and' and connect its previous node say 'graph' to its child node say 'db' by using its corresponding outgoing relationships based on same 'seqid'
MERGE (n:Person { name: 'graph'})
MERGE (n:Person { name: 'and'})
MERGE (n:Person { name: 'relational' })
MERGE (n:Person { name: 'nosql'})
MERGE (n:Person { name: 'server'})
MERGE (n:Person { name: 'db'})
MERGE (a:Person { name: 'graph'}) MERGE (b:Person { name: 'and' }) MERGE (a)-[:NEXT{seqid:1}]->(b)
MERGE (a:Person { name: 'and' }) MERGE (b:Person { name: 'db'}) MERGE (a)-[:NEXT{seqid:1 , caps: 'true'}]->(b)
MERGE (a:Person { name: 'relational'}) MERGE (b:Person { name: 'db'}) MERGE (a)-[:NEXT{seqid:1}]->(b)
MERGE (a:Person { name: 'nosql'}) MERGE (b:Person { name: 'db' }) MERGE (a)-[:NEXT{seqid:2, caps: 'true'}]->(b)
MERGE (a:Person { name: 'server'}) MERGE (b:Person { name: 'and' }) MERGE (a)-[:NEXT{seqid:1}]->(b)
MERGE (a:Person { name: 'and' }) MERGE (b:Person { name: 'db'}) MERGE (a)-[:NEXT{seqid:1}]->(b)
MERGE (a:Person { name: 'server'}) MERGE (b:Person { name: 'and'}) MERGE (a)-[:CONNECTS{seqid:2}]->(b)
MERGE (a:Person { name: 'and' }) MERGE (b:Person { name: 'db'}) MERGE (a)-[:CONNECTS{seqid:2, caps: 'true'}]->(b)
i.e.
(graph)-[:NEXT{seqid:1 , caps: 'true'}]->(db)
(relational)-[:NEXT{seqid:1}]->(db)
(nosql)-[:NEXT{seqid:2, caps: 'true'}]->(db)
(server)-[:NEXT{seqid:1}]->(db)
(server)-[:CONNECTS{seqid:2, caps: 'true'}]->(db)
pls help me to solve this.............
(I am using neo4j 2.3.6 community edition via java api in embedded mode..)