Lambda expression in WHERE clause not working properly

I am new to Neo4j and trying to make a simple Cypher request using the lambda expression in the where clause, but for some reason I cannot understand why this is not working.

It looks like:

class HealthNode { public string Name{get;set;} //Other Stuff } string Name = "Foobar"; var query = client .Cypher .Start(new { n = Neo4jClient.Cypher.All.Nodes }) .Where((HealthNode n) => n.Name == Name) .Return<HealthNode>("n"); 

If I discard the text and parameters that I get:

 START n=node(*) WHERE (n.Name! = {p0}) RETURN n //P0 Foobar 

When I do this, of course, I get:

 Cypher does not support != for inequality comparisons. Use <> instead 

Why is there an additional exclamation point in the world for a variable name?

+4
source share
3 answers

! means the result will be false if the property does not exist. So, if there is more than one type on the chart, and the other type does not have the "Name" property, neo4j will not interfere with the comparison.

See the Neo4J documentation for more details .

As for getting a warning! =, do you even change the query when you insert it? Reformat it? Since I get the same warning if I do this:

 WHERE (n.Name != {p0}) 

but don't get a warning and successful completion if I use:

 WHERE (n.Name! = {p0}) 
0
source

I think I found the cause of the problem here:

A change was made to the parser 2.0, which implements the default NULL IF (instead of returning an error if the property is missing) and deletes! as well as? operators because they don’t do anything else.

neo4j pull request 1014 I suspect this will break a lot of things, not just the Neo4J Client.

0
source

Fixed in Neo4jClient 1.0.0.625 and higher when talking with Neo2j 2.0.

0
source

Source: https://habr.com/ru/post/1498775/


All Articles