Given a movie database, with a structure like
(actor:actor)-[:ACTS_FOR { min: x, percent: 0.y }]->(film:film)
so that the system knows how long each actor is physically present on the screen, and to what % of the movie duration that corresponds.
Each user can have preferences for some actors (ie: grade them from "bad" to "awesome" or whatnot). To each of this preference the system is associated to a modifier (say from -100 to +100).
How can I query the database to return the first ten movies, ranked by the value given by each preferred actor modifier multiplied by its presence in % on the movie? (Giving 0 to those movies that have no actor in the user preferences.)
Ex
(user)-[:VALUES { modifier: -20 }]->(actor1)
(user)-[:VALUES { modifier: +30 }]->(actor2)
(user)-[:VALUES { modifier: +70 }]->(actor3)
(actor1)-[:ACTS_FOR { percent: 0.2 }]->(film1)
(actor2)-[:ACTS_FOR { percent: 0.3 }]->(film1)
(actor1)-[:ACTS_FOR { percent: 0.5 }]->(film2)
(actor3)-[:ACTS_FOR { percent: 0.1 }]->(film2)
(actor2)-[:ACTS_FOR { percent: 0.4 }]->(film3)
film1 = -20 * 0.2 + 30 * 0.3 = 5
film2 = -20 * 0.5 + 70 * 0.1 = -3
film3 = 30 * 0.4 = 12
ranking:
- film3
- film1
- film2