SlideShare a Scribd company logo
1 of 63
Download to read offline
Data modeling
                             . . . with graphs

                                         @PeterBell
Wednesday, November 28, 12
-   Terminology
                             -   Examples
                             -   Patterns
                             -   Key takeaways



Agenda
Wednesday, November 28, 12
Terminology




Wednesday, November 28, 12
relational database

                                    tables
                                   columns
                                   records
                                 foreign keys



Wednesday, November 28, 12
Wednesday, November 28, 12
neo4j

                                 nodes
                             relationships
                              properties



Wednesday, November 28, 12
Wednesday, November 28, 12
Wednesday, November 28, 12
indexes




Wednesday, November 28, 12
Wednesday, November 28, 12
indexes




Wednesday, November 28, 12
traversals




Wednesday, November 28, 12
Wednesday, November 28, 12
Wednesday, November 28, 12
Wednesday, November 28, 12
Cypher




Wednesday, November 28, 12
OO language - domain objects
                             Object (graph|relational) mapping

           Java domain objects                    Java domain objects
                 Hibernate                         Spring Data Neo4j
                   SQL                                   Cypher
         Tables/rows/columns/FKs              Nodes/relationships/properties

Wednesday, November 28, 12
Examples




Wednesday, November 28, 12
Wednesday, November 28, 12
Wednesday, November 28, 12
Article
    CATEGORIZED_UNDER                          WRITTEN_BY

                               ADDED_TO
                Category                            Author
                                   Comment
                             WRITTEN_BY
                                                 FOLLOWS
                                   Commenter


Wednesday, November 28, 12
Geographic




Wednesday, November 28, 12
Bioinformatic




Wednesday, November 28, 12
Patterns




Wednesday, November 28, 12
start with a whiteboard




Wednesday, November 28, 12
Wednesday, November 28, 12
Handling entities




Wednesday, November 28, 12
...provide a familiar and consistent Spring
                             based programming model while retaining
                                store specific features and capabilities
Wednesday, November 28, 12
Wednesday, November 28, 12
Restaurant
                                         - name
                                         - address
                                         - cuisine



                                              - comment
                             RECOMMENDS_THE
                                              - rating


                                          User
                                        - first_name
                                        - last_name

Wednesday, November 28, 12
Wednesday, November 28, 12
Wednesday, November 28, 12
Restaurant
                                        - name
                                        - address
                                        - cuisine



                             RECOMMENDS_A - comment
                                             - rating


                                         User
                                       - first_name
                                       - last_name

Wednesday, November 28, 12
Restaurant         SERVES
                                  - name                    Cuisine
                                  - address



                                       - comment
                      RECOMMENDS_THE
                                       - rating


                                   User
                                 - first_name
                                 - last_name

Wednesday, November 28, 12
SERVES
                                    Taj Mahal                      Indian cuisine



                                          - “Great garlic nan and tandoori”
                             RECOMMENDS
                                          - 4/5




                                    Fred Jones

Wednesday, November 28, 12
read sentences from graph




Wednesday, November 28, 12
Wednesday, November 28, 12
Indexes for starting points




Wednesday, November 28, 12
User
                             - email_address
                             - first_name
                             - last_name




Wednesday, November 28, 12
Relationships for querying




Wednesday, November 28, 12
User
                                        - email_address
                                        - first_name
                                        - last_name
                                        - shipping_state



                             Select * where shipping_state = ‘Ca’?

Wednesday, November 28, 12
User                   State
                       - email_address   LIVES_IN   - name
                       - first_name
                                                    - code
                       - last_name




Wednesday, November 28, 12
Jess
                                      LIVES_IN


                                               California
                                                            LIVES_IN

                                    LIVES_IN
                                                                  Andreas

                                      Andrew


Wednesday, November 28, 12
Use meaningful names




Wednesday, November 28, 12
Language         Country
                             - language_id
                                             - country_id
                             - name
                                             - name
                             - word count
                                             - flag url
                             - country_id




Wednesday, November 28, 12
Language     LanguageCountry     Country
                  - language_id   - language_id     - country_id
                  - name          - country_id      - name
                  - word count    - spoken_since    - flag url




Wednesday, November 28, 12
Language     LanguageCountry     Country
                  - language_id   - language_id     - country_id
                  - name          - country_id      - name
                  - word count    - spoken_since    - flag url




Wednesday, November 28, 12
Language                     Country
                                     IS_SPOKEN_IN
                      - name                        - name
                      - word count                  - flag url




Wednesday, November 28, 12
Language                       Country
                                       IS_SPOKEN_IN
                      - name                          - name
                      - word count                    - flag url




                                SIMILAR_TO      ADJACENT_TO
Wednesday, November 28, 12
Anti-Patterns




Wednesday, November 28, 12
Hefty nodes




Wednesday, November 28, 12
User


                             - first_name
                                               - ship_address
                             - last_name
                                               - ship_city
                             - email_address
                                               - ship_state
                             - bill_address
                                               - ship_zip
                             - bill_city
                                               - regular_customer
                             - bill_state
                             - bill_zip




Wednesday, November 28, 12
BILLS_TO     Address
                             User
                 - first_name                     - street_address
                 - last_name                     - city
                 - email_address                 - state
                 - regular_customer   SHIPS_TO   - zip




Wednesday, November 28, 12
BILLS_TO
                             User                       Address
                   - first_name                        - street_address
                   - last_name             SHIPS_TO   - city
                   - email_address                    - state
                                                      - zip

                                    IS_A


            Regular customer
Wednesday, November 28, 12
Jess
                                      IS_A

                                             Regular
                                             customer   IS_A
                                     IS_A
                                                               Andreas

                                    Andrew


Wednesday, November 28, 12
Missing nodes




Wednesday, November 28, 12
EMAILED
                             Peter             Jim




Wednesday, November 28, 12
SENT           TO
                             Peter          Email        Jim




Wednesday, November 28, 12
Hot node




Wednesday, November 28, 12
Wednesday, November 28, 12
Key takeaways




Wednesday, November 28, 12
Indexes for starting points
                               Relationships for queries
                             Read sentences from the graph
                               Look out for verb’d nouns



Wednesday, November 28, 12
- Indexes for starting points
                             - Relationships for queries
                             - Read sentences from the graph
                             - Look out for verb’d nouns




Data modeling with graphs                        @PeterBell
Wednesday, November 28, 12

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Data Modeling with Graphs: Terminology, Examples, Patterns and Key Takeaways