Ferma icon indicating copy to clipboard operation
Ferma copied to clipboard

Sort/Order By?

Open matanshukry opened this issue 5 years ago • 2 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?

matanshukry avatar May 19 '19 13:05 matanshukry

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 avatar Jun 05 '19 13:06 killje

@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.

freemo avatar Mar 06 '20 20:03 freemo