Marko A. Rodriguez created TINKERPOP-1145:
---------------------------------------------
Summary: TraversalSource.script() as a general-solution to :>
Key: TINKERPOP-1145
URL: https://issues.apache.org/jira/browse/TINKERPOP-1145
Project: TinkerPop
Issue Type: Improvement
Components: process
Affects Versions: 3.1.0-incubating, 3.1.1-incubating
Reporter: Marko A. Rodriguez
In {{GraphComputer}}, if the traversal uses a lambda, the user has to use a
"remote connection" and submit their traversal as a script-engine {{String}}
via:
{code}
gremlin> :> g.V().group().by{it.name[0]}
{code}
For Gremlin Server, {{:>}} is currently the only way to submit traversals in
the Gremlin Console.
This is all bad. Why? Its Gremlin Console specific and we can solve it more
elegantly with the work in TINKERPOP-971 and TINKERPOP-575.
{code}
g = graph.traversal().withComputer()
g.V().group().by("name") // CURRENT AND GOOD
{code}
{code}
g = graph.traversal().withComputer()
g.script("g.V().group().by{it.name[0]}") // PROPOSED
{code}
{code}
g = graph.traversal().withServer('127.0.0.1:8080')
g.script("g.V().group().by{it.name[0]}") // PROPOSED
{code}
See {{TraversalScriptFunction}} for some pieces of the implementation.
We could then make {{:>}} simply be shorthand for {{g.script()}}. However,
outside the console, {{g.script()}} just works.
Next, we can assume {{gremlin-groovy}}, but we could also allow:
{code}
g =
graph.traversal().withServer('127.0.0.1:8080').withStrategies(ScriptEngineStrategy.for("gremlin-scala"))
g.script("g.V().group().by(??)") // PROPOSED
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)