[Neo4j 2.0.3] - Cypher / WHERE NOT syntax with an AND expression

18 views
Skip to first unread message

Michael Azerhad

unread,
May 21, 2014, 5:32:28 PM5/21/14
to ne...@googlegroups.com
Hi everyone,

My case is very simple.

Let's assume three Car nodes:

Car(name: "Ferrari")
Car(name: "Porsche")
Car(name: "Aston Martin")

And this request:

MATCH (c:Car)
RETURN c
.name


This of course well returns the three names.

Now I want to execute this simple query using a WHERE NOT:

MATCH (c:Car)
WHERE NOT
(c.name = "Ferrari" AND 1=2)   // I expect to always have a FALSE return, so that it still displays the three names.
RETURN c
.name


However, the result is:   
Porsche
Aston Martin

Why doesn't this query return "Ferrari" too?  
It seems to behave exactly like if I had written:    WHERE NOT(c.name = "Ferrari")

I don't figure out why? 

How can I achieve this query?

Thanks a lot,

Michael






Michael Azerhad

unread,
May 21, 2014, 5:39:01 PM5/21/14
to ne...@googlegroups.com
Even this case:

MATCH (c:Car)
WHERE NOT
(c.name = "Ferrari" AND 1=1)   
RETURN c
.name

behaves like:

MATCH (c:Car)
WHERE NOT
(c.name = "Ferrari") AND NOT (1=1)   //explaining why 0 rows are returned !  (Indeed NOT (1=1) is never matched)   
RETURN c
.name

Why?  It seems that an AND expression into a NOT expression doesn't work.

Michael Azerhad

unread,
May 21, 2014, 5:48:21 PM5/21/14
to ne...@googlegroups.com
Thanks to this law: http://en.wikipedia.org/wiki/De_Morgan%27s_laws

I transform the part: 
WHERE NOT(c.name = "Ferrari" AND 1=1) 

to

WHERE NOT(c.name = "Ferrari") OR NOT(1=1)

It would be good if an AND expression could be evaluated in a NOT expression.

Wes Freeman

unread,
May 21, 2014, 7:14:21 PM5/21/14
to Neo4J
It looks like it's fixed in 2.1-rc1.

Wes

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Azerhad

unread,
May 21, 2014, 7:18:09 PM5/21/14
to ne...@googlegroups.com
Oh cool :)

Do you know when should the 2.1 RELEASE emerge ? 
I searched on the Net but in vain.

Thanks a lot,

Michael  

Wes Freeman

unread,
May 21, 2014, 9:07:36 PM5/21/14
to Neo4J
I'll give you a date of tomorrow with confidence +/- 6 months. No idea. :) Last time, the RC1 to release time was less than a month, though. I'd love to hear official estimates.

Wes

Michael Azerhad

unread,
May 21, 2014, 9:14:57 PM5/21/14
to ne...@googlegroups.com
Ok :) 
So I Will test it tomorrow ( the man who doesn't understand your meaning/joke ;))

So let's wait .. will surely be an amazing upgrade. 

Thanks a lot Wes.
You received this message because you are subscribed to a topic in the Google Groups "Neo4j" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/neo4j/2lehsRKiTps/unsubscribe.
To unsubscribe from this group and all its topics, send an email to neo4j+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages