title: Neo4j 1.9 Cypher Issue with "Has" Clause
body: <p>I'm migrating to Neo4j 1.9 and updating the cypher queries according to the <a href="http://docs.neo4j.org/chunked/1.9/deprecations.html" rel="nofollow">deprecations</a> migration guide, specifically:</p>
  
  <blockquote>
    <p>The ! property operator in Cypher Expressions like node.property! =
    "value" have been deprecated, please use has(node.property) AND
    node.property = "value" instead.</p>
  </blockquote>
  
  <p>The problem is that when using the <em>HAS</em> clause in combination with <em>NOT</em> I can't get the expected result. For example:</p>
  
  <p><strong>When the status property exists and is set to something other than "DONE":</strong></p>
  
  <pre><code>AND not(n.status! = "DONE") 
  </code></pre>
  
  <p>evaluates true (as expected)</p>
  
  <pre><code>AND not(has(n.status) AND n.status = "DONE")
  </code></pre>
  
  <p>evaluates false???</p>
  
  <p><strong>When the status property doesn't exist</strong></p>
  
  <pre><code>AND not(n.status! = "DONE") 
  </code></pre>
  
  <p>evaluates false</p>
  
  <pre><code>AND not(has(n.status) AND n.status = "DONE")
  </code></pre>
  
  <p>throws exception because the node doesn't exist, surely <em>HAS</em> should have prevented this? It's as though wrapping the check in <em>NOT</em> prevents the <em>HAS</em> check from being executed. </p>
  
  <p>This can be reproduced via the <a href="http://docs.neo4j.org/chunked/milestone/query-where.html#where-property-exists" rel="nofollow">live query examples on the neo4j docs website</a> using the following queries:</p>
  
  <pre><code>MATCH n 
  WHERE NOT (n.name! = 'Peter') 
  RETURN n
  </code></pre>
  
  <p>This returns all (3) nodes who either have no name or whose name is not "Peter". This is the result I want to reproduce but without using the now deprecated "!" operator.</p>
  
  <pre><code>MATCH n 
  WHERE NOT (HAS (n.name) AND n.name = 'Peter') 
  RETURN n
  </code></pre>
  
  <p>Throws a node not found exception because one node doesn't have a name property. :/</p>
  
  <pre><code>MATCH n 
  WHERE (HAS (n.name) AND n.name = 'Peter') 
  RETURN n
  </code></pre>
  
  <p>Correctly returns the node whose name is "Peter".</p>
  
  <p>I've tried rewriting the query in a few alternative ways but can't seem to reliably get the result I want that matches the deprecated ! operator. Maybe it's just getting late and I'm missing something obvious? :) </p>
  
  <p>Any Help is appreciated!</p>
  
  <p>Thanks,
  Mark.</p>