I've been having quite a bit of trouble with a query I'm building today. To me it seems like it should be quite straightforward, but I'm not seeing the expected results. And for reference, I am testing out the queries in the browser for viz purposes, but I get the same results when using py2neo
.
So I first match a set of nodes based upon some indexed IDs I have for them. This gives me 20 nodes and I can return the nodes, but not the relationships displayed in the Neo4j browser:
MATCH (node1:Protein)
WHERE node1.dbID IN ['7375Prot', '7967Prot', '8873Prot', '8352Prot', '12809Prot', '6980Prot', '2529Prot', '15524Prot', '9875Prot', '7418Prot', '1639Prot', '12813Prot', '6010Prot', '1497Prot', '12821Prot', '8998Prot', '13991Prot', '14166Prot', '12950Prot', '14733Prot']
RETURN node1
Great, but now what if I want to return those nodes and all of those relationships depicted in the browser? When I try doing a path query and return the path I am only getting around 20 relationships and 7/20 nodes. Similarly, if I do a path query and try returning the relationships I only get 9 relationships.
MATCH (node1:Protein)
WHERE node1.dbID IN ['7375Prot', '7967Prot', '8873Prot', '8352Prot', '12809Prot', '6980Prot', '2529Prot', '15524Prot', '9875Prot', '7418Prot', '1639Prot', '12813Prot', '6010Prot', '1497Prot', '12821Prot', '8998Prot', '13991Prot', '14166Prot', '12950Prot', '14733Prot']
MATCH p=(node1)-[rels]-(node1)
RETURN p
I saw a suggestion to use CALL apoc.algo.cover(node1) YIELD rel
but it only returns 9 relationships.
MATCH (node1:Protein)
WHERE node1.dbID IN ['7375Prot', '7967Prot', '8873Prot', '8352Prot', '12809Prot', '6980Prot', '2529Prot', '15524Prot', '9875Prot', '7418Prot', '1639Prot', '12813Prot', '6010Prot', '1497Prot', '12821Prot', '8998Prot', '13991Prot', '14166Prot', '12950Prot', '14733Prot']
CALL apoc.algo.cover(node1) YIELD rel
RETURN rel
Can someone please help me or explain why I'm having so much difficulty? I've also tried chaining together a MATCH
and returning all the relationships between node1
, but again, that only returns a subset.