I thought about using with() for this in some way but figured by() was the
right direction. i like your idea, but with(String) won't take with(label)
or with(id) right? can we use by() again?  We already have by(T) as a
modulator:

g.V().
  valueMap().
    by(id).
    by(label).
    by(unfold())

Looks a little weird though...maybe?


On Wed, Oct 3, 2018 at 10:19 AM Daniel Kuppitz <m...@gremlin.guru> wrote:

> Good idea! Also, when I saw the subject of your email, I thought you were
> about to propose something like .with(label), .with(id) or .with(tokens) -
> I would like that too as valueMap is the only step that takes a boolean
> parameter that changes its behavior.
>
> Cheers,
> Daniel
>
>
> On Wed, Oct 3, 2018, 2:01 AM Stephen Mallette <spmalle...@gmail.com>
> wrote:
>
> > valueMap() is a really convenient step:
> >
> > gremlin> g.V().has('person','name','marko').valueMap()
> > ==>[name:[marko],age:[29]]
> >
> > or perhaps more preferably:
> >
> > gremlin> g.V().has('person','name','marko').valueMap('name','age')
> > ==>[name:[marko],age:[29]]
> >
> > but argh - multiproperties ruin everything. so then we're forced into
> > Gremlin acrobatics:
> >
> > gremlin> g.V().has('name','marko').
> > ......1>        valueMap('name','age').
> > ......2>        unfold().
> > ......3>        group().
> > ......4>          by(keys).
> > ......5>          by(select(values).unfold())
> > ==>[name:marko,age:29]
> >
> > or as I usually recommend, use project():
> >
> > gremlin>
> >
> >
> g.V().has('person','name','marko').project('name','age').by('name').by('age')
> > ==>[name:marko,age:29]
> >
> > which is fine, but you pretty much have to type a lot more especially if
> > there are a lot of properties to contend with. What if we were to
> modulate
> > valueMap() with by(Traversal) so that:
> >
> > g.V().has('person','name','marko').
> >   valueMap('name','age').
> >     by(unfold())
> >
> > and the by() are just applied round-robin on the keys? Thoughts?
> >
>

Reply via email to