Order group count result alphabetically

Hi! Given the following query and results in the enclosed image: how would I sort the labels alphabetically? Air routes dataset for illustration.
5 Replies
Shush
Shush•2y ago
have you tried order().by(label)?
Shush
Shush•2y ago
Stack Overflow
Alphanumeric sorting in Gremlin
I have a database and am trying to find a safe way to read this data into an XML file. Reading the verticies is not the problem. But with the edges the app runs since a while into a HeapSpace-Excep...
kelvinl2816
kelvinl2816•2y ago
If you want to sort after creating the group, you can do
order(local).by(keys)
order(local).by(keys)
gremlin> g.V().group().by(label).by(count())
==>[continent:7,country:237,version:1,airport:3502]
gremlin> g.V().group().by(label).by(count()).order(local).by(keys)
==>[airport:3502,continent:7,country:237,version:1]
gremlin> g.V().group().by(label).by(count())
==>[continent:7,country:237,version:1,airport:3502]
gremlin> g.V().group().by(label).by(count()).order(local).by(keys)
==>[airport:3502,continent:7,country:237,version:1]
Blonde Maybe
Blonde MaybeOP•2y ago
Thank you for the quick response! This worked excellently in G.V() and I now found the chapter in your book. 🙌 Do you happen to know how local or keys are utilised in Gremlin.Net? I cannot seem to find an Enum-type (like T.Label for local or keys).
kelvinl2816
kelvinl2816•2y ago
In general it's going to be Scope.local and Column.keys / Column.values the casing varies a little bit by client as the clients try to be somewhat idiomatic for any given language.
Want results from more Discord servers?
Add your server