How do i add gremlin output as vertex property?

27 views
Skip to first unread message

Peter Wang

unread,
Nov 11, 2016, 2:36:43 AM11/11/16
to OrientDB
I am new to gremlin. Can anyone explain the way to add gremlin map to vertex property? i ran the example and tried to add m to g.v as property of it.

Thanks a lot

g = new OrientGraph('memory:test')

// calculate basic collaborative filtering for vertex 1
m = [:]
g.v(1).out('likes').in('likes').out('likes').groupCount(m)
m.sort{a,b -> a.value <=> b.value}

alessand...@gmail.com

unread,
Nov 11, 2016, 3:52:06 AM11/11/16
to OrientDB
Hi,

you could use 
g.V.map('id','age')

For more infomation you could see this link.

Best regards,
Alessandro

Peter Wang

unread,
Nov 11, 2016, 1:51:20 PM11/11/16
to OrientDB
Hi Alessandro,

thank you very much for the quick reply! it shows all existing properties. what i'm trying to do is to add a new property to all vertex? do you know a way to create new vertex property and assign value to it in gremlin?

i am sorry for the confusion.

best,
Peter

Peter Wang

unread,
Nov 11, 2016, 6:42:27 PM11/11/16
to OrientDB
it's resolved. i used sideEffect step:
g.V.sideEffect{it.pr=m[it]} 
Reply all
Reply to author
Forward
0 new messages