Hi Kelvin! I'm trying to solve a similar problem, and this thread was super helpful. Can you elaborate on your last message? I'm a bit new to Gremlin, and I'm trying to figure out how to turn something like `by(out('somelabel'))` into a key/value pair.
Personally, i'm trying to insert an edge count into the properties returned by `valueMap()`. (without editing the properties on that vertex in the underlying graph) I successfully ran a derivative of your comment above:
(this is with gremlin-python)
```
(
g
.V(node_id)
.union(
valueMap().by(unfold()),
constant({'special':1234})
)
.unfold()
.group()
.by(keys)
.by(values)
.next()
)
```
And that worked. I want to replace that `constant({'special':1234})` section with a key-value pair like `{'edge_count': __.bothE().count()}`, but I can't figure out how to get the gremlin syntax right. Any ideas?
Thanks!