Sumit Chourasia
Sumit Chourasia

Reputation: 2434

Create Inner Gremlin query using edge information

I'm trying to create user Notification whenever any user comments on user's post.

i'm using following gremlin query -

g.v(512).outE('Notification').order{it.b.PostedDate <=> it.a.PostedDate}[0..3].transform{ [notificationInfo:it,postInfo:it.inV]}

and am getting following result -

enter image description here

Am getting NotificationInitiatedByVertexId value in edge. how can I use that vertex id (ie. NotificationInitiatedByVertexId: 1280) to get information about the vertex in the same query result.

Upvotes: 0

Views: 105

Answers (1)

Jason Plurad
Jason Plurad

Reputation: 6792

I would suggest trying to add it to the transform statement you already have:

g.v(512).outE('Notification').order{it.b.PostedDate <=> it.a.PostedDate}[0..3].transform{ [notificationInfo:it,postInfo:it.inV,notifiedV:g.v(it.NotificationInitiatedByVertexId)]}

Upvotes: 2

Related Questions