Graph cafe-lightning

6,122 views

Published on

lightning talk at graph cafe London about date and time modelling in Neo4j

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
6,122
On SlideShare
0
From Embeds
0
Number of Embeds
4,675
Actions
Shares
0
Downloads
20
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • Its not all negative though... I believe delivery is the greatest potential weapon multichannel retailers have against the elephant in the room
    The reason Amazon is such a threat is that they have made consumers believe that there are only two reasons to buy online... range and price... conveniently they have a structural advantage in both these areas...
  • Increase order value
    Improve conversion
    Happier customers
  • Graph cafe-lightning

    1. 1. The problem with perspective is that it’s bidirectional http://xkcd.com/230/
    2. 2. representing dates/times (using neo4j 1.9.5)
    3. 3. representing dates/times root (0) :year_2014 :year_2013 :month_05 Month: 05 :day_24 Day: 24 Year: 2013 :day_25 :day_26 Day: 25 Year: 2014 :month_06 Day: 26 Month: 06 :happens Event 1 :happens Event 2 :happens :happens Event 3 :month_01 Month 01
    4. 4. find all events on a specific day START MATCH root=node(0) root-[:year_2013]-()-[:month_05]-()-[:day_24]-()-
 [:happens]-event RETURN event
    5. 5. representing dates/times root (0) :year_2014 :year_2013 :month_05 Month: 05 :day_24 Day: 24 Year: 2013 :day_25 :day_26 Day: 25 Year: 2014 :month_06 Day: 26 Month: 06 :happens Event 1 :happens Event 2 :happens :happens Event 3 :month_01 Month 01
    6. 6. find all events for a given range root (0) :year_2014 :year_2013 :month_05 Month: 05 :day_24 Day: 24 :happens Event 1 :next :happens Event 2 Year: 2013 :day_25 Day: 25 :day_26 :next :happens :month_06 Day: 26 Month: 06 :happens Event 3 Year: 2014 :month_01 Month 01
    7. 7. find all events for a given range START root=node(0) MATCH root-[:year_2013]-()-[:month_05]-()-[:day_24]-start,
 root-[:year_2013]-()-[:month_05]-()-[:day_26]-end,
 start-[:next*0..]-middle-[:next*0..]-end,
 middle-[:happens]-event
 RETURN event
    8. 8. find all events for a given range root (0) :year_2014 :year_2013 :month_05 Month: 05 :day_24 Day: 24 :happens Event 1 :next :happens Event 2 Year: 2013 :day_25 Day: 25 :day_26 :next :happens :month_06 Day: 26 Month: 06 :happens Event 3 Year: 2014 :month_01 Month 01
    9. 9. find all events for a given range root (0) :year_2014 :year_2013 :month_05 Month: 05 :day_24 Day: 24 :happens Event 1 :next :happens Event 2 Year: 2013 :day_25 Day: 25 :day_26 :next :happens :month_06 Day: 26 Month: 06 :happens Event 3 Year: 2014 :month_01 Month 01
    10. 10. find all events for a given range root (0) :year_2014 :year_2013 :month_05 Month: 05 :day_24 Day: 24 :happens Event 1 :next :happens Event 2 Year: 2013 :day_25 Day: 25 :day_26 :next :happens :month_06 Day: 26 Month: 06 :happens Event 3 Year: 2014 :month_01 Month 01
    11. 11. find all events for a given range root (0) :year_2014 :year_2013 :month_05 Month: 05 :day_24 Day: 24 :happens Event 1 :next :happens Event 2 Year: 2013 :day_25 Day: 25 :day_26 :next :happens :month_06 Day: 26 Month: 06 :happens Event 3 Year: 2014 :month_01 Month 01
    12. 12. find all events for a given range START root=node(0) MATCH root-[:year_2013]-()-[:month_05]-()-[:day_24]-start,
 root-[:year_2013]-()-[:month_05]-()-[:day_26]-end,
 start-[:next*0..]-middle-[:next*0..]-end,
 middle-[:happens]-event
 RETURN event
    13. 13. does an event happen on a certain date? START event=node(20) MATCH event-[:day_24]-()-[:month_05]-()-[:year_2013]-()
 RETURN event
    14. 14. does an event happen on a certain date? root (0) :year_2014 :year_2013 :month_05 Month: 05 :day_24 Day: 24 Year: 2013 :day_25 :day_26 Day: 25 Year: 2014 :month_06 Day: 26 Month: 06 :happens Event 1 (20) :happens Event 2 :happens :happens Event 3 :month_01 Month 01
    15. 15. property vs. relationship type constructing cypher queries execution plan cache vs. property load creating and deleting calendar graph
    16. 16. mixed property/relationship type START MATCH root=node(0) root-[:year_2013]-()-[:month_05]-()-[:day_24]-()-
 [:hour] - (hour_node) - [:happens]-event WHERE hour_node.hour = {hour} RETURN event
    17. 17. calendar creation START ref_node = node(0) CREATE UNIQUE ref_node - [:year_2013] -> [:month_11] -> [:day_27] -> [:hour] -> RETURN hour_node (year_node (month_node (day_node (hour_node {year: {month: {day: {hour: {year}}) {month}}) {day}}) {hour}}) - -
    18. 18. deleting calendar root (0) :year_2014 :year_2013 :month_05 Month: 05 :day_24 Day: 24 Year: 2013 :day_25 :day_26 Day: 25 Year: 2014 :month_06 Day: 26 Month: 06 :happens Event 1 :happens Event 2 :happens :happens Event 3 :month_01 Month 01
    19. 19. QUESTIONS? Volker Pacher ! volker@shutl.com www.shutl.com

    ×