Re: [Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-11 Thread Peter Neubauer
Hi there, I wanted to look into more efficient ways to send back big responses, but had not time. Basically, throwing in more memory is what you have to do right now, or get Cypher or Gremlin to return more effective representations like only the properties you need, which cuts down the amount of d

Re: [Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-11 Thread Kevin Versfeld
hi Michael/Peter Peter: yes, that about sums it up. Webadmin console is fine, but REST not so much. Michael: my final set is a little over 100K nodes, and while I am still playing around as part of a technical proof of concept, I think I will need this data more or less in its entirety. I pumped

Re: [Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-10 Thread Michael Hunger
Kevin, how large is the dataset that is build up? I'm not sure but the REST Plugin and the Webadmin use different implementations where webadmin streams the results with ajax and the REST plugin builds up a full string result. Do you need all of the data? Or would it be possible to page it? Or

Re: [Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-10 Thread Peter Neubauer
Kevin, So the webadmin console is displaying the 100k nodes ok, men but rest barfs? On Nov 11, 2011 6:42 AM, "Kevin Versfeld" wrote: > furthermore, I tried a simple query, that returns about the same number of > rows (still around 100K), and increased the timeout of my REST call (to > several min

Re: [Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-10 Thread Marko A. Rodriguez
Hi Kevin, That is unfortunate. Peter is the man to track down such things in Neo4j REST. Hopefully it's something obvious. Glad the REPL and WebAdmin is speedy. Good luck, Marko. http://markorodriguez.com On Nov 10, 2011, at 10:42 PM, Kevin Versfeld wrote: > furthermore, I tried a simple qu

Re: [Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-10 Thread Kevin Versfeld
furthermore, I tried a simple query, that returns about the same number of rows (still around 100K), and increased the timeout of my REST call (to several minutes) - and got my OutOfMemoryError again :) latest query is just g.v(293).in('R_Bought'). Running it through the webadmin console is quick,

Re: [Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-10 Thread Kevin Versfeld
hi, thanks for the quick reply. I need to add some more info (some I left out, some I discovered later) This only happens when I use that gremlin over REST. Executing the gremlin in the webadmin console is pretty quick, and I don't see any memory spikes or anything. What I did (after posting the p

Re: [Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-10 Thread Marko Rodriguez
Hi, > I've been trying that query out (slightly modified now to return all nodes > of a different kind, but attached to a node in the first set), on a data set > of around 100K, and I'm getting an OutOfMemoryError: > { > "message" : "GC overhead limit exceeded", > "exception" : "java.lang.OutOfM

Re: [Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-10 Thread Kevin Versfeld
hi again I've been trying that query out (slightly modified now to return all nodes of a different kind, but attached to a node in the first set), on a data set of around 100K, and I'm getting an OutOfMemoryError: { "message" : "GC overhead limit exceeded", "exception" : "java.lang.OutOfMemoryE

Re: [Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-08 Thread Kevin Versfeld
Perfect, thanks! (Seems so obvious now... *sigh*) At least I now have the easier query done, and can get on to the tricky ones *nervous* -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/Gremlin-how-to-flatten-a-tree-and-sort-tp3480586p3489600.html Sent

Re: [Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-07 Thread Marko Rodriguez
Hey, > I figured I needed to do a projection of sorts, and the only thing I > could get working was a transform(), as follows: > > m.sort{a,b -> a.value <=> b.value}._().transform(){a -> a.key} m.sort{a,b -> a.value <=> b.value}.keySet() ...will return you the keys of the map in sorted

Re: [Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-07 Thread Kevin Versfeld
Great! Thanks Marko, this has been very helpful. I did realise my mistake on the sort: when I tried it the way you suggested originally, I also had a few other things wrong, and obviously did not apply a methodical approach to solving it. One last question: I need to just return the nodes, at the

Re: [Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-07 Thread Marko Rodriguez
Hey, > I've played around a bit more, and this is the query that currently works > best for me... would anyone mind "reviewing" it for me please? Feels a > little like I'm getting the right answer, but the wrong way > gremlin> m = [:]; > gremlin> g.v(162).in('R_PartOf').loop(1){m.put(it.object

Re: [Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-07 Thread Marko Rodriguez
Hey, >From my cell phone. Add >> -1 after the traversals so it iterated and fills map. Gremlin REPL automagically iterates it. Hope that is clear, Marko. On Nov 7, 2011 1:31 AM, "Kevin Versfeld" wrote: hi again I suspect I'm missing something small, but when I run the following in the webadmi

Re: [Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-07 Thread Kevin Versfeld
hi again I've played around a bit more, and this is the query that currently works best for me... would anyone mind "reviewing" it for me please? Feels a little like I'm getting the right answer, but the wrong way gremlin> m = [:]; gremlin> g.v(162).in('R_PartOf').loop(1){m.put(it.object, it.lo

Re: [Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-07 Thread Kevin Versfeld
hi again I suspect I'm missing something small, but when I run the following in the webadmin console, I don't get any output? m = [:]; g.v(162).in('R_PartOf').loop(1){m.put(it.object, it.loops); true}.cap.next().sort{a, b -> a.value <=> b.value}.keySet >> [] (m is empty too...) Thanks for the

Re: [Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-06 Thread Tatham Oddie
Marko, > And I'm saying "nasty" with a South African accent so you know its dirty. Thanks to working with Romiko, I'm getting an eerily clear mental image of that. -- Tatham ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/

Re: [Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-04 Thread Marko Rodriguez
Hi, > Thanks! I will still need to try this out, but the idea (in your first > response) kind of feels more or less like what I knew I needed. I have so > many questions now based on the responses so far - it feels like I'm just > scratching the surface! Once you "get it," you can get nasty with

Re: [Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-04 Thread baldric
Thanks! I will still need to try this out, but the idea (in your first response) kind of feels more or less like what I knew I needed. I have so many questions now based on the responses so far - it feels like I'm just scratching the surface! Firstly, could you explain the differences between map,

Re: [Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-04 Thread Marko Rodriguez
Sure: m = [:]; g.v(162).in('R_PartOf').loop(1){m.put(it.object, it.loops); true}.cap.next().sort{a, b -> a.value <=> b.value}.keySet >> [] Marko. http://markorodriguez.com On Nov 4, 2011, at 12:17 PM, Peter Neubauer wrote: > Can you do it on one line? ;) > > Great stuff. > > Cheers, > > /p

Re: [Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-04 Thread Peter Neubauer
Can you do it on one line? ;) Great stuff. Cheers, /peter neubauer GTalk:      neubauer.peter Skype       peter.neubauer Phone       +46 704 106975 LinkedIn   http://www.linkedin.com/in/neubauer Twitter      http://twitter.com/peterneubauer http://www.neo4j.org              - NOSQL for the Ent

Re: [Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-04 Thread Marko Rodriguez
Hi, I would do it like this: m = [:] g.v(162).in('R_PartOf').loop(1){m.put(it.object, it.loops); true} >> -1 m.sort{a, b -> a.value <=> b.value}.keySet as List In short, fill up a Map (m) with key being the vertex and value being the number of "hops" (or times through the loop). Then sort the m

[Neo4j] Gremlin - how to flatten a tree, and sort

2011-11-04 Thread baldric
I'm very new to much of this, and have a particularly ingrained relational slant to my career, unfortunately. I'm in the process of doing a proof of concept for a product, using neo4j, and gremlin over REST (we're developing in c#) What I'm trying to do at the moment is load a graph (representing a