I'm trying to apply the Element Existence recipe to insert only one edge that's considered "live" (not "expired"):
def to = __.V(member).hasLabel('Member')
gts.V(group).hasLabel('Group')
.coalesce(
__.outE('Includes').hasNot('ttl.end').where(__.inV().is(P.eq(to))),
__.addE('Includes').to(to).property('ttl.start', timestamp)
)
.next()
My expectation is that the coalesce will select an existing edge that has no ttl.end
property and is incident onto the same to
vertex, or else insert a new edge. However, a new edge is always inserted anyway. I interpret this as indicating that the first subtraversal isn't matching the existing live edge, but I'm not figuring out why. Does the predicate P.eq
work for a Traversal<?, Vertex>
argument? If not, what's the correct way to say "where the edge ends on vertex to
"?
Profile (I note the IsStep
has no traversers, which I interpret to mean it did not match):
Step Count Traversers Time (ms) % Dur
=============================================================================================================
TinkerGraphStep(vertex,[08f8c62d-5429-40e6-84b7... 1 1 0.135 10.93
CoalesceStep([[VertexStep(OUT,[Includes],edge),... 1 1 0.781 63.17
VertexStep(OUT,[Includes],edge) 2 2 0.025
NotStep([PropertiesStep([ttl.end],value), Pro... 1 1 0.127
PropertiesStep([ttl.end],value) 0.033
TraversalFilterStep([EdgeVertexStep(IN), Prof... 0.144
EdgeVertexStep(IN) 1 1 0.014
IsStep(eq([TinkerGraphStep(vertex,[d9b69296... 0.018
AddEdgeStep({ttl.start=[Thu Jan 28 21:27:52 C... 1 1 0.220
TinkerGraphStep(vertex,[d9b69296-333e-4e54-... 1 1 0.120
question from:
https://stackoverflow.com/questions/65948295/can-gremlin-p-eq-accept-a-vertex 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…