Hi,

Check out this test that Matt Frantz added today:

        g.V.as('a').out.as('a').out.as('a').select('a').by(unfold.name.fold)

Lets break this bad boy down:

gremlin> g.V().as('a').out().as('a').out().as('a').select('a')
==>[v[1], v[4], v[5]]
==>[v[1], v[4], v[3]]
gremlin> 
g.V().as('a').out().as('a').out().as('a').select('a').by(unfold().values('name').fold())
==>[marko, josh, ripple]
==>[marko, josh, lop]

You can say, "why use select()? -- use path()."

gremlin> g.V().as('a').out().as('a').out().as('a').path()
==>[v[1], v[4], v[5]]
==>[v[1], v[4], v[3]]
gremlin> g.V().as('a').out().as('a').out().as('a').path().by('name')
==>[marko, josh, ripple]
==>[marko, josh, lop]

True, but two things -- you don't always want the full path (select() is like 
"subpath") and second, you may have lists in your select() at other times (not 
just path elements, e.g. select(local)).

gremlin> 
g.V().as('a').out().as('a').out().as('a').path().by('name').next().getClass()
==>class org.apache.tinkerpop.gremlin.process.traversal.step.util.MutablePath
gremlin> 
g.V().as('a').out().as('a').out().as('a').select('a').by(unfold().values('name').fold()).next().getClass()
==>class java.util.ArrayList

So…. lets stick with thinking about select(). I don't like 
by(unfold.name.fold). That is brutal looking. How do we make it not so sucky?

        by(local,'name') ?

………local is starting to get deep (permeating numerous steps)…. outE(local) 
eek!…. Where are we going?

Thanks,
Marko.

http://markorodriguez.com

Reply via email to