How to perform pagination in Gremlin

From a functional perspective, a nice looking bit of Gremlin for paging would be: gremlin> g.V().hasLabel(‘person’).fold().as(‘persons’,’count’). select(‘persons’,’count’). by(range(local, 0, 2)). by(count(local)) ==>[persons:[v[1],v[2]],count:4] gremlin> g.V().hasLabel(‘person’).fold().as(‘persons’,’count’). select(‘persons’,’count’). by(range(local, 2, 4)). by(count(local)) ==>[persons:[v[4],v[6]],count:4] In this way you get the total count of vertices with the result. Unfortunately, the fold() forces you to count all the vertices which will … Read more