I am trying to return all the :Drug's that are not [:Incompatible_with]-(origin) and also not [:Incompatible_with]->(candidate2), aka the other candidates. I've started with this query:
match (origin)-[r1:CONTAINS]-(c)-[r2:CONTAINS]-(candidate)
WHERE origin.id = 'A' and not (candidate)-[:Incompatible_with]-(origin)
AND type(r1)=type(r2)
RETURN origin.id AS origin, candidate.id AS candidate, collect(r2.weight) AS weight order by weight desc
But it still returns C, when I also need to just return B. I've tried with adding other longer MATCH clauses that only result in no changes
Would anyone be able to help tell me what I'm missing?
-Rachel
MATCH (c:Drug)-[:Incompatible_with]->(d)
MATCH (o:Drug)-[r1:CONTAINS]->(g:Compound)<-[r2:CONTAINS]-(f)
WHERE f.id <> d.id AND o.id = "A"
RETURN o.id, f.id, collect(r2.weight) as Weight ORDER BY Weight;
^This worked super for my small example above, but when I tried adding to the original db and made another node F [:Incompatible_with] origin node 'A', it returned C and the node that was incompatible with A. Adding the new node :
match (g:Compound {id: '475') create (f:Drug {id: 'F'})-[CONTAINS]->(g);
match (f:Drug {id: 'F'}) match (a:Drug {id: 'A'}) create (f)-[:Incompatible_with]->(a)
Now when I run your query, I get back C, F, and B. I tried modifying the query with line 3:
MATCH (c:Drug)-[:Incompatible_with]->(d)
MATCH (o:Drug)-[r1:CONTAINS]->(g)<-[r2:CONTAINS]-(f)
WHERE f.id <> d.id AND o.id = "A" and not (f)-[:Incompatible_with]-(o)
RETURN o.id, f.id, collect(r2.weight) as Weight ORDER BY Weight desc
But then I still get back C & B. I'd like to just get back B here
-Rachel