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

ASF GitHub Bot commented on TINKERPOP3-1013:
--------------------------------------------

GitHub user okram opened a pull request:

    https://github.com/apache/incubator-tinkerpop/pull/165

    TINKERPOP3-1013: Traverser tags as a safer way of using path labels

    https://issues.apache.org/jira/browse/TINKERPOP3-1013
    
    We have had a hack in `MatchStep` this whole time where we use path labels 
to store branch history. This is not only semantically awkward (as labels are 
added that were not provided via `as()`), it also means we will not be able to 
do https://issues.apache.org/jira/browse/TINKERPOP3-736. Also, this will allow 
us to cleanly implement `IntersectStep` and `SymetricDifferenceStep` (down the 
road).
    
    The implementation is really simple. `Traverser.getTags()`. This method 
returns a mutable set and thus, we can remove, add, size, contains, etc. tags 
associated with a traverser.
    
    Ran `mvn clean install` and all is golden.
    
    VOTE +1.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/apache/incubator-tinkerpop TINKERPOP3-1013

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-tinkerpop/pull/165.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #165
    
----
commit e6a1141a0515f8adc7e51adb2a84495349b06c6a
Author: Marko A. Rodriguez <[email protected]>
Date:   2015-12-01T20:16:26Z

    Added Traverser.getTags(). This gives us more flexbility in how we handle 
branch-history. This improves MatchStep, future IntersectStep, future 
SymmetricDifferenceStep, and will allow us to do traversal rewriting in 
MatchStep (TINKERPOP3-736). No more awkward hack of 
traverser.path().extend(step.getId())... the stepID is NOT a path label, its a 
tag.

----


> Traverser tags as a safer way of using path labels
> --------------------------------------------------
>
>                 Key: TINKERPOP3-1013
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-1013
>             Project: TinkerPop 3
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.1.0-incubating
>            Reporter: Marko A. Rodriguez
>            Assignee: Marko A. Rodriguez
>             Fix For: 3.1.1-incubating
>
>
> We should add the following methods to {{Traverser}}.
> {code}
> void Traverser.addTag(final String tag)
> boolean Traverser.hasTag(final String tag)
> void Traverser.dropTag(final String tag)
> void Traverser.dropTags()
> {code}
> What is the point of a "tag" ? There are two use cases:
> 1. Currently {{MatchStep}} "tags" a traverser with 
> {{traverser.getPath().addLabel(step.getId())}}.  This means that the path 
> data of the traverser is used to store which branches of the {{match()}} the 
> traverser has already gone down. This is a hack as now the 
> {{travesrer.path()}} has a weird step ID label. Also, its inefficient as the 
> path needs to be searched for the respective "tag." A {{Set<String>}} is much 
> more efficient.
> 2. Intersect/symmetric difference will require some sort of "tagging" as 
> explained in Section 4 of http://arxiv.org/abs/1511.06278. We could, of 
> course, use the {{MatchStep}} way of doing things, but again, thats a hack.
> 3. When we support TINKERPOP3-736, using the "{{path()}}-hack" will not work 
> as two branches will have different stepIds but the same tag.
> In short, anytime we need to know if a particular branch of a traversal was 
> taken, {{Traverser.getTag()}} is our friend. 
> IMPORTANT: This will go into {{Traverser.Admin}} as no user should use these 
> tags. These are simply for internal markup of traverser.



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

Reply via email to