SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Último

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
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
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
 
"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
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 

Último (20)

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
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
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
 
"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...
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 

Destaque

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
 

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

Notas do Editor

  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