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 ExecutionResult traversable only once?
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
  4 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
 
Wujek Srujek  
View profile  
 More options Oct 15 2012, 9:18 am
From: Wujek Srujek <wujek.sru...@gmail.com>
Date: Mon, 15 Oct 2012 15:18:49 +0200
Local: Mon, Oct 15 2012 9:18 am
Subject: Cypher ExecutionResult traversable only once?

Hi. I have the following (Groovy) code:

        ExecutionResult res = new ExecutionEngine(graphDb).execute('start
from = node({from}) match from-[:IS_PART_OF]->t return t', [from: node])
        println '> first traversal start'
        for (def o : res) {
            println o['t']
        }
        println '> first traversal end'
        println '> second traversal start'
        for (def o : res) {
            println o['t']
        }
        println '> second traversal end'

The results are:

> first traversal start
Node[3]
> first traversal end
> second traversal start
> second traversal end

The output and my debugging results show that somehow I can only traverse
the results once. ExecutionResult.iterator first returns an internal Scala
iterator whose toString says 'non-empty iterator', but the second time I
get an 'empty iterator'.
Is this expected behavior, or am I doing something wrong? I am using the
javacompat classes. If this is expected, I think this could be documented,
as normally when people see Iterable they think they can traverse the thing
multiple times.

Regards,
wujek


 
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.
Peter Neubauer  
View profile  
 More options Oct 16 2012, 9:39 am
From: Peter Neubauer <peter.neuba...@neotechnology.com>
Date: Tue, 16 Oct 2012 15:38:34 +0200
Local: Tues, Oct 16 2012 9:38 am
Subject: Re: [Neo4j] Cypher ExecutionResult traversable only once?
Hi Wujek,
yes, this is expected behaviour. Cypher is lazily fetching the results
and will per default not cache the result set. You are right in
documenting this. Could you please raise an issue on that?

Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

Neo4j 1.8 GA - http://www.dzone.com/links/neo4j_18_release_fluent_graph_literacy.html


 
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.
wujek  
View profile  
 More options Oct 17 2012, 4:24 am
From: wujek <wujek.sru...@gmail.com>
Date: Wed, 17 Oct 2012 01:24:00 -0700 (PDT)
Subject: Re: [Neo4j] Cypher ExecutionResult traversable only once?

Hi. Done: https://github.com/neo4j/community/issues/928

One question - if its traversable only once, why the decision to return an
Iterable, not an Iterator? This would be very clear. Or does it have
something to do with the fact that one needs an Iterable to use the Java
for-each loop?

wujek


 
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.
Peter Neubauer  
View profile  
 More options Oct 17 2012, 5:26 am
From: Peter Neubauer <peter.neuba...@neotechnology.com>
Date: Wed, 17 Oct 2012 11:26:12 +0200
Local: Wed, Oct 17 2012 5:26 am
Subject: Re: [Neo4j] Cypher ExecutionResult traversable only once?
Thank you Wujek,
I actually marked it as a bug, even if it might not be :)

Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

Neo4j 1.8 GA - http://www.dzone.com/links/neo4j_18_release_fluent_graph_literacy.html


 
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 »