Syncleus / Ferma

An ORM / OGM for the TinkerPop graph stack.

Home Page:http://syncleus.com/Ferma

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sort/Order By?

matanshukry opened this issue · comments

I'm just trying to use Ferma now (together with OrientDB), and I'm trying to find a way to sort through a result. I think there's a way using the .traverse() method, but the documentation doesn't seem to have almost any examples or information for such a thing.

How can I do that?

Yes you would use .traverse() as follows

framedGraph.traverse(
    (GraphTraversalSource g) -> g.V().order().by("name")
).toList(YourVertex.class);

Note that you do not have to add GraphTraversalSource in a lambda expression, but I added this for clarity. This is a Tinkerpop class and to see the abilities like sorting you should check out the the Tinkerpop documentation: http://tinkerpop.apache.org/docs/3.3.2/reference/

The traverse function is a way to access the graph traversal build in, into Tinkerpop and gives the ability to frame the vertexes and edges to your own classes

@killje Thanks for your help on this. Reach out to me anytime if you'd like to get more involved into the project. Either way, appreciate you responding on this one.