I want to find all sequence of nodes with their names occurring in a list and having the same sequence id exits in the relationship in between. for eg: based on the graph constructed from the query below:
MERGE (a:Person { name: 'graph'})
MERGE (b:Person { name: 'server' })
MERGE (a)-[:NEXT{seqid:1}]->(b)
MERGE (c:Person { name: 'server' })
MERGE (d:Person { name: 'db'})
MERGE (c)-[:NEXT{seqid:1}]->(d)
MERGE (a1:Person { name: 'graph'})
MERGE (b:Person { name: 'db' })
MERGE (a)-[:NEXT{seqid:2}]->(b)
MERGE (c:Person { name: 'db' })
MERGE (d:Person { name: 'server'})
MERGE (c)-[:NEXT{seqid:2}]->(d)
find all sequences of nodes with their names in the given list , say ['graph','server','db'] with same 'seqid' property exists in the relationship in between.
i.e.
(graph)->(server)-(db) with same seqid :1
(graph)->(db)->(server) with same seqid :1 //there can be another matching
sequence with same seqid
(graph)->(db)->(server) with same seqid :2
Is there a way to keep only the final sequence of nodes say ' (graph)->(server)->(db)' for each sequences instead of each of the subpath of a large sequence like (graph)->(server) or (server)->(db)
pls help me to solve this.........
(I am using neo4j 2.3.6 community edition via java api in embedded mode..)