I have a graph like this.
User - FOLLOW -> Tag <- HAS - Content
User can follow tags and content will have tags.
HAS connection will have some kind of score.
I would like to get all tags followed by a user and 5 contents belong to individual tag sorted by score. (for every tag, sort contents by score present on HAS connection)
Example :
User is following tag1, tag2, tag3.
content1 has tag1, tag2
content2 has tag2,tag3
content3 has tag1
content4 has tag1
content5 has tag2
content6 has tag1
Result :
map of tags :
tag1 -> list of sorted contents limit to 5,
tag2 -> list of sorted contents limit to 5,
tag3 -> list of sorted contents limit to 5
This is only 2 level queries, I also have some other complicated queries. I would always like to return a few attributes present on tags and contents.