Gremlin query to order vertices with some locked to specific positions
I'm working with a product catalog in a graph database using Gremlin.
The graph structure includes:
Can anyone suggest a Gremlin query to achieve this?
Also, maybe my data model is wrong for this use case, so I am also keen to accept other suggestions to represent this use case.
Thank you!
The graph structure includes:
ProductverticesCategoryverticesbelongsToedges connecting products to categories. The edge can have an optionallockedPositionproperty as integer.
- Some products are "locked" to specific positions (stored as a
lockedPositionproperty on thebelongsToedge) - Other "unlocked" products should fill in around these fixed positions
Can anyone suggest a Gremlin query to achieve this?
Also, maybe my data model is wrong for this use case, so I am also keen to accept other suggestions to represent this use case.
Thank you!
Solution
you can play tricks like this to move the 0 index to last place, but that still leaves the 7 one row off