title: Cypher WHERE NOT EXISTS with named variable
body: <p>In a Neo4J database, I need to find a (complex) pattern with 3 named node (let's say a, b, c) and some other non-named nodes, but only if there is no node (say "x") that connects to a, b, and c.</p>
  
  <p>I'd like to write something like : </p>
  
  <pre><code>MATCH (a:A)-&lt;something&gt;-(b:B)-&lt;something&gt;-(c:C)
  WHERE NOT EXISTS ((a)--(x:X)--(b), (x)--(c) )
  RETURN a, b, c
  </code></pre>
  
  <p>But I get "Variable <code>x</code> not defined". It would be easy if x was only forbidden if connected to (a) and (b). And <code>NOT EXISTS (a)--(:X)--(b) AND NOT EXISTS (a)--(:X)--(c)</code> is too strong.</p>
  
  <p>Any ideas?</p>