Re: [DISCUSS] Modulated valueMap()

2018-10-08 Thread Stephen Mallette
Created this for tracking and additional discussion:

https://issues.apache.org/jira/browse/TINKERPOP-2059

On Wed, Oct 3, 2018 at 1:19 PM Daniel Kuppitz  wrote:

> Yea, that's weird. My code was actually pseudo-code, I wasn't referring to
> T.id and T.label, we would have String some constants as we do for other
> with() modulations. Perhaps:
>
> valueMap().with(Tokens.all)
> valueMap().with(Tokens.label)
> valueMap().with(Tokens.id)
>
>
> Cheers,
> Daniel
>
> On Wed, Oct 3, 2018 at 10:14 AM Stephen Mallette 
> wrote:
>
> > 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  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 
> > > 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?
> > > >
> > >
> >
>


Re: [DISCUSS] Modulated valueMap()

2018-10-03 Thread Daniel Kuppitz
Yea, that's weird. My code was actually pseudo-code, I wasn't referring to
T.id and T.label, we would have String some constants as we do for other
with() modulations. Perhaps:

valueMap().with(Tokens.all)
valueMap().with(Tokens.label)
valueMap().with(Tokens.id)


Cheers,
Daniel

On Wed, Oct 3, 2018 at 10:14 AM Stephen Mallette 
wrote:

> 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  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 
> > 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?
> > >
> >
>


Re: [DISCUSS] Modulated valueMap()

2018-10-03 Thread Stephen Mallette
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  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 
> 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?
> >
>


Re: [DISCUSS] Modulated valueMap()

2018-10-03 Thread Daniel Kuppitz
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  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?
>


[DISCUSS] Modulated valueMap()

2018-10-03 Thread Stephen Mallette
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?