SlideShare a Scribd company logo
1 of 12
Meetup Jan 29th, 2014
Realistic Neo4j: Neo4j + Ruby (part 1)

1
Neo4j Quick Review
• Benefits of a Graph Database
– Super fast when querying complex, highly connected data
– Schema-less and Efficient storage of Semi Structured Information
– Fast deep traversal instead of slow SQL queries that span many table
joins
– Very natural to express graph related problems with traversals
(recommendation engine, shortest parth etc..)

source:
http://neo4j.rubyforge.org/guides/why_gra
ph_db.html
Neo4j Quick Review
•

Graph Database
– A graph database is a database that uses graph structures with nodes, edges, and properties
to represent and store data (Wikipedia)

•

Node
– An entity in the database typically representing a “thing”

•

Relationship
– A one way link between two nodes

•

Node/Relationship Property
– A key-value pair that can be attached to a node or relationship
– example: { “name” : “Nicholas” }

•

Label
– A “tag” that can be attached to a node in order to make querying faster and more convenient

3
Example
node

node

property: value
property: value
property: value

relationship type

label

name: ‘Joe’
age: 27

label

:UPLOADS

filename: ‘cat.png’

on: 2013-11-18

:User

:Photo

4
Example
:User

:FOLLOWS

name: ‘Joe’
age: 27

weight: 10
name: ‘Jane’
bday: 19800115

:FOLLOWS

:PHOTO
weight: 2
filename: ‘cat.png’

:LIKES
name: ‘Joe’
age: 27

on: 20131118

5
Queries are Traversals
start

end

6
What Are Our Options?
• Java
– Kind of heavyweight. Bit more complex to host. But good for
control and optimizing queries.

• Ruby
– Neo4j.rb
• Uses JRuby which is still Java under the hood.

– Neography
• Uses Neo4j’s RESTful HTTP web services
• Not as fast as other options, but simple and easier to deploy and host

• Other Options
– Node.js, Python, PHP, .NET, Go, etc

– http://www.neo4j.org/develop/drivers
7
Our Example Today
• Why Ruby?
– Simple, popular, easy to learn.

• Why Not X Instead of Ruby?
• Why Neography?
– Communicates with Neo4j via HTTP, simply point your code to a
Neo4j server and get started
– Downside: not the best documentation or examples for newcomers
(hence this meetup)

– https://github.com/maxdemarzi/neography

• Why aren’t we looking at a Rails example?
• Thoughts on ActiveRecord
8
Today (part 1) We’ll Cover
• Writing Code That:
– creates nodes for Users
– creates relationships for Users

– using indexes

• Writing a Few Tests To Demonstrate

• (No webpages, Sorry , Keeping it Simple)
9
Technologies We’ll Cover
•

Neo4j
– Download, start and make sure Neo4j is running
– Checkout the Data Browser at http://localhost:7474

•

Ruby
– Ruby is a programming language we will use to talk to the Neo4j server
– Install Ruby: https://www.ruby-lang.org/en/installation
– Run `ruby –v` to make sure it is installed properly

•

Sinatra
– A simple framework for writing Ruby web applications or web service APIs
– Remember, use whatever language and framwork you like. Sinatra is just an example.
– (more information: http://www.sinatrarb.com)
– (great intro: http://www.slideshare.net/knaveofdiamonds/web-simplicity-ruby-sinatra-rack )

10
Finding Help
– https://github.com/seenickcode/nycneo4j-sinatraexample-1/tree/master/meetup-003-sinatra-example1

– Neography
– http://maxdemarzi.com/2012/01/04/getting-startedwith-ruby-and-neo4j/
– https://github.com/neo4j-contrib/neo4j-herokuseeds/tree/master/ruby/sinatra-neography
11
Thanks for Coming
• @seenickcode
• nicholas.manning@gmail.com for

questions
• Next time we’ll expand on this!

• Want to present? Let me know.

12

More Related Content

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 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
 

Featured

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
ThinkNow
 
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
Kurio // The Social Media Age(ncy)
 

Featured (20)

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...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

NYC Neo4j Meetup 003 Slides: Realistic Neo4j with Ruby (Part 1)

  • 1. Meetup Jan 29th, 2014 Realistic Neo4j: Neo4j + Ruby (part 1) 1
  • 2. Neo4j Quick Review • Benefits of a Graph Database – Super fast when querying complex, highly connected data – Schema-less and Efficient storage of Semi Structured Information – Fast deep traversal instead of slow SQL queries that span many table joins – Very natural to express graph related problems with traversals (recommendation engine, shortest parth etc..) source: http://neo4j.rubyforge.org/guides/why_gra ph_db.html
  • 3. Neo4j Quick Review • Graph Database – A graph database is a database that uses graph structures with nodes, edges, and properties to represent and store data (Wikipedia) • Node – An entity in the database typically representing a “thing” • Relationship – A one way link between two nodes • Node/Relationship Property – A key-value pair that can be attached to a node or relationship – example: { “name” : “Nicholas” } • Label – A “tag” that can be attached to a node in order to make querying faster and more convenient 3
  • 4. Example node node property: value property: value property: value relationship type label name: ‘Joe’ age: 27 label :UPLOADS filename: ‘cat.png’ on: 2013-11-18 :User :Photo 4
  • 5. Example :User :FOLLOWS name: ‘Joe’ age: 27 weight: 10 name: ‘Jane’ bday: 19800115 :FOLLOWS :PHOTO weight: 2 filename: ‘cat.png’ :LIKES name: ‘Joe’ age: 27 on: 20131118 5
  • 7. What Are Our Options? • Java – Kind of heavyweight. Bit more complex to host. But good for control and optimizing queries. • Ruby – Neo4j.rb • Uses JRuby which is still Java under the hood. – Neography • Uses Neo4j’s RESTful HTTP web services • Not as fast as other options, but simple and easier to deploy and host • Other Options – Node.js, Python, PHP, .NET, Go, etc – http://www.neo4j.org/develop/drivers 7
  • 8. Our Example Today • Why Ruby? – Simple, popular, easy to learn. • Why Not X Instead of Ruby? • Why Neography? – Communicates with Neo4j via HTTP, simply point your code to a Neo4j server and get started – Downside: not the best documentation or examples for newcomers (hence this meetup) – https://github.com/maxdemarzi/neography • Why aren’t we looking at a Rails example? • Thoughts on ActiveRecord 8
  • 9. Today (part 1) We’ll Cover • Writing Code That: – creates nodes for Users – creates relationships for Users – using indexes • Writing a Few Tests To Demonstrate • (No webpages, Sorry , Keeping it Simple) 9
  • 10. Technologies We’ll Cover • Neo4j – Download, start and make sure Neo4j is running – Checkout the Data Browser at http://localhost:7474 • Ruby – Ruby is a programming language we will use to talk to the Neo4j server – Install Ruby: https://www.ruby-lang.org/en/installation – Run `ruby –v` to make sure it is installed properly • Sinatra – A simple framework for writing Ruby web applications or web service APIs – Remember, use whatever language and framwork you like. Sinatra is just an example. – (more information: http://www.sinatrarb.com) – (great intro: http://www.slideshare.net/knaveofdiamonds/web-simplicity-ruby-sinatra-rack ) 10
  • 11. Finding Help – https://github.com/seenickcode/nycneo4j-sinatraexample-1/tree/master/meetup-003-sinatra-example1 – Neography – http://maxdemarzi.com/2012/01/04/getting-startedwith-ruby-and-neo4j/ – https://github.com/neo4j-contrib/neo4j-herokuseeds/tree/master/ruby/sinatra-neography 11
  • 12. Thanks for Coming • @seenickcode • nicholas.manning@gmail.com for questions • Next time we’ll expand on this! • Want to present? Let me know. 12