[ 
https://issues.apache.org/jira/browse/TINKERPOP-2502?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17269658#comment-17269658
 ] 

Stephen Mallette commented on TINKERPOP-2502:
---------------------------------------------

thanks for the additional explanation. i dont think your suggestion to add 
{{GraphTraversalSource.start()}} will work because a blank traversal won't be 
rigged up properly to start. Note that there is a difference between 
{{GraphTraversal.addV()}} sorts of steps and {{GraphTraversalSource.addV()}} 
sorts of steps. Spawn steps in {{GraphTraversalSource}} will add a different 
sort of {{addV()}}-step that is designed to trigger the start of the traversal. 
Without that trigger nothing happens. your suggested 
{{GraphTraversalSource.start()}} would basically just be this:

{code}
return new DefaultGraphTraversal(this.clone());
{code}

so rigged up in the console:

{code}
gremlin> g = TinkerGraph.open().traversal()
==>graphtraversalsource[tinkergraph[vertices:0 edges:0], standard]
gremlin> new DefaultGraphTraversal(g.clone()).addV('person').iterate()
gremlin> g
==>graphtraversalsource[tinkergraph[vertices:0 edges:0], standard]
{code}

I don't think a common interface helps you so well either as {{__}} are static. 
I could still be misunderstanding something though....


> Consistent start API for anonymous and regular traversals
> ---------------------------------------------------------
>
>                 Key: TINKERPOP-2502
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2502
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.4.9
>            Reporter: Christopher Smith
>            Priority: Minor
>
> I am writing a graph-based application and am taking advantage of the 
> method-based nature of Gremlin to librarify some of my common usage patterns. 
> However, I'm encountering a frustrating problem where I frequently need to be 
> able to attach the same traversal steps to either a real 
> {{GraphTraversalSource}} or an anonymous traversal (usually for some nested 
> reason like a coalesced conditional insert).
> The methods on {{__}} are mostly static, but I can call {{__.start()}} to 
> obtain a live {{GraphTraversal}} object and then proceed from there (invoking 
> {{GraphTraversal#addV}}, for example). {{GraphTraversalSource}}, however, 
> requires me to invoke the method {{GraphTraversalSource#addV}} to get 
> started, and there's no common base type. I think I could theoretically use 
> something like {{inject()}}, but that seems particularly odd.
> It would be helpful to either have both {{GraphTraversal}} and 
> {{GraphTraversalSource}} implement a common interface holding the "start 
> opcodes" or to have a {{GraphTraversalSource#start()}} method that could be 
> used to obtain a "blank" traversal.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to