简体   繁体   中英

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 -

在此处输入图片说明

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.

我建议尝试将其添加到您已经拥有的transform语句中:

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)]}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM