limit results passed to WITH

Showing 1-5 of 5 messages
limit results passed to WITH Yaron Naveh 9/29/12 5:39 PM
Hi

Take a look at this query:

START n=node(1)
MATCH (n)-[:depends_on]->(x),  (n)-[:depends_on]->(y)         
WITH x as x, y as y
MATCH z = x-[depends_on*1..1]->y
RETURN z.name
LIMIT 10

(in simple words: the first part gathers all nodes that depend_on node #1, and the second part returns all links between all nodes from before to themselves)

The first part before the WITH returns a huge amount of results, and now all of them are being matched at z. I would like to have something like this:

WITH x as x, y as y LIMIT 100

such that only first 100 results are passed along to the heavy processing. Is it possible?

Currently my query is stack due to this.

Thanks,
Yaron
Re: [Neo4j] limit results passed to WITH Peter Neubauer 9/30/12 1:33 AM
Yaron,
this is a request that has been coming up frequently. Could you please
open a feature request issue on this? For the time being, the Java API
(especially the traverals, see
http://docs.neo4j.org/chunked/snapshot/tutorial-traversal-concepts.html,
can do this, since you can specify your own Expanders and Evaluators.
Is that an option?

Cheers,

/peter neubauer

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

Wanna learn something new? Come to http://graphconnect.com
> --
>
>
Re: [Neo4j] limit results passed to WITH Yaron Naveh 9/30/12 5:41 AM
Thanks Peter

I'm using cypher over http via the node.js driver, so this is not an option for me.

>
> --
>
>

--





--

I'm on Twitter (@YaronNaveh)


Re: [Neo4j] limit results passed to WITH Yaron Naveh 9/30/12 6:09 AM
Maybe I can statistically reduce the results?
something like:

WHERE ID(x)%4=0
WITH x as x...

Is there a modulo operation or something similar? Otherwise I can assign a value 1..4 by myself to nodes though it is much less flexible.
Re: [Neo4j] limit results passed to WITH Michael Hunger 9/30/12 8:03 AM
There is a modulo operation, with % as you said. 

see: http://console.neo4j.org/r/403q5x

And you can perhaps use collect and then "filter" on those.


Am 30.09.2012 um 06:09 schrieb Yaron Naveh:

--