Re: [Neo4j] Re: Returning items regarding the degree of separations between users.

2014-08-01 Thread Michael Azerhad
Hello Michael, Thanks for this really great detailed answer ! Like it :) However I have a question : I do really prefer the last way (at the very bottom) using cypher and expressions to lazily limit results. I wonder whether it's also possible to order by car's name (not only limiting) the

Re: [Neo4j] Re: Returning items regarding the degree of separations between users.

2014-08-01 Thread Michael Hunger
You can sort on the client or use this at the end: unwind cars as car return car order by car.name asc Michael On Fri, Aug 1, 2014 at 9:41 AM, Michael Azerhad michael.azer...@gmail.com wrote: Hello Michael, Thanks for this really great detailed answer ! Like it :) However I have a

Re: [Neo4j] Re: Returning items regarding the degree of separations between users.

2014-08-01 Thread Michael Azerhad
wow! I wasn't aware of 'unwind' keyword, perfect ! And backported to 2.0.4 :) Thanks a lot Michael, really appreciate :) Michael Le 1 août 2014 à 10:56, Michael Hunger michael.hun...@neotechnology.com a écrit : You can sort on the client or use this at the end: unwind cars as car return car

Re: [Neo4j] Re: Returning items regarding the degree of separations between users.

2014-08-01 Thread Michael Azerhad
I tried one of the query you suggested: MATCH (loggedUser:Person{id: 123})-[:KNOWS]-(p1:Person) OPTIONAL MATCH (p1)-[:SELLS]-(c1:Car) WITH p1, collect(c1)[0..{limit}] as cars OPTIONAL MATCH (p1)-[:KNOWS]-(p2:Person) OPTIONAL MATCH (p2)-[:SELLS]-(c2:Car:Degree2) WITH p2, case when length(cars)

Re: [Neo4j] Do I have to split relations of a node into domains?

2014-08-01 Thread Mattias Persson
The two approaches are essentially them same, although in 2.1 the meta node benefits are built into the store format. If you're querying relationships that are in a minority group (type+direction) there's a good benefit, but if you query relationships in a majority group, i.e. the most common

Re: [Neo4j] Re: Returning items regarding the degree of separations between users.

2014-08-01 Thread Michael Azerhad
I guess I found the reason of the slowness: If Person A is friend with B, and B is friend with C and C is friend with A (cyclic), then the query returns duplicated cars. I end up with 180 cars instead of 51 .. -- You received this message because you are subscribed to the Google Groups

Re: [Neo4j] Re: Returning items regarding the degree of separations between users.

2014-08-01 Thread Michael Azerhad
I had to add the keyword DISTINCT in my return clause like this: ... UNWIND cars as extractedCars RETURN DISTINCT(extractedCars) It took now about 150ms that is pretty fast. Is DISTINCT the best strategy in this case to avoid duplicates? Michael On Friday, August 1, 2014 2:26:19 PM UTC+2,

[Neo4j] Re: Better docs please

2014-08-01 Thread Rodger
Anders: Glad you like the suggestion. Dave: That source code from the bubble is really useful. Thanks! https://github.com/neo4j/neo4j/blob/2.1.2/community/embedded-examples/src/main/java/org/neo4j/examples/EmbeddedNeo4j.java Interesting that Java dependencies are so complex, that we actually

Re: [Neo4j] Re: Returning items regarding the degree of separations between users.

2014-08-01 Thread Michael Hunger
Yep probably Sent from mobile device Am 01.08.2014 um 14:51 schrieb Michael Azerhad michael.azer...@gmail.com: I had to add the keyword DISTINCT in my return clause like this: ... UNWIND cars as extractedCars RETURN DISTINCT(extractedCars) It took now about 150ms that is pretty fast.