Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.1.0-incubating
-
None
Description
We should add the following methods to Traverser.
void Traverser.addTag(final String tag) boolean Traverser.hasTag(final String tag) void Traverser.dropTag(final String tag) void Traverser.dropTags()
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.