multiple roots for query

23 views
Skip to first unread message

Steven McCraw

unread,
Jul 11, 2013, 10:47:56 PM7/11/13
to pacer...@googlegroups.com
Hi All,

In gremlin, I can apply a route specification to a group of multiple roots like this:

g.v(1,2,3,4,5).out.out

Is there something similar in pacer?  I can do

G.vertex(52).out.out and start from vertex 52, but is there some way to apply the route to an array of vertices in the graph?  I have a query that I want to perform starting at several different vertices, and I want the results to be aggregated, and I can certainly do several separate queries and aggregate the results myself, but it seems like it would be more efficient to let the database do it.  I just don't know how to express such a thing in pacer, and after digging through the help and the source code for awhile, can't even begin to figure out how pacer works or where to start looking for such an answer.  Is this possible?  If so, what's the best way to discover the API for something like this?

Thanks!
Mark

Steven McCraw

unread,
Jul 11, 2013, 11:16:32 PM7/11/13
to pacer...@googlegroups.com
Just realized I could do something like this:  

G.v.filter{|v| [52,56,60].include?(v.element_id)}.out.out

Does that seem like a reasonable approach to the problem, or is there some better way?

Darrick Wiebe

unread,
Jul 14, 2013, 8:55:33 PM7/14/13
to pacer...@googlegroups.com
Hi Steve,

Sorry for the slow response, I was away for a long weekend!

The way you did it above would work but it's inefficient because it requires a full scan of the graph. The right way to start this route is like this:

[1,2,3].id_to_element_route based_on: g.v

Or for the full example:

[1,2,3].id_to_element_route(based_on: g.v).out.out

Cheers!
Darrick
Reply all
Reply to author
Forward
0 new messages