I wanna test simple graph analysis performance among GraphDBes using cypher.
I referred this site and reproduce the example in Neo4j, Agensgraph, SAP HANA, and Redis.
but the cypher query(see below) is not operate in Agensgraph, and SAP HANA.
MATCH (p1:Person {name:'Michael Sherman'})-[r1:RATED]->(m:Movie)<-[r2:RATED]-(p2:Person {name:'Michael Hunger'}) RETURN m.name AS Movie, r1.rating AS `M. Sherman's Rating`, r2.rating AS `M. Hunger's Rating`
I think the second arrow pattern doesn't works in Agensgraph, and SAP HANA.
How can I edit this query to operate in Agensgraph, and SAP HANA?
I already take similar problem that caused by difference of query language grammar.
Here is my query to figure out similarity in AgesnGraph. You'll be able to compute cosine similarity with few modification.
MATCH (u1:users {userid:'Toby'})-[r1:hasrated]->(m:movies)<-[r2:hasrated]-(u2:users)
WITH distinct u1.userid as u1name, u2.userid as u2name,
SUM(r1.rating::float*r2.rating::float) as xyDotProduct,
SQRT(SUM(r1.rating::float^2)) as xLength,
SQRT(SUM(r2.rating::float^2)) as yLength
RETURN u1name, u2name, xyDotProduct::float/(xLength::float*yLength::float) as similarity;