I have a Neo4j database with n- users. Each user is connected to their respective gender node(M and F), Age group node , Ethnicity node etc. I want to find similarity between two users based on their Gender, Age, Ethnicity etc.
This cypher query is calculating based only one attribute Movie
MATCH (p1:Person)-[x:RATED]->(m:Movie)<-[y:RATED]-(p2:Person)
WITH SUM(x.rating * y.rating) AS xyDotProduct,
SQRT(REDUCE(xDot = 0.0, a IN COLLECT(x.rating) | xDot + a^2)) AS xLength,
SQRT(REDUCE(yDot = 0.0, b IN COLLECT(y.rating) | yDot + b^2)) AS yLength,
p1, p2
MERGE (p1)-[s:SIMILARITY]-(p2)
SET s.similarity = xyDotProduct / (xLength * yLength)
I want to calculate based on multiple attributes like Gender, AgeGroup, Ethnicity, etc