groupBy weird output behaviour

30 views
Skip to first unread message

jstorm

unread,
Nov 13, 2012, 11:51:27 PM11/13/12
to gremli...@googlegroups.com
I have a bunch of vertices, and I am simply grouping them by a key that is another vertex (orientDB is my datastore):
 
g.v('8:0').copySplit(_().out('follow').out('stream'), _().out('stream')).fairMerge().dedup().groupBy{it.out('object') ? it.out('object') : 'test'}{it.content}.cap
 
Note that not all "stream" vertices have another vertex connected to it via an "object" edge, but that is is fine, because they will just be grouped under the 'test' key.
 
However, I ended up with this as the output (in the gremlin console):
 
==>{[StartPipe, OutPipe(object)]=[Hi dudes check out this link! -sarah], [StartPipe, OutPipe(object)]=[awesome
 site], test=[Hi Jenny!, This is my second post!!, This is my first post!!], [StartPipe, OutPipe(object)]=[Hi
check out this link!]}
 
Why is [StartPipe, OutPipe(object)] being used as the key and not the vertex? Also, all the entries with [StartPipe, OutPipe(object)] with the key refer to the same vertex, so they should all be grouped together.
 
Any ideas appreciated :)
 
 
 

Stephen Mallette

unread,
Nov 14, 2012, 5:38:01 AM11/14/12
to gremli...@googlegroups.com
You need to next() the pipe:

gremlin> g = TinkerGraphFactory.createTinkerGraph()
==>tinkergraph[vertices:6 edges:6]
gremlin> g.v(1).out.out.groupBy{it.in.name}{1}.cap
==>{[StartPipe, InPipe, PropertyPipe(name)]=[1], [StartPipe, InPipe,
PropertyPipe(name)]=[1]}
gremlin> g.v(1).out.out.groupBy{it.in.name.next()}{1}.cap
==>{marko=[1], josh=[1]}

https://github.com/tinkerpop/gremlin/wiki/Troubleshooting
> --
>
>
Reply all
Reply to author
Forward
0 new messages