stefan plantikow neo4j
play

Stefan Plantikow, Neo4j 2017 Stefan Plantikow, Neo4j 2 2017 - PowerPoint PPT Presentation

Stefan Plantikow, Neo4j 2017 Stefan Plantikow, Neo4j 2 2017 Stefan Plantikow, Neo4j 2017 Stefan Plantikow, Neo4j 4 2017 Stefan Plantikow, Neo4j 5


  1. Stefan Plantikow, Neo4j 2017 Stefan Plantikow, Neo4j

  2. • • 2 2017 Stefan Plantikow, Neo4j

  3. 2017 Stefan Plantikow, Neo4j

  4. • • • • • • • • • 4 2017 Stefan Plantikow, Neo4j

  5. • • → • • • • • 5 2017 Stefan Plantikow, Neo4j

  6. • • • • • • • • 6 2017 Stefan Plantikow, Neo4j

  7. 2017 Stefan Plantikow, Neo4j

  8. 8 2017 Stefan Plantikow, Neo4j

  9. ● ● ● ● ○ ○ ● 2017 Stefan Plantikow, Neo4j

  10. 2017 Stefan Plantikow, Neo4j

  11. 11 2017 Stefan Plantikow, Neo4j

  12. 12 2017 Stefan Plantikow, Neo4j

  13. 13 2017 Stefan Plantikow, Neo4j

  14. 2017 Stefan Plantikow, Neo4j

  15. • • • • • 15 2017 Stefan Plantikow, Neo4j

  16. ≠ 16 2017 Stefan Plantikow, Neo4j

  17. 2017 Stefan Plantikow, Neo4j

  18. CYPHER 2017 2017 Stefan Plantikow, Neo4j

  19. CYPHER 2018 2017 Stefan Plantikow, Neo4j

  20. ● ● ● 2017 Stefan Plantikow, Neo4j

  21. MATCH FROM GRAPH cities MATCH (city:City)-[:IN]->(:Country {name: "Germany"}) FROM GRAPH people MATCH (person)-[:LIVES_IN]->(city) RETURN person ORDER BY person.age LIMIT 1 2017 Stefan Plantikow, Neo4j

  22. ● GRAPH foo ● NEW GRAPH bar ● COPY GRAPH foo TO baz ● GRAPH foo AT "url" ● NEW GRAPH foo AT "url" 2017 Stefan Plantikow, Neo4j

  23. CREATE , MERGE , DELETE FROM GRAPH people MATCH (alice)-[:KNOWS]->(bob)-[:KNOWS]->(charlie) WHERE (bob)-[:LOVES]->(alice)<-[:LOVES]-(charlie) AND (bob)<-[:LOVES]-(alice)-[:LOVES]->(charlie) INTO GRAPH drama CREATE (t:LoveTriangle)<-[:IN]-(alice), (t)<-[:IN]-(bob), (t)<-[:IN]-(charlie) RETURN DISTINCT alice.name 2017 Stefan Plantikow, Neo4j

  24. ● [ OPTIONAL ] MATCH ● ● CREATE ○ ○ ● MERGE ● SET / REMOVE ● DELETE 2017 Stefan Plantikow, Neo4j

  25. 2017 Stefan Plantikow, Neo4j

  26. MATCH (a)-->(b) WITH a, b ... 2017 Stefan Plantikow, Neo4j

  27. WITH a, r, b RETURN GRAPH (a)-[r]->(b) AS foo 2017 Stefan Plantikow, Neo4j

  28. MATCH (a:Person)-[:FRIEND*2]->(b:Person) RETURN GRAPH (a)-[:FOAF]->(b) AS foo MATCH (a:Person)-[:FRIEND*2]->(b:Person) WITH GRAPH (a)-[:FOAF]->(b) // Similar to (c)-[:FRIEND*4]->(d) MATCH (c)-[:FOAF]->(d) RETURN * 2017 Stefan Plantikow, Neo4j

  29. 2017 Stefan Plantikow, Neo4j

  30. WITH/RETURN RETURN GRAPH foo RETURN name, age, GRAPHS foo, bar, baz WITH GRAPHS * WITH GRAPHS *, NEW GRAPH myNewGraph AT "url" WITH GRAPHS foo, bar, COPY GRAPH foo TO baz 2017 Stefan Plantikow, Neo4j

  31. RETURN a, b, c, GRAPHS foo, bar RETURN a, b, c WITH a, b, c, GRAPHS foo, bar WITH a, b, c WITH GRAPHS ... 2017 Stefan Plantikow, Neo4j

  32. ● WITH ... GRAPH foo ● WITH ... GRAPHS foo, bar, baz ● 2017 Stefan Plantikow, Neo4j

  33. WITH GRAPHS FROM / INTO WITH GRAPHS foo, bar >> WITH GRAPHS foo, >> baz WITH GRAPHS foo >> bar 2017 Stefan Plantikow, Neo4j

  34. ● COPY GRAPH foo TO "new-url" ● MOVE GRAPH foo TO "new-url" ● DELETE GRAPH foo 2017 Stefan Plantikow, Neo4j

  35. ● ● ● ● ● 2017 Stefan Plantikow, Neo4j

  36. 2017 Stefan Plantikow, Neo4j

  37. 2017 Stefan Plantikow, Neo4j

  38. FROM GRAPH ActorsFilmsCities AT 'graph://actors_films_cities...' MATCH (p:Person)-[:BORN_IN]->(c:City) INTO NEW GRAPH PersonCityEvents MERGE (p:Person {name: p.name, YOB: p.YOB}) MERGE (c:City {name: c.name}) MERGE (p)-[:BORN_IN]->(c) RETURN GRAPH PersonCityEvents 2017 Stefan Plantikow, Neo4j

  39. WITH GRAPH PersonCityEvents FROM GRAPH Events AT 'graph://events...' MATCH (c)<-[:IN_CITY]-(e)-[:IN_YEAR]->(y), (e)-[:IS_A]->(et {value: 'Criminal Event'}) // Do matches for all other event types: // Public Event, War Event.... ... INTO GRAPH PersonCityEvents MERGE (c:City {name: c.value}) MERGE (e {title: e.value, year: y.value}) MERGE (e)-[:HAPPENED_IN]->(c) SET e:WarEvent // Do for all remaining event types ... RETURN count(*) AS matches 2017 Stefan Plantikow, Neo4j

  40. WITH GRAPH PersonCityEvents MATCH (ce:CriminalEvent)-[:HAPPENED_IN]->(c:City)<-[:BORN_IN]-(p:Person) INTO NEW GRAPH Temp-PersonCityCrimes MERGE (p:Person {name: p.name, YOB: p.YOB}) MERGE (c:City {name: c.name}) MERGE (ce:CriminalEvent {title: ce.title, year: ce.year}) MERGE (p)-[:BORN_IN]->(c) MERGE (ce)-[:HAPPENED_IN]->(c) RETURN GRAPH Temp-PersonCityCrimes 2017 Stefan Plantikow, Neo4j

  41. 2017 Stefan Plantikow, Neo4j

  42. FROM GRAPH SalesDetail AT ‘graph://...’ MATCH (p:Product)-[rel:IN]->(:Order)<-[HAS]-(s:Store)-[:IN]->(r:Region) regionName storeCode productCode storeProduct- WITH reg.name AS regionName, Total s.code AS storeCode, p.code AS productCode, APAC AC-888 PEN-1 20.00 sum(rel.soldPrice * rel.numItemsSold) APAC AC-888 TOY-1 45.00 AS storeProductTotal EMEA LK-709 BOOK-2 10.00 EMEA LK-709 TOY-1 40.00 EMEA LK-709 BOOK-5 15.00 EMEA WW-531 BOOK-5 18.00 EMEA WW-531 BULB-2 190.00 EMEA WW-531 PC-1 440.00 2017 Stefan Plantikow, Neo4j

  43. RETURN regionName, storeCode, sum(storeProductTotal) AS totalStoreSales GRAPH SalesSummary // not shown regionName storeCode totalStoreSales APAC AC-888 65.00 EMEA LK-709 65.00 EMEA WW-531 648.00 2017 Stefan Plantikow, Neo4j

  44. 2017 Stefan Plantikow, Neo4j

  45. USE FROM INTO 2017 Stefan Plantikow, Neo4j

  46. COPY GRAPH foo AS SNAPSHOT bar CREATE (=p) 2017 Stefan Plantikow, Neo4j

  47. SET GRAPH foo.prop = 42 REMOVE GRAPH foo.prop SET GRAPH foo:SocialNetwork REMOVE GRAPH foo:SocialNetwork 2017 Stefan Plantikow, Neo4j

  48. ● ● ● ● MATCH (a:Person), <g1 (a)-[:KNOWS]->(...)>, <g2 (a)-[:LIVES_IN]->(...)> RETURN GRAPH g1-g2 AS g 2017 Stefan Plantikow, Neo4j

  49. 2017 Stefan Plantikow, Neo4j

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend