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

opencypher org opencypher org opencypher googlegroups com
SMART_READER_LITE
LIVE PREVIEW

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 |


slide-1
SLIDE 1
  • pencypher.org
  • pencypher.org | opencypher@googlegroups.com
slide-2
SLIDE 2
slide-3
SLIDE 3
  • pencypher.org
  • pencypher.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

slide-4
SLIDE 4

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

slide-5
SLIDE 5
  • pencypher.org
  • pencypher.org | opencypher@googlegroups.com
slide-6
SLIDE 6
  • pencypher.org
  • pencypher.org | opencypher@googlegroups.com
slide-7
SLIDE 7
  • pencypher.org
  • pencypher.org | opencypher@googlegroups.com

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

slide-8
SLIDE 8
  • pencypher.org
  • pencypher.org | opencypher@googlegroups.com
slide-9
SLIDE 9
  • pencypher.org
  • pencypher.org | opencypher@googlegroups.com
slide-10
SLIDE 10
  • pencypher.org
  • pencypher.org | opencypher@googlegroups.com

MANDATORY MATCH <pattern>

  • <pattern>
  • didn't match (u:User {id: 'joe56'}
slide-11
SLIDE 11

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

slide-12
SLIDE 12

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

slide-13
SLIDE 13

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

slide-14
SLIDE 14
  • MANDATORY MATCH