Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
3.4.5
-
None
-
None
-
TinkerPop 3.4.5
Description
Using Tinkerpop Modern graph, find all pairs of people who worked on software with the same name, filtering out pairs that would bind X and Y to the same person, using MATCH traversal:
g.V().match( __.as("X").out("created").as("Z"), __.as("X").V().as("Y").out("created").as("V"), __.as("Z").values("name").as("SOFTWARE"), __.as("V").values("name").as("SOFTWARE"), __.as("X").values("name").as("DEV_X"), __.as("Y").values("name").as("DEV_Y") ).where("X", P.neq("Y")) .select("DEV_X", "DEV_Y", "SOFTWARE")
The above fails with:
java.lang.IllegalArgumentException: Neither the sideEffects, map, nor path has a Y-key: WherePredicateStep(neq(Y)) at org.apache.tinkerpop.gremlin.process.traversal.step.Scoping.getScopeValue(Scoping.java:124) at org.apache.tinkerpop.gremlin.process.traversal.step.filter.WherePredicateStep.setPredicateValues(WherePredicateStep.java:82) at org.apache.tinkerpop.gremlin.process.traversal.step.filter.WherePredicateStep.filter(WherePredicateStep.java:103) at org.apache.tinkerpop.gremlin.process.traversal.step.filter.FilterStep.processNextStart(FilterStep.java:38) at org.apache.tinkerpop.gremlin.process.traversal.step.filter.WherePredicateStep.processNextStart(WherePredicateStep.java:150) at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:143) at org.apache.tinkerpop.gremlin.process.traversal.step.util.ExpandableStepIterator.next(ExpandableStepIterator.java:50) at org.apache.tinkerpop.gremlin.process.traversal.step.map.MatchStep$MatchEndStep.processNextStart(MatchStep.java:569) at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:143) at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.hasNext(DefaultTraversal.java:197) at org.apache.tinkerpop.gremlin.process.traversal.step.map.MatchStep.standardAlgorithm(MatchStep.java:371) at org.apache.tinkerpop.gremlin.process.traversal.step.util.ComputerAwareStep.processNextStart(ComputerAwareStep.java:46) at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:143) at org.apache.tinkerpop.gremlin.process.traversal.step.util.ExpandableStepIterator.next(ExpandableStepIterator.java:50) at org.apache.tinkerpop.gremlin.process.traversal.step.map.MapStep.processNextStart(MapStep.java:36) at org.apache.tinkerpop.gremlin.process.traversal.step.map.SelectStep.processNextStart(SelectStep.java:156) at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:128) at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:38) at org.apache.tinkerpop.gremlin.process.traversal.Traversal.fill(Traversal.java:181) at org.apache.tinkerpop.gremlin.process.traversal.Traversal.toList(Traversal.java:119)
Adding an extra dedup() step makes it work:
g.V().match( __.as("X").out("created").as("Z"), __.as("X").V().as("Y").out("created").as("V"), __.as("Z").values("name").as("SOFTWARE"), __.as("V").values("name").as("SOFTWARE"), __.as("X").values("name").as("DEV_X"), __.as("Y").values("name").as("DEV_Y") ).dedup().where("X", P.neq("Y")) .select("DEV_X", "DEV_Y", "SOFTWARE")
returns:
{DEV_X=marko, DEV_Y=josh, SOFTWARE=lop} {DEV_X=marko, DEV_Y=peter, SOFTWARE=lop} {DEV_X=josh, DEV_Y=marko, SOFTWARE=lop} {DEV_X=josh, DEV_Y=peter, SOFTWARE=lop} {DEV_X=peter, DEV_Y=marko, SOFTWARE=lop} {DEV_X=peter, DEV_Y=josh, SOFTWARE=lop}
This seems to be related to TINKERPOP-1762.