SlideShare une entreprise Scribd logo
1  sur  34
GraphTO
                 October 2012, Mozilla Toronto




David Colebatch & Darrick Wiebe              us@xnlogic.com
Agenda
•   Intro's and Welcome

•   Pacer 1.0

    •   pacer-examples-*
                                Sponsored By:


        •   Enron

        •   Graph in the REPL

•   Questions

•   Discussion...
¿por qué?

• Data Set Size
• Connectivity of Data
• Semi-structure
• Evolution of SOA and REST
The Zone of SQL Adequacy
                                               SQL database

                                               Requirement of application
Performance




                             Data complexity
The Zone of SQL Adequacy
                                               SQL database

                                               Requirement of application
Performance




                             Data complexity
The Zone of SQL Adequacy
                                                           SQL database

                                                           Requirement of application
Performance




               Salary List




                             ERP


                                   CRM




                                         Data complexity
The Zone of SQL Adequacy
                                                                          SQL database
                                                     Social
                                                                          Requirement of application
                                         Geo
Performance




               Salary List

                                                        Network / Cloud
                                                         Management

                             ERP

                                               MDM
                                   CRM




                                               Data complexity
Graph Space
                    New Vendors

The last 12 months have seen a
number of new graph
technologies emerge
•   AffinityDB (VMW),YarcData uRiKA
    (Cray), Giraph (YHOO), Cassovary
    (Twitter), StigDB (Tagged), NuvolaBase,
    Pegasus, Titan (Aurelius), etc
How?
•   Nodes / Vertices

•   Relationships / Edges
Relational Model vs. Graph


                                                Each of these models
                                              expresses the same thing

Person*   Person-Friend   Friend*
                                                     Em                                          Joh
                                                          il                                           an
                                           knows                                        knows
                              Alli                                         Tob                                          Lar
                                     son                                       i   as           knows                      s
                                                                   knows
                                                   And                                          And                     knows
                              knows                      rea                                          rés
                                                               s
                                                                   knows                knows                   knows
                              Pet                                          Miic
                                                                           Mc                   knows                    Ian
                                 er                knows                       aa
                                           knows                   knows
                                                    De                                          Mic
                                                       lia                                         hae
                                                                                                            l
Graph db performance
๏ a sample social graph
   • with ~1,000 persons
๏ average 50 friends per person
๏ pathExists(a,b) limited to depth 4
๏ caches warmed up to eliminate disk I/O

         Database             # persons            query time
  MySQL                                    1,000       2,000 ms
  Neo4j                                    1,000          2 ms
  Neo4j                          1,000,000                2 ms
Query Languages

• SPARQL - if you grok RDF already
• Cypher
• Gremlin
• Pacer - gem install pacer*

  * requires jRuby 1.7.0
Pacer::Examples::Enron

• Sample data provided by Chris Diehl
  http://www.cpdiehl.org


• A selection of the Enron email database, in
  GraphML format
$ git clone 
  http://github.com/xnlogic/pacer-examples-enron.git

$   cd pacer-examples-enron
$   bundle
$   ./script/download_enron_data.sh
$   ./script/start_jirb.sh

> enron = Pacer::Examples::Enron.load_data

> enron.summary_of_data_types
 => {
      "Message"=>255636,
      "Email Address"=>87474,
      "Person"=>156
    }
So What?

• Heavy Emailers
• Communication paths
• ...add meta-data vertices to
Clustering Email by
         Topic
• Analyze each email body
• Detect 150 topics
• Associate each email to its top-5 topics
• Create meta-data vertices representing this
  data
• Go nuts!
 • Trading emails with high BCC rates.
001> Pacer.in_the_REPL



      REPL driven development is what I do!
Too hard to work with query
languages and traversal
algorithms in an interactive way.

- Simple things like discovering
labels of edges for the current
vertex were not easy.
The same time I was feeling that
pain, discovered this interesting
xpath inspired language called
Gremlin



gremlin> outE/inV/inE/outV/back(3)/outV/etc
  ==> V[1]
  ==> V[2]
why is this its own language?



- Solid underpinnings, great architecture

- Ruby syntax in a couple of hours

- Pacer was born by the end of the weekend

- 2 years ago...
  Ecosystem has evolved a lot since then
Time for some Pacer!



g = Pacer.neo4j 'db/enron.graph'
 => #<PacerGraph neo4jgraph[db/enron.graph]>
Discovering your data


 >> g.v.frequencies :type
 => {
      "Message"=>255636,
      "Email Address"=>87474,
      "Person"=>156
Keeping Pacer friendly in the repl
reuse routes and extend them




  >> emails = g.v(Email, type: 'email')
  => #<V-Lucene(type:email) ~ 87474>
intelligent output


>> emails.limit 5
  #<V[191310]> #<V[252457]> #<V[210184]>
  #<V[237290]> #<V[252460]>

 => #<V-Lucene(type:email) ~ 87474 -> V -> V-Range(-1...5)>
we can do better
 g.vertex_name = proc do |v|
   if v[:type]    == 'email'   ; v[:address]
   elsif v[:type] == 'Message' ; v[:subject] ; end
 end

>> emails.limit 5
  #<V[191310] susan_bittick@may-co.com>
  #<V[252457] b.todes@worldnet.att.net>
  #<V[210184] usatoday5918@mailandnews.com>
  #<V[237290] lacker@llgm.com>
  #<V[252460] cesherman@hahnlaw.com>
  Total: 5
Beyond the REPL
>> emails.map.help
  Works much like Ruby's built-in map method but has some extra
  options and, like all routes, does not evaluate immediately (see
  the :routes help topic).

  Example:
  ...
  ...


>> emails.map.help :options
  ...
  ...
So how can we use it?

In the Enron data, we can tell when people
were BCC'd:



>> g.e('RECEIVED_BY').frequencies :type
=> {
       "to"=>1159970,
       "bcc"=>243627,
       "cc"=>243627
     }
Apparently it was a common
occurrence
>> few_bccs = emails.lookahead(max:10) do |e|
                e.sent.received_by(type: 'bcc')
              end
=> #<V-Lucene(type:email) ~ 87474 -> V -> V-Future(#<V -> out(:SENT) -> V ->
outE(:RECEIVED_BY) -> E-Property(type=="bcc") -> inV -> V -> HasCount(<= 10) -> is(true)>)>




>> rare_bccs = few_bccs.lookahead(min:1000) do |e|
                e.sent.received_by(type: 'to')
               end
...
=> #<V-Lucene(type:email) ~ 87474 -> V -> V-Future(#<V -> out(:SENT) -> V ->...>
Takes a couple of seconds.
Let's speed it up

>> interesting = rare_bccs.result
=> #<Obj 32 ids -> lookup -> is_not(nil)>
Let's see if anyone had
any concerns
>> interesting.sent.
   lookahead(&:bcc).
   filter { |m| m[:body] =~ /concerns/i }
#<V[131323] Enron Mentions - 01/30/2001>
#<V[194186] Western Storage Initiatives>
Total: 2
=> #<Obj 32 ids -> ...>
Resources

https://github.com/xnlogic/pacer-examples-enron
https://github.com/xnlogic/pacer-xml
https://github.com/pangloss/pacer
http://tinkerpop.com/
http://neo4j.org/
GraphTO
                 October 2012, Mozilla Toronto




David Colebatch & Darrick Wiebe              us@xnlogic.com

Contenu connexe

Dernier

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Dernier (20)

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

En vedette

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
 

En vedette (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...
 

GraphTO Meetup: Intro to Graph Database and Pacer 1.0

  • 1. GraphTO October 2012, Mozilla Toronto David Colebatch & Darrick Wiebe us@xnlogic.com
  • 2. Agenda • Intro's and Welcome • Pacer 1.0 • pacer-examples-* Sponsored By: • Enron • Graph in the REPL • Questions • Discussion...
  • 3. ¿por qué? • Data Set Size • Connectivity of Data • Semi-structure • Evolution of SOA and REST
  • 4. The Zone of SQL Adequacy SQL database Requirement of application Performance Data complexity
  • 5. The Zone of SQL Adequacy SQL database Requirement of application Performance Data complexity
  • 6. The Zone of SQL Adequacy SQL database Requirement of application Performance Salary List ERP CRM Data complexity
  • 7. The Zone of SQL Adequacy SQL database Social Requirement of application Geo Performance Salary List Network / Cloud Management ERP MDM CRM Data complexity
  • 8. Graph Space New Vendors The last 12 months have seen a number of new graph technologies emerge • AffinityDB (VMW),YarcData uRiKA (Cray), Giraph (YHOO), Cassovary (Twitter), StigDB (Tagged), NuvolaBase, Pegasus, Titan (Aurelius), etc
  • 9. How? • Nodes / Vertices • Relationships / Edges
  • 10. Relational Model vs. Graph Each of these models expresses the same thing Person* Person-Friend Friend* Em Joh il an knows knows Alli Tob Lar son i as knows s knows And And knows knows rea rés s knows knows knows Pet Miic Mc knows Ian er knows aa knows knows De Mic lia hae l
  • 11. Graph db performance ๏ a sample social graph • with ~1,000 persons ๏ average 50 friends per person ๏ pathExists(a,b) limited to depth 4 ๏ caches warmed up to eliminate disk I/O Database # persons query time MySQL 1,000 2,000 ms Neo4j 1,000 2 ms Neo4j 1,000,000 2 ms
  • 12. Query Languages • SPARQL - if you grok RDF already • Cypher • Gremlin • Pacer - gem install pacer* * requires jRuby 1.7.0
  • 13.
  • 14. Pacer::Examples::Enron • Sample data provided by Chris Diehl http://www.cpdiehl.org • A selection of the Enron email database, in GraphML format
  • 15.
  • 16. $ git clone http://github.com/xnlogic/pacer-examples-enron.git $ cd pacer-examples-enron $ bundle $ ./script/download_enron_data.sh $ ./script/start_jirb.sh > enron = Pacer::Examples::Enron.load_data > enron.summary_of_data_types => { "Message"=>255636, "Email Address"=>87474, "Person"=>156 }
  • 17. So What? • Heavy Emailers • Communication paths • ...add meta-data vertices to
  • 18. Clustering Email by Topic • Analyze each email body • Detect 150 topics • Associate each email to its top-5 topics • Create meta-data vertices representing this data • Go nuts! • Trading emails with high BCC rates.
  • 19. 001> Pacer.in_the_REPL REPL driven development is what I do!
  • 20. Too hard to work with query languages and traversal algorithms in an interactive way. - Simple things like discovering labels of edges for the current vertex were not easy.
  • 21. The same time I was feeling that pain, discovered this interesting xpath inspired language called Gremlin gremlin> outE/inV/inE/outV/back(3)/outV/etc ==> V[1] ==> V[2]
  • 22. why is this its own language? - Solid underpinnings, great architecture - Ruby syntax in a couple of hours - Pacer was born by the end of the weekend - 2 years ago... Ecosystem has evolved a lot since then
  • 23. Time for some Pacer! g = Pacer.neo4j 'db/enron.graph' => #<PacerGraph neo4jgraph[db/enron.graph]>
  • 24. Discovering your data >> g.v.frequencies :type => { "Message"=>255636, "Email Address"=>87474, "Person"=>156
  • 25. Keeping Pacer friendly in the repl reuse routes and extend them >> emails = g.v(Email, type: 'email') => #<V-Lucene(type:email) ~ 87474>
  • 26. intelligent output >> emails.limit 5 #<V[191310]> #<V[252457]> #<V[210184]> #<V[237290]> #<V[252460]> => #<V-Lucene(type:email) ~ 87474 -> V -> V-Range(-1...5)>
  • 27. we can do better g.vertex_name = proc do |v| if v[:type] == 'email' ; v[:address] elsif v[:type] == 'Message' ; v[:subject] ; end end >> emails.limit 5 #<V[191310] susan_bittick@may-co.com> #<V[252457] b.todes@worldnet.att.net> #<V[210184] usatoday5918@mailandnews.com> #<V[237290] lacker@llgm.com> #<V[252460] cesherman@hahnlaw.com> Total: 5
  • 28. Beyond the REPL >> emails.map.help Works much like Ruby's built-in map method but has some extra options and, like all routes, does not evaluate immediately (see the :routes help topic). Example: ... ... >> emails.map.help :options ... ...
  • 29. So how can we use it? In the Enron data, we can tell when people were BCC'd: >> g.e('RECEIVED_BY').frequencies :type => { "to"=>1159970, "bcc"=>243627, "cc"=>243627 }
  • 30. Apparently it was a common occurrence >> few_bccs = emails.lookahead(max:10) do |e| e.sent.received_by(type: 'bcc') end => #<V-Lucene(type:email) ~ 87474 -> V -> V-Future(#<V -> out(:SENT) -> V -> outE(:RECEIVED_BY) -> E-Property(type=="bcc") -> inV -> V -> HasCount(<= 10) -> is(true)>)> >> rare_bccs = few_bccs.lookahead(min:1000) do |e| e.sent.received_by(type: 'to') end ... => #<V-Lucene(type:email) ~ 87474 -> V -> V-Future(#<V -> out(:SENT) -> V ->...>
  • 31. Takes a couple of seconds. Let's speed it up >> interesting = rare_bccs.result => #<Obj 32 ids -> lookup -> is_not(nil)>
  • 32. Let's see if anyone had any concerns >> interesting.sent. lookahead(&:bcc). filter { |m| m[:body] =~ /concerns/i } #<V[131323] Enron Mentions - 01/30/2001> #<V[194186] Western Storage Initiatives> Total: 2 => #<Obj 32 ids -> ...>
  • 34. GraphTO October 2012, Mozilla Toronto David Colebatch & Darrick Wiebe us@xnlogic.com

Notes de l'éditeur

  1. \n
  2. \n
  3. There are four trends underpinning the NoSQL and specifically the GraphDB movements:\n1)...the size of data that we are managing is more than doubling every two years, with around 2.4 Zettabytes expected by the end of this year (or 250mil years of the TV show &amp;#x201C;24&amp;#x201D;).\n\n2) Data is more highly-connected than ever before. FOAF on social networks; Configuration Management for a Datacenter\n\n3) Schema-less data persistence; Add a field to just one record, no problem. Sparkes on Toyota\n\n4) Application Architecture changed from flat-files and batch processing, to shared RDBMS, SOA + Web services\n\n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. *This is a somewhat contrived example, as &amp;#x201C;person&amp;#x201D; &amp; &amp;#x201C;friend&amp;#x201D; would normally be one table with a self join.\n
  10. A borrowed slide from neo technology\n
  11. A few options exist for graph query languages, some you may have hear of. \nSPARQL is a recursive acronym for &amp;#x201C;SPARQL Protocol and RDF Query Language&amp;#x201D; for Resource Description Framework. \nCypher and Gremlin are modern graph query languages with strong ties to the Neo4j community.\nPacer is a ruby gem that you can include in your projects and get jamming on embedded graph databases straight away. \n
  12. \n
  13. Chris compared Traffic-based and Content-based message ranking approaches to discover Ego Networks. We don&amp;#x2019;t need to worry about the details here though. Chris has left us with a nice property graph which identifies official reporting relationships by an edge labelled &amp;#x201C;Directly_Reported_To&amp;#x201D;.\n
  14. Add organizational groups\nCluster messages together into X (new vertex for X)\n\nNaughty emails.\nNONE came *from* enron email addresses\n\n
  15. Here we show how to:\n Start IRB with 3GB of heap space &amp; require the enron examples lib\n Load the sample GraphML data into an in-memory TinkerGraph\n Use a helper method to get a high-level summary of the data\n
  16. A few quick query types that are best suited to the graph are things like: \nCalculating the heaviest emailers with fast edge counting, and discovering communication paths through graph algorithms like Dijkstra&amp;#x2019;s shortest-path.\n\nAdding meta-data vertices to a dataset like this enables even more power-of-the-graph type of analysis. For example, coupling the &amp;#x2018;influencer&amp;#x2019; type analysis with sentiment analysis on the email message bodies, would allow you to determine which groups of staff were being negatively (or positively) effected by a given influencer. \n\n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. Go here, cool stuff.\n
  33. \n