jeudi 5 mars 2015

How to output append reason to similarities in Gremlin


Vote count:

0




I have the following simple Graph:


User -- Likes --> Item


I'm finding top 10 similar users to a user u using the following Gremlin code:



u.out('Likes').in('Likes').filter([u]).groupCount.cap.orderMap(T.decr)[0..10].map()


This outputs something like that:



==>{userid=1}
==>{userid=5}
==>{userid=10}
==>{userid=15}


I would like the output to be more informative and have additional information such as rank in the sorted map and items (itemid) shared with the original user, something like this:



==>{userid=1, rank=0, reason_items={1,2,3,5}}
==>{userid=5, rank=1, reason_items={1,2,10}}
==>{userid=10, rank=2, reason_items={1,2,4}}
==>{userid=15, rank=3, reason_items={1,2}}


An efficient gremlin-groovy code sample would be nice!


Thank you.



asked 3 mins ago







How to output append reason to similarities in Gremlin

Aucun commentaire:

Enregistrer un commentaire