Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Cypher: Nullpointer with 2 NOTs in the where clause
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  14 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Luanne Coutinho  
View profile  
 More options May 1 2012, 12:51 am
From: Luanne Coutinho <luanne.couti...@gmail.com>
Date: Tue, 1 May 2012 10:21:22 +0530
Local: Tues, May 1 2012 12:51 am
Subject: Cypher: Nullpointer with 2 NOTs in the where clause

Hi,

Is something wrong with this query or is it an issue with Cypher (1.7)-
The following query produces an NPE whether or not each NOT is grouped by
parentheses- a single NOT works fine:

start n=node(1)
match
(person)<-[:knows|works_with]-(n)-[?:friend]-(friend)-[?:knows|works_with]- (friendProfile)
where (not((person)-[:blocks]-(n))) and (not((friendProfile)-[:blocks]-(n)))
return person.name,friendProfile.name

java.lang.NullPointerException
at
org.neo4j.cypher.internal.commands.HasRelationshipTo.isMatch(Predicate.scal a:113)
at org.neo4j.cypher.internal.commands.Not.isMatch(Predicate.scala:94)
at org.neo4j.cypher.internal.commands.And.isMatch(Predicate.scala:72)
at
org.neo4j.cypher.internal.pipes.FilterPipe$$anonfun$1.apply(FilterPipe.scal a:31)
at
org.neo4j.cypher.internal.pipes.FilterPipe$$anonfun$1.apply(FilterPipe.scal a:31)
at
scala.collection.TraversableLike$$anonfun$filter$1.apply(TraversableLike.sc ala:213)
at
scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala: 59)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.collection.TraversableLike$class.filter(TraversableLike.scala:212)
at scala.collection.immutable.List.filter(List.scala:45)
at
org.neo4j.cypher.internal.pipes.FilterPipe.createResults(FilterPipe.scala:3 1)
at
org.neo4j.cypher.internal.pipes.ExtractPipe.createResults(ExtractPipe.scala :38)
at
org.neo4j.cypher.internal.pipes.ColumnFilterPipe.createResults(ColumnFilter Pipe.scala:37)
at
org.neo4j.cypher.internal.executionplan.ExecutionPlanImpl$$anonfun$3$$anonf un$apply$1.apply(ExecutionPlanImpl.scala:62)
at
org.neo4j.cypher.internal.executionplan.ExecutionPlanImpl$$anonfun$3$$anonf un$apply$1.apply(ExecutionPlanImpl.scala:62)
at
org.neo4j.cypher.PipeExecutionResult.immutableResult(PipeExecutionResult.sc ala:36)
at
org.neo4j.cypher.PipeExecutionResult.iterator(PipeExecutionResult.scala:138 )
at
org.neo4j.cypher.PipeExecutionResult.hasNext(PipeExecutionResult.scala:140)
at scala.collection.Iterator$$anon$19.hasNext(Iterator.scala:334)
at
scala.collection.JavaConversions$IteratorWrapper.hasNext(JavaConversions.sc ala:562)

Thanks
Luanne


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luanne Coutinho  
View profile  
 More options May 1 2012, 1:37 am
From: Luanne Coutinho <luanne.couti...@gmail.com>
Date: Tue, 1 May 2012 11:07:05 +0530
Local: Tues, May 1 2012 1:37 am
Subject: Re: Cypher: Nullpointer with 2 NOTs in the where clause

Ignore this for a bit...

On Tue, May 1, 2012 at 10:21 AM, Luanne Coutinho
<luanne.couti...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luanne Coutinho  
View profile  
 More options May 1 2012, 1:40 am
From: Luanne Coutinho <luanne.couti...@gmail.com>
Date: Tue, 1 May 2012 11:10:22 +0530
Local: Tues, May 1 2012 1:40 am
Subject: Re: Cypher: Nullpointer with 2 NOTs in the where clause

Might have been the missing space between not and the starting
parenthesis...

On Tue, May 1, 2012 at 11:07 AM, Luanne Coutinho
<luanne.couti...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luanne Coutinho  
View profile  
 More options May 1 2012, 1:52 am
From: Luanne Coutinho <luanne.couti...@gmail.com>
Date: Tue, 1 May 2012 11:22:14 +0530
Local: Tues, May 1 2012 1:52 am
Subject: Re: Cypher: Nullpointer with 2 NOTs in the where clause

Okay sorry for all the mails, I'm a bit confused. My earlier queries worked
fine without the space (with a single not). Trying to figure out the
conditions under which this fails.

On Tue, May 1, 2012 at 11:10 AM, Luanne Coutinho
<luanne.couti...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luanne Misquiita  
View profile  
 More options May 1 2012, 4:44 am
From: Luanne Misquiita <luanne.couti...@gmail.com>
Date: Tue, 1 May 2012 14:14:38 +0530
Local: Tues, May 1 2012 4:44 am
Subject: Re: Cypher: Nullpointer with 2 NOTs in the where clause

So I definitely get this exception with the query. The space between the not and the parenthesis does not matter. Any ideas why?

Sent from my iPad

On 01-May-2012, at 11:22 AM, Luanne Coutinho <luanne.couti...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Hunger  
View profile  
 More options May 1 2012, 5:50 am
From: Michael Hunger <michael.hun...@neotechnology.com>
Date: Tue, 1 May 2012 11:50:50 +0200
Local: Tues, May 1 2012 5:50 am
Subject: Re: [Neo4j] Cypher: Nullpointer with 2 NOTs in the where clause

Most probably due to the optional relationships, you might get null nodes in between.

coalesce doesn't work for nodes (except if you pass in something like the ref-node).

Could you try the ! modifier, which would probably cause the expression to evaluate to false if the node is null.

Cheers

Michael

Would you be able to set up a mini-graph in the neo4j-console, that exhibits the problem? http://console.neo4j.org?init=(0) gives you an empty one to start with or use console.neo4j.org with the matrix graph.
You can use mutating cypher or geoff to build up your graph.

Am 01.05.2012 um 10:44 schrieb Luanne Misquiita:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luanne Coutinho  
View profile  
 More options May 1 2012, 10:12 am
From: Luanne Coutinho <luanne.couti...@gmail.com>
Date: Tue, 1 May 2012 19:42:16 +0530
Local: Tues, May 1 2012 10:12 am
Subject: Re: [Neo4j] Cypher: Nullpointer with 2 NOTs in the where clause

Hi Michael,

Must be the optional path, but couldn't use the ! since it appears to work
only on properties?
In any case, I created a sample of the graph at http://tinyurl.com/6lgcqab

Here is the part of the query that works:
start n=node(1)
match
(person)<-[:knows|works_with]-(n)-[?:friend]-(friend)-[?:knows|works_with]- (friendProfile)
where (not((person)-[:blocks]-(n)))
return person.name,friendProfile.name

Adding the second not fails:
start n=node(1)
match
(person)<-[:knows|works_with]-(n)-[?:friend]-(friend)-[?:knows|works_with]- (friendProfile)
where (not((person)-[:blocks]-(n))) and (not((friendProfile)-[:blocks]-(n)))
return person.name,friendProfile.name

I now realize with this and the previous question about transposing rows
that what I'm trying to do is a union. In any case, please let me know if
there's a better way to write this query or get it working, and whether I
should just split into two separate queries.

Thanks
Luanne

On Tue, May 1, 2012 at 3:20 PM, Michael Hunger <


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andres Taylor  
View profile  
 More options May 2 2012, 5:32 am
From: Andres Taylor <andres.tay...@neotechnology.com>
Date: Wed, 2 May 2012 11:32:52 +0200
Local: Wed, May 2 2012 5:32 am
Subject: Re: [Neo4j] Cypher: Nullpointer with 2 NOTs in the where clause

On Tue, May 1, 2012 at 4:12 PM, Luanne Coutinho
<luanne.couti...@gmail.com>wrote:

Nice work Luanne. I couldn't re-produce the problem with the query someone
else supplied <https://github.com/neo4j/community/issues/479>, but with
your graph set up and your query, it was super easy to locate and fix.
Lovely!

https://github.com/neo4j/community/pull/484

Andrés


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luanne Coutinho  
View profile  
 More options May 2 2012, 5:37 am
From: Luanne Coutinho <luanne.couti...@gmail.com>
Date: Wed, 2 May 2012 15:07:30 +0530
Local: Wed, May 2 2012 5:37 am
Subject: Re: [Neo4j] Cypher: Nullpointer with 2 NOTs in the where clause

Andres, that's great, thanks. Till the fix is available, I've split into
two queries.

Regards
Luanne

On Wed, May 2, 2012 at 3:02 PM, Andres Taylor <


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andres Taylor  
View profile  
 More options May 2 2012, 5:41 am
From: Andres Taylor <andres.tay...@neotechnology.com>
Date: Wed, 2 May 2012 11:41:03 +0200
Local: Wed, May 2 2012 5:41 am
Subject: Re: [Neo4j] Cypher: Nullpointer with 2 NOTs in the where clause

On Wed, May 2, 2012 at 11:37 AM, Luanne Coutinho
<luanne.couti...@gmail.com>wrote:

> Andres, that's great, thanks. Till the fix is available, I've split into
> two queries.

It had nothing to do with the number of comparisons - just make sure to
check for null before you check the relationships. Or, wait for the PR to
be merged in :)

Andrés


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luanne Coutinho  
View profile  
 More options May 2 2012, 5:56 am
From: Luanne Coutinho <luanne.couti...@gmail.com>
Date: Wed, 2 May 2012 15:26:02 +0530
Local: Wed, May 2 2012 5:56 am
Subject: Re: [Neo4j] Cypher: Nullpointer with 2 NOTs in the where clause

In this particular query, is it possible to check for a null before
checking the relationship?
By splitting the query into two, I got rid of the optional part so that
query will either return data or not.

-Luanne

On Wed, May 2, 2012 at 3:11 PM, Andres Taylor <


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Hunger  
View profile  
 More options May 2 2012, 6:21 am
From: Michael Hunger <michael.hun...@neotechnology.com>
Date: Wed, 2 May 2012 12:21:37 +0200
Local: Wed, May 2 2012 6:21 am
Subject: Re: [Neo4j] Cypher: Nullpointer with 2 NOTs in the where clause

not (node is null) AND node-[:rel]->other

??

Michael

Am 02.05.2012 um 11:56 schrieb Luanne Coutinho:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andres Taylor  
View profile  
 More options May 2 2012, 6:32 am
From: Andres Taylor <andres.tay...@neotechnology.com>
Date: Wed, 2 May 2012 12:32:50 +0200
Local: Wed, May 2 2012 6:32 am
Subject: Re: [Neo4j] Cypher: Nullpointer with 2 NOTs in the where clause

On Wed, May 2, 2012 at 12:21 PM, Michael Hunger <

michael.hun...@neotechnology.com> wrote:
> not (node is null) AND node-[:rel]->other

That's it, yes.

Andrés


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luanne Coutinho  
View profile  
 More options May 2 2012, 8:26 am
From: Luanne Coutinho <luanne.couti...@gmail.com>
Date: Wed, 2 May 2012 17:56:03 +0530
Local: Wed, May 2 2012 8:26 am
Subject: Re: [Neo4j] Cypher: Nullpointer with 2 NOTs in the where clause

Perfect, thanks!

On Wed, May 2, 2012 at 4:02 PM, Andres Taylor <


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »