opencypher org opencypher org opencypher googlegroups com
play

opencypher.org opencypher.org | opencypher@googlegroups.com val - PowerPoint PPT Presentation

opencypher.org opencypher.org | opencypher@googlegroups.com val user=... val product=... val city=.... Stores from city that offer products from the same brand and category as product that are on stock opencypher.org opencypher.org |


  1. opencypher.org opencypher.org | opencypher@googlegroups.com

  2. val user=... val product=... val city=.... Stores from city that offer products from the same brand and category as product that are on stock opencypher.org opencypher.org | opencypher@googlegroups.com

  3. MATCH (u:User {id: $user}) MATCH (old:Product {id: $product})-[:BOUGHT]->(u) MATCH (store)-[:IN]->(c:City {name: $city}), (store)-[:SELLS]->(new:Product), (new)-[:MADE_BY]->(brand)<-[:MADE_BY]-(old) WHERE new.avail > 0 AND new.category = old.category RETURN store, count(distinct new) as offers ORDER BY offers

  4. • • • opencypher.org opencypher.org | opencypher@googlegroups.com

  5. • • • • • opencypher.org opencypher.org | opencypher@googlegroups.com

  6. val user=... session.run( " MATCH (u:User {id: $user} RETURN u", Map("user" -> user) ).single() // <- This fails if no user is found ... opencypher.org opencypher.org | opencypher@googlegroups.com

  7. ● ● ● ● ● opencypher.org opencypher.org | opencypher@googlegroups.com

  8. ● ● ● ● ● opencypher.org opencypher.org | opencypher@googlegroups.com

  9. MANDATORY MATCH <pattern> ● <pattern> ● didn't match (u:User {id: 'joe56'} ● opencypher.org opencypher.org | opencypher@googlegroups.com

  10. MANDATORY MATCH (u:User {id: $user}) MANDATORY MATCH (c:City {name: $city}) MANDATORY MATCH (old:Product {id: $product})-[:BOUGHT]->(u) MATCH (store)-[:IN]->(c)-[:SELLS]->(new:Product), (new)-[:MADE_BY]->(brand)<-[:MADE_BY]-(old) WHERE new.avail > 0 AND new.category = old.category RETURN store, count(distinct new) as offers ORDER BY offers

  11. MANDATORY { MATCH (u:User {id: $user}) MATCH (c:City {name: $city}) MATCH (old:Product {id: $product})-[:BOUGHT]->(u) RETURN * } ...

  12. MANDATORY { MATCH ... RETURN ... UNION MATCH ... RETURN ... } RETURN ...

  13. ● MANDATORY MATCH ● ● ● ●

Recommend


More recommend