The more I learn Gremlin, the more I see how cool it is.
Sorting query results is import for stuff like paging. In my quest to learn Gremlin, Stephen, Marko and Pierre helped me figure out this sort thing (
https://github.com/tinkerpop/rexster/issues/110), which will allow you do stuff like sort blog entries by published date.
g.v(1).out.sort{it.lang}.reverse().toList()
If you run this on the default TinkerGraph data set, it will sort vertex 1's outgoing vertices by language, reverse the results, and return the results as a list. The toList() is important because as Marko said, the Gremlin "pipeline is an iterator and thus, must be iterated" so the toList() converts the iterator to a list.
Thanks guys for your help!
- James