How to model "votes" on a relationship?

In the case that someone can create a relationship between two nodes (example: "posts") to indicate they are similar , I want users to be able to vote on that similarity to indicate it is good or not (and keep track of if a user has voted to ensure each user votes once). Then on each node, be able to show similar posts and the # votes of how similar they are (maybe even sorting by them). I think the votes would be a simple property on the relationship if I didn't need to keep track of who voted

Here is where I started:

(a:Post)->[r:IS_SIMILAR_TO { suggestedBy: $userId } ]->(b:Post)

But with wanting to keep track of users who voted, I'm not sure if I need a separate node for the similarity suggestion? this seems messy

(a:Post)->[r:HAS_SUGGESTION]->(s:SimilarSuggestion)<-[r:HAS_SUGGESTION]<-(b:Post)
(u:User)->[r:VOTED_ON_SUGGESTION]->(s:SimilarSuggestion)

Would love to hear better ways of modeling this! Thank you!

One advantage of a suggestions node is that you could eventually "merge" many nodes that are similar

1 Like

nice! good point - thank you for the diagram too!

You can create your own and generate cypher: