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)
> 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)
> On Tue, May 1, 2012 at 10:21 AM, Luanne Coutinho <
> luanne.couti...@gmail.com> wrote:
>> 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)
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:
> 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:
>> Ignore this for a bit...
>> On Tue, May 1, 2012 at 10:21 AM, Luanne Coutinho <
>> luanne.couti...@gmail.com> wrote:
>>> 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)
> 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:
> 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:
> Ignore this for a bit...
> On Tue, May 1, 2012 at 10:21 AM, Luanne Coutinho <luanne.couti...@gmail.com> wrote:
> 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)
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.
> 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:
>> 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:
>> 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:
>> Ignore this for a bit...
>> On Tue, May 1, 2012 at 10:21 AM, Luanne Coutinho <luanne.couti...@gmail.com> wrote:
>> 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)
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.
michael.hun...@neotechnology.com> wrote:
> 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:
> 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:
> 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:
>> 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:
>>> Ignore this for a bit...
>>> On Tue, May 1, 2012 at 10:21 AM, Luanne Coutinho <
>>> luanne.couti...@gmail.com> wrote:
>>>> 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)
> 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.
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!
> On Tue, May 1, 2012 at 4:12 PM, Luanne Coutinho <luanne.couti...@gmail.com
> > wrote:
>> 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.
> 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!
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 :)
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.
> 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 :)
> 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 <andres.tay...@neotechnology.com> wrote:
> 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 :)