I have some :book
s. Books are idenifyed by an ISBN
s and have :similar
relationships to related books. Here is my cypher query to get similar books to the provided list of ISBNs:
MATCH (b:Book)-[:SIMILAR]-(c:Book)
WHERE b.ISBN in $ISBNs
return b, c
However, I would like to limit the number of similar books per book to 5, without limiting the total books. In other words, I currently get 7 similar on one book, 6 on another, and 3 on one if I provide a certain list of ISBNs. I would like to limit that to 5 per book, so I get 5, 5, and 3. How can I do this?