Max
Explore posts from serversATApache TinkerPop
•Created by Max on 9/3/2024 in #questions
Gremlin query to order vertices with some locked to specific positions
Thank you! It was useful, I didn't know you could use
by
modulator for order
like this.17 replies
ATApache TinkerPop
•Created by Max on 9/3/2024 in #questions
Gremlin query to order vertices with some locked to specific positions
Here is the sample graph:
Note, the edge
Product9 -belongsTo-> shoes
has property lockedPosition: 7
.
The edge Product10 -belongsTo-> shoes
has property lockedPosition: 3
.
A traversal like g.V().hasLabel("Category").in("belongsTo").values("name")
returns products with no specific order.
My goal is to create a traversal such that getting products in shoes
category would always result in a list, where 3rd and 7th positions would be always occupied by Product10
and Product9
respectively.
Alternatively, I am okay with accommodating a different data model for this use case, if it makes for simpler or more efficient traversals.17 replies