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

Marko A. Rodriguez commented on TINKERPOP3-882:
-----------------------------------------------

Yes. We could build a TinkerGraph of a Traversal and analyze it using Gremlin. 
The problem. Is this expensive relative to the methods we have now. Given that 
many TraversalStrategies execute for each traversal, this means:

* Walk the traversal tree and generate a tree graph in TinkerGraph.
* For each strategy walk the tree graph and do various addE, drop, etc. 
operations.
* Walk the tree graph and reconstruct the traversal steps.

It would be cool to at least see a theoretical proposal of a traversal that 
rewrites a traversal -- for instance, {{PartitionStrategy}}. If someone wants 
to do that for homework that would be neat. Next would be -- how fast is it. If 
its fast and the traversal that analyzes the traversal is "sexy" (compact, 
readable, maintainable), then we could definitely go this route.

Finally, if that algorithm existed that mapped traversal->graph and 
graph->traversal, then we can get into an area I want to start to study where 
the walk of one Gremlin is the algorithmic description of the walk of another 
Gremlin. Sort of like entanglement but the two Gremlins are at different 
"scales."

> Develop a less error prone way for rewriting stratgies
> ------------------------------------------------------
>
>                 Key: TINKERPOP3-882
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-882
>             Project: TinkerPop 3
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.0.1-incubating
>            Reporter: Marko A. Rodriguez
>            Assignee: Marko A. Rodriguez
>
> When someone writes a {{TraversalStrategy}} it is of the nature:
> {code}
> if(step instanceof SelectStep && ((SelectStep)step).getLocalChildren().size() 
> > 1) {
>   TraversalHelper.insertStep(new IdentityStep(), step, traversal);
> }
> {code}
> It can start to get hairy looking fast. It would be great if we could study 
> the strategies we have thus far and see if there are patterns we can extract 
> encapsulate such behaviors in new methods in {{TraversalHelper}}. I don't 
> have any good ideas on how to do this, but I think we need it. My only 
> thought was a "regular expression" language for our traversals so we can 
> pattern match ON the traversal. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to