Sorry if something like this has been answered elsewhere (hard to know what to search on).
I have a pretty simple traversal (albeit with a slightly messy projection step) that looks something like this:
g.V(root).out().order().by(id).range(1000,2000).project("v","e").....) // project step omitted for brevity
As you can see, it uses range for returning paged results. However, on the first results page only, I need to return the total vertex count of the graph too. I've got this working using something like:
This works fine for my needs. I've been able to translate this to c#/gremlin.net and successfully run and parsed the results.
The problem is there a chunk of duplicated code in doing so, namely the order and projection step that I need on both versions of the query but in different places.
Given that I have the 'core' part of the traversal, effectively:
I only know how to implement it somelthing like:
.Order().By(__.Id()).Range<GVertex>(Scope.Global, low, high).Project<object>("projectedV", "projectedE")
I know I can create the .Order()....Project()... part as an anonymous traversal:
__.Order().By(__.Id()).Range<GVertex>(Scope.Global, low, high)
Question is, can I append this to the existing 'core' traversal as if I had added it using fluent syntax? I want to be able able to reduce my code to something (VERY ROUGHLY!) like:
Is this even possible?
I appreciate that some people will try to suggest an alternative solution to my paging solution, and while help is always appreciated, I would like to improve my understanding of gremlin.net by finding out if appending/merginf traversals is possible.