You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by Marko Rodriguez <ok...@gmail.com> on 2015/06/02 22:28:44 UTC
[TinkerPop3] New AddEdgeStep -- Scope.local and Scope.global Support.
Hello,
Matt Frantz had a good idea for AddEdgeStep -- support Scope.local and Scope.global.
* If the addE() is getting data from Scope.local, that means its coming from a select()/match()-projection.
- g.V.match('a',
as('a').out('created').as('b'),
as('a').out('knows').count().is(gt(0)),
as('b').has(lang,'java')).
select('a','b').addOutE('b','javaCreationBy','a')
* If the addE() is getting data from Scope.global, that means its coming from path/sideEffect data.
- g.V.as('a').out('created').in('created').where(neq('a')).addInE('collaborator','a')
Of course, the super cool ScopingStrategy is able to infer the scope given the context.
https://github.com/apache/incubator-tinkerpop/blob/master/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/ScopingStrategy.java
Note that Scope has this really neat method that is used extensively by AddEdgeStep, WhereStep, SelectStep, SelectOneStep, … (and CypherStep in neo4j-gremlin).
https://github.com/apache/incubator-tinkerpop/blob/master/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Scope.java#L38
Here are the updated docs:
http://tinkerpop.incubator.apache.org/docs/3.0.0-SNAPSHOT/#addedge-step
Enjoy,
Marko.
http://markorodriguez.com