SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Kürzlich hochgeladen

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 

Kürzlich hochgeladen (20)

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 

Empfohlen

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
 

Empfohlen (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

Hinweis der Redaktion

  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