We currently have nice ways to provide configurations to a TraversalSource
using variations of "with" like

withStrategies()
withSideEffects()

I think it would be equally nice to provide configurations to individual
steps. So, what would we use this for? Well, one thing I really dislike is
our use of by() for configuring parameters to steps like pageRank() and
peerPressure():

g.V().pageRank().by('rank')

That by('rank') sets the property name that will be used to store the
pagerank value on the vertex. Not only is that a little awkward, but it
also only allows for one configuration, so if we wanted to set some other
values on pageRank() we couldn't really do it (unless the argument happens
to match one of the other by() overloads - which is what are lucky about
doing now). If we had the with() modulator, then we could do:

g.V().pageRank().with(PageRankVertexProgram.PROPERTY,'rank')

Arguably longer, but with appropriate overloads and helpers that could be
instead:

g.V().pageRank().with(pageRankKey('rank'))

or something similar - certainly more descriptive than by('rank') which
really doesn't match our common uses of by() with other steps.

The with() modulator would also provide a fair amount of flexibility to any
provider looking for a first class way for users to send configurations on
steps that might yield control over conditions/logic in custom step
replacements.

Unless there objections in the next 72 hours (Sunday, May 20, 2018, 3:30pm)
to this direction, I'll get a JIRA ticket created and look to have this for
3.4.0.

Take care,

Stephen

Reply via email to