Reputation: 12181
I would like to drop outgoing edges from vertex entity
if their inVertices are not contained in the list of donttouch
ones.
I have a traversal like that:
g.V(id).as("entity")
.V(id2).as("donttouch1")
.V(id3).as("donttouch2")
.outE("hasType").drop();
The above query has three issues:
entity
so the outE("hasType")
edges come out of entity
and not the last donttouch
. I think in TinkerPop 2 it was possible with back('x')
stepentity
back after drop()So I need something like that:
String[] donttouch= {"donttouch1","donttouch1"};
g.V(id).as("entity")
.V(id2).as("donttouch1")
.V(id3).as("donttouch2")
.back("entity").outE("hasType")
.where(not(inV().hasId(P.within(donttouch)))).drop().select("entity").next()
The list of donttouch
s might be long so I would prefer to put them all at once and not as a conjunction of neq
s
Thank you!
Upvotes: 1
Views: 610
Reputation: 10904
I assume the list of untouchable ids is already present in a list / set. In that case you can do:
g.withSideEffect("x", untouchableIds).
V(id).outE("hasType").not(inV().id().where(within("x"))).drop()
Upvotes: 2