ROAD TO NODES - Intro to Neo4j + NeoDash.pdf

Neo4j
Neo4jOpen Source NOSQL Graph Database à Neo4j
© 2022 Neo4j, Inc. All rights reserved.
© 2022 Neo4j, Inc. All rights reserved.
Andreas Kollegger & Niels De Jong
ROAD TO NODES
Intro to Neo4j & Interactive
Dashboarding with NeoDash
© 2022 Neo4j, Inc. All rights reserved.
Today we will cover
● What is a graph database?
● How to query a graph database?
● Hands on: Low-code Dashboarding with NeoDash
● Bring your questions!
© 2022 Neo4j, Inc. All rights reserved.
Graph Database
Fundamentals
© 2022 Neo4j, Inc. All rights reserved.
Macbook
Graph Database
Fundamentals
Nodes
© 2022 Neo4j, Inc. All rights reserved.
Macbook
Graph Database
Fundamentals
Nodes
Nodes represent things
© 2022 Neo4j, Inc. All rights reserved.
Macbook
Product
Graph Database
Fundamentals
Nodes
Nodes represent things
Nodes can be identified by
one or more labels
© 2022 Neo4j, Inc. All rights reserved.
Macbook
Product
Graph Database
Fundamentals
Nodes
Nodes represent things
Nodes can be identified by
one or more labels
Fragile
© 2022 Neo4j, Inc. All rights reserved.
Macbook
Product
name: Macbook Pro
price: 2699.00
Graph Database
Fundamentals
Nodes
Nodes represent things
Nodes can be identified by
one or more labels
Nodes can hold properties
as key/value pairs
Fragile
© 2022 Neo4j, Inc. All rights reserved.
Customer
name: Andreas
email: andreas@neo4j.com
Graph Database
Fundamentals
Relationships
Product
name: Macbook Pro
price: 2699.00
© 2022 Neo4j, Inc. All rights reserved.
Customer
Graph Database
Fundamentals
Relationships
Product
name: Macbook Pro
price: 2699.00
name: Andreas
email: andreas@neo4j.com
© 2022 Neo4j, Inc. All rights reserved.
Customer
Graph Database
Fundamentals
Relationships
Relationships connect two nodes
Product
name: Macbook Pro
price: 2699.00
name: Andreas
email: andreas@neo4j.com
© 2022 Neo4j, Inc. All rights reserved.
Customer
Graph Database
Fundamentals
Relationships
Relationships connect two nodes
Relationships have a type
Product
name: Macbook Pro
price: 2699.00
RATED
name: Andreas
email: andreas@neo4j.com
© 2022 Neo4j, Inc. All rights reserved.
Relationships have a direction
Customer
Graph Database
Fundamentals
Relationships
Relationships connect two nodes
Relationships have a type
Product
name: Macbook Pro
price: 2699.00
RATED
name: Andreas
email: andreas@neo4j.com
© 2022 Neo4j, Inc. All rights reserved.
Relationships have a direction
Customer
Graph Database
Fundamentals
Relationships
Relationships connect two nodes
Relationships have a type
Product
name: Macbook Pro
price: 2699.00
RATED
stars: 3
createdAt: 2023-03-22
Relationships can hold properties
as key/value pairs
name: Andreas
email: andreas@neo4j.com
© 2022 Neo4j, Inc. All rights reserved.
Graph Database
Fundamentals
Cypher
Introduction to Cypher
Cypher is a declarative language that allows
you to identify patterns in your data using
an ASCII-art style syntax consisting of
brackets, dashes and arrows.
© 2022 Neo4j, Inc. All rights reserved.
Graph Database
Fundamentals
Cypher
Introduction to Cypher
Cypher is a declarative language that allows
you to identify patterns in your data using
an ASCII-art style syntax consisting of
brackets, dashes and arrows.
Product
RATED
Customer
© 2022 Neo4j, Inc. All rights reserved.
Graph Database
Fundamentals
Cypher
Introduction to Cypher
Cypher is a declarative language that allows
you to identify patterns in your data using
an ASCII-art style syntax consisting of
brackets, dashes and arrows.
Product
RATED
Customer
© 2022 Neo4j, Inc. All rights reserved.
Graph Database
Fundamentals
Cypher
Introduction to Cypher
Cypher is a declarative language that allows
you to identify patterns in your data using
an ASCII-art style syntax consisting of
brackets, dashes and arrows.
Product
RATED
Customer
(c:Customer)-[r:RATED]->(p:Product)
© 2022 Neo4j, Inc. All rights reserved.
Graph Database
Fundamentals
Cypher
Introduction to Cypher
Cypher is a declarative language that allows
you to identify patterns in your data using
an ASCII-art style syntax consisting of
brackets, dashes and arrows.
Product
RATED
Customer
(c:Customer)-[r:RATED]->(p:Product)
© 2022 Neo4j, Inc. All rights reserved.
Graph Database
Fundamentals
Cypher
Introduction to Cypher
Cypher is a declarative language that allows
you to identify patterns in your data using
an ASCII-art style syntax consisting of
brackets, dashes and arrows.
Product
RATED
Customer
(c:Customer)-[r:RATED]->(p:Product)
© 2022 Neo4j, Inc. All rights reserved.
Graph Database
Fundamentals
Cypher
Introduction to Cypher
Cypher is a declarative language that allows
you to identify patterns in your data using
an ASCII-art style syntax consisting of
brackets, dashes and arrows.
Product
RATED
Customer
(c:Customer)-[r:RATED]->(p:Product)
© 2022 Neo4j, Inc. All rights reserved.
Graph Database
Fundamentals
Cypher
Introduction to Cypher
Cypher is a declarative language that allows
you to identify patterns in your data using
an ASCII-art style syntax consisting of
brackets, dashes and arrows.
Product
RATED
Customer
(c:Customer)-[r:RATED]->(p:Product)
© 2022 Neo4j, Inc. All rights reserved.
Graph Database
Fundamentals
Cypher
Introduction to Cypher
Cypher is a declarative language that allows
you to identify patterns in your data using
an ASCII-art style syntax consisting of
brackets, dashes and arrows.
Product
RATED
Customer
(c:Customer)-[r:RATED]->(p:Product)
© 2022 Neo4j, Inc. All rights reserved.
Graph Database
Fundamentals
Cypher
Introduction to Cypher
Cypher is a declarative language that allows
you to identify patterns in your data using
an ASCII-art style syntax consisting of
brackets, dashes and arrows.
Product
RATED
Customer
(c:Customer)-[r:RATED]->(p:Product)
© 2022 Neo4j, Inc. All rights reserved.
name: Adam
email: adam@neo4j.com
Graph Database
Fundamentals
The MATCH clause
Product
name: Macbook Pro
price: 2699.00
RATED
stars: 3
createdAt: 2023-03-22
MATCH (c:Customer)-[r:RATED]->(p:Product)
RETURN c.name AS customer, p.name AS product, r.stars
AS rating
Customer
name: Andreas
email: andreas@neo4j.com
© 2022 Neo4j, Inc. All rights reserved.
Building Neo4j Dashboards with
NeoDash
Niels de Jong
© 2022 Neo4j, Inc. All rights reserved.
What’s next?
Now that we have an understanding of Cypher, let's create a dashboard to
visualize our graph!
© 2022 Neo4j, Inc. All rights reserved.
© 2022 Neo4j, Inc. All rights reserved.
What is NeoDash?
NeoDash is an open-source, low-code Dashboard Builder for Neo4j. It
lets you build an interactive dashboard with tables, graphs, bar charts,
line charts, maps and more, in minutes.
👤
>1000 monthly
users
🌎
Used in
>100 countries
⭐
Used by dozens of
companies worldwide
󰟾
Neo4j Labs Project*
*Neo4j Labs projects are free, open-source tools that complement the Neo4j product suite. Check out https://neo4j.com/labs/
© 2022 Neo4j, Inc. All rights reserved.
The NeoDash Dashboard Editor
NeoDash key features:
- Use Cypher queries to populate reports
- Drag-and-drop interface
- If you know Cypher, you can create a dashboard in a matter of minutes
© 2022 Neo4j, Inc. All rights reserved.
An Extendable Framework
NeoDash is fully extendable to:
- Add/customize visualizations
- Add company branding
- Add new functionality
NeoDash
Editor
🧩
Custom user
logic
🧩
Custom
Visualizations
🧩
Rule-based
Styling
© 2022 Neo4j, Inc. All rights reserved.
The Dataset
RecipeNLG:
- 2.2M recipes
- With steps
- And ingredients
- Scraped from
cookbooks.com,
recipe-plus.com,
…
© 2022 Neo4j, Inc. All rights reserved.
Graph-Chef
With our recipe dataset loaded
into Neo4j, lets use NeoDash for:
1. Creating a search engine for
recipes
2. Avoiding food waste! Look up
recipes with what is in my fridge
3. Identifying common
combinations of ingredients.
What goes well together?
4. Cooking inspiration. Can we
create new recipes by looking at
graph patterns?
© 2022 Neo4j, Inc. All rights reserved.
Final note before getting started
We will be using Neo4j Aura for this demo.
You can create your own Neo4j Aura instance for free at https://neo4j.io.
You can access NeoDash at https://neodash.graphapp.io.
© 2022 Neo4j, Inc. All rights reserved.
Page 1 - Overview
We start off with some simple Cypher queries to analyze the graph.
- Show me the graph schema.
- How many recipes in total?
- How many ingredients in total?
- How many steps in total?
Looking at burgers:
- How many burger recipes?
- How many unique ingredients in burgers?
- How many steps on average to create a burger? Bar chart!
- What is the most complex burger? Graph
- What top 10 ingredients are common across burger recipes? Pie chart!
- Is there a preparation step that burger recipes share?
© 2022 Neo4j, Inc. All rights reserved.
Page 2 - Recipes
Moving on to slightly more complex queries, using parameters for interactivity.
Search functionality:
- Show me a graph of all ingredients for ‘Pear Pancakes’.
- Turn it into a searchable widget.
- Show me also a table of ingredients, side-by-side.
- Add a table of steps.
- Try ‘Dutch Pancakes’. Do we see an interesting pattern?
© 2022 Neo4j, Inc. All rights reserved.
Page 3 - Ingredients
Finally we do some more complex queries to
demonstrate the power of Cypher.
Ingredient search:
- Create a search for ingredients
- Show a graph of recipes with the ingredient
- Common pairings with selected ingredient
Multi-ingredients:
- Change selector to multi-selector
- Fix the graph visualization to work with multiple
parameters
- Suggest ingredient pairings based on the set of
ingredients selected
// Subqueries with post-processing
UNWIND $neodash_ingredient_name as name
CALL {
WITH name
MATCH p=(i:Ingredient)-[:IN]-(r:Recipe)
WHERE i.name = name
RETURN r
}
WITH r, COUNT(r) as count
WHERE count = size($neodash_ingredient_name)
WITH r LIMIT 10
MATCH (r)-[in:IN]-(i:Ingredient)
RETURN r, in, i
// Using subqueries
UNWIND $neodash_ingredient_name as name
CALL {
WITH name
MATCH p=(i:Ingredient)-[in:IN]-(r:Recipe)
WHERE i.name = name
RETURN i, in, r
LIMIT 10
}
RETURN i, in, r
// Even more post-processing!
UNWIND $neodash_ingredient_name as name
CALL {
WITH name
MATCH p=(i:Ingredient)-[:IN]-(r:Recipe)
WHERE i.name = name
RETURN r
}
WITH r, COUNT(r) as count
WHERE count = size($neodash_ingredient_name)
WITH r
MATCH (r)-[in:IN]-(i:Ingredient)
WHERE NOT i.name in $neodash_ingredient_name
RETURN i.name, COUNT(r) ORDER BY COUNT(r) DESC
© 2022 Neo4j, Inc. All rights reserved.
Wrapping up
We will continue working on this dataset on October 26, at NODES 2023!
The recipe dataset will be published around this time.
Want to try out NeoDash in the meantime?
Visit https://neodash-gallery.graphapp.io for public demo dashboards.
1 sur 37

Contenu connexe

Similaire à ROAD TO NODES - Intro to Neo4j + NeoDash.pdf

Training Series - Intro to Neo4jTraining Series - Intro to Neo4j
Training Series - Intro to Neo4jNeo4j
175 vues76 diapositives
Postgres: The NoSQL Cake You Can EatPostgres: The NoSQL Cake You Can Eat
Postgres: The NoSQL Cake You Can EatEDB
2.4K vues32 diapositives

Plus de Neo4j

Operations & Data GraphOperations & Data Graph
Operations & Data GraphNeo4j
17 vues25 diapositives
TAGTTOO: La nova xarxa socialTAGTTOO: La nova xarxa social
TAGTTOO: La nova xarxa socialNeo4j
15 vues19 diapositives
El Arte de lo PossibleEl Arte de lo Possible
El Arte de lo PossibleNeo4j
28 vues35 diapositives
Neo4j y GenAI Neo4j y GenAI
Neo4j y GenAI Neo4j
27 vues41 diapositives
Roadmap y Novedades de productoRoadmap y Novedades de producto
Roadmap y Novedades de productoNeo4j
31 vues33 diapositives

ROAD TO NODES - Intro to Neo4j + NeoDash.pdf

  • 1. © 2022 Neo4j, Inc. All rights reserved. © 2022 Neo4j, Inc. All rights reserved. Andreas Kollegger & Niels De Jong ROAD TO NODES Intro to Neo4j & Interactive Dashboarding with NeoDash
  • 2. © 2022 Neo4j, Inc. All rights reserved. Today we will cover ● What is a graph database? ● How to query a graph database? ● Hands on: Low-code Dashboarding with NeoDash ● Bring your questions!
  • 3. © 2022 Neo4j, Inc. All rights reserved. Graph Database Fundamentals
  • 4. © 2022 Neo4j, Inc. All rights reserved. Macbook Graph Database Fundamentals Nodes
  • 5. © 2022 Neo4j, Inc. All rights reserved. Macbook Graph Database Fundamentals Nodes Nodes represent things
  • 6. © 2022 Neo4j, Inc. All rights reserved. Macbook Product Graph Database Fundamentals Nodes Nodes represent things Nodes can be identified by one or more labels
  • 7. © 2022 Neo4j, Inc. All rights reserved. Macbook Product Graph Database Fundamentals Nodes Nodes represent things Nodes can be identified by one or more labels Fragile
  • 8. © 2022 Neo4j, Inc. All rights reserved. Macbook Product name: Macbook Pro price: 2699.00 Graph Database Fundamentals Nodes Nodes represent things Nodes can be identified by one or more labels Nodes can hold properties as key/value pairs Fragile
  • 9. © 2022 Neo4j, Inc. All rights reserved. Customer name: Andreas email: andreas@neo4j.com Graph Database Fundamentals Relationships Product name: Macbook Pro price: 2699.00
  • 10. © 2022 Neo4j, Inc. All rights reserved. Customer Graph Database Fundamentals Relationships Product name: Macbook Pro price: 2699.00 name: Andreas email: andreas@neo4j.com
  • 11. © 2022 Neo4j, Inc. All rights reserved. Customer Graph Database Fundamentals Relationships Relationships connect two nodes Product name: Macbook Pro price: 2699.00 name: Andreas email: andreas@neo4j.com
  • 12. © 2022 Neo4j, Inc. All rights reserved. Customer Graph Database Fundamentals Relationships Relationships connect two nodes Relationships have a type Product name: Macbook Pro price: 2699.00 RATED name: Andreas email: andreas@neo4j.com
  • 13. © 2022 Neo4j, Inc. All rights reserved. Relationships have a direction Customer Graph Database Fundamentals Relationships Relationships connect two nodes Relationships have a type Product name: Macbook Pro price: 2699.00 RATED name: Andreas email: andreas@neo4j.com
  • 14. © 2022 Neo4j, Inc. All rights reserved. Relationships have a direction Customer Graph Database Fundamentals Relationships Relationships connect two nodes Relationships have a type Product name: Macbook Pro price: 2699.00 RATED stars: 3 createdAt: 2023-03-22 Relationships can hold properties as key/value pairs name: Andreas email: andreas@neo4j.com
  • 15. © 2022 Neo4j, Inc. All rights reserved. Graph Database Fundamentals Cypher Introduction to Cypher Cypher is a declarative language that allows you to identify patterns in your data using an ASCII-art style syntax consisting of brackets, dashes and arrows.
  • 16. © 2022 Neo4j, Inc. All rights reserved. Graph Database Fundamentals Cypher Introduction to Cypher Cypher is a declarative language that allows you to identify patterns in your data using an ASCII-art style syntax consisting of brackets, dashes and arrows. Product RATED Customer
  • 17. © 2022 Neo4j, Inc. All rights reserved. Graph Database Fundamentals Cypher Introduction to Cypher Cypher is a declarative language that allows you to identify patterns in your data using an ASCII-art style syntax consisting of brackets, dashes and arrows. Product RATED Customer
  • 18. © 2022 Neo4j, Inc. All rights reserved. Graph Database Fundamentals Cypher Introduction to Cypher Cypher is a declarative language that allows you to identify patterns in your data using an ASCII-art style syntax consisting of brackets, dashes and arrows. Product RATED Customer (c:Customer)-[r:RATED]->(p:Product)
  • 19. © 2022 Neo4j, Inc. All rights reserved. Graph Database Fundamentals Cypher Introduction to Cypher Cypher is a declarative language that allows you to identify patterns in your data using an ASCII-art style syntax consisting of brackets, dashes and arrows. Product RATED Customer (c:Customer)-[r:RATED]->(p:Product)
  • 20. © 2022 Neo4j, Inc. All rights reserved. Graph Database Fundamentals Cypher Introduction to Cypher Cypher is a declarative language that allows you to identify patterns in your data using an ASCII-art style syntax consisting of brackets, dashes and arrows. Product RATED Customer (c:Customer)-[r:RATED]->(p:Product)
  • 21. © 2022 Neo4j, Inc. All rights reserved. Graph Database Fundamentals Cypher Introduction to Cypher Cypher is a declarative language that allows you to identify patterns in your data using an ASCII-art style syntax consisting of brackets, dashes and arrows. Product RATED Customer (c:Customer)-[r:RATED]->(p:Product)
  • 22. © 2022 Neo4j, Inc. All rights reserved. Graph Database Fundamentals Cypher Introduction to Cypher Cypher is a declarative language that allows you to identify patterns in your data using an ASCII-art style syntax consisting of brackets, dashes and arrows. Product RATED Customer (c:Customer)-[r:RATED]->(p:Product)
  • 23. © 2022 Neo4j, Inc. All rights reserved. Graph Database Fundamentals Cypher Introduction to Cypher Cypher is a declarative language that allows you to identify patterns in your data using an ASCII-art style syntax consisting of brackets, dashes and arrows. Product RATED Customer (c:Customer)-[r:RATED]->(p:Product)
  • 24. © 2022 Neo4j, Inc. All rights reserved. Graph Database Fundamentals Cypher Introduction to Cypher Cypher is a declarative language that allows you to identify patterns in your data using an ASCII-art style syntax consisting of brackets, dashes and arrows. Product RATED Customer (c:Customer)-[r:RATED]->(p:Product)
  • 25. © 2022 Neo4j, Inc. All rights reserved. name: Adam email: adam@neo4j.com Graph Database Fundamentals The MATCH clause Product name: Macbook Pro price: 2699.00 RATED stars: 3 createdAt: 2023-03-22 MATCH (c:Customer)-[r:RATED]->(p:Product) RETURN c.name AS customer, p.name AS product, r.stars AS rating Customer name: Andreas email: andreas@neo4j.com
  • 26. © 2022 Neo4j, Inc. All rights reserved. Building Neo4j Dashboards with NeoDash Niels de Jong
  • 27. © 2022 Neo4j, Inc. All rights reserved. What’s next? Now that we have an understanding of Cypher, let's create a dashboard to visualize our graph!
  • 28. © 2022 Neo4j, Inc. All rights reserved. © 2022 Neo4j, Inc. All rights reserved. What is NeoDash? NeoDash is an open-source, low-code Dashboard Builder for Neo4j. It lets you build an interactive dashboard with tables, graphs, bar charts, line charts, maps and more, in minutes. 👤 >1000 monthly users 🌎 Used in >100 countries ⭐ Used by dozens of companies worldwide 󰟾 Neo4j Labs Project* *Neo4j Labs projects are free, open-source tools that complement the Neo4j product suite. Check out https://neo4j.com/labs/
  • 29. © 2022 Neo4j, Inc. All rights reserved. The NeoDash Dashboard Editor NeoDash key features: - Use Cypher queries to populate reports - Drag-and-drop interface - If you know Cypher, you can create a dashboard in a matter of minutes
  • 30. © 2022 Neo4j, Inc. All rights reserved. An Extendable Framework NeoDash is fully extendable to: - Add/customize visualizations - Add company branding - Add new functionality NeoDash Editor 🧩 Custom user logic 🧩 Custom Visualizations 🧩 Rule-based Styling
  • 31. © 2022 Neo4j, Inc. All rights reserved. The Dataset RecipeNLG: - 2.2M recipes - With steps - And ingredients - Scraped from cookbooks.com, recipe-plus.com, …
  • 32. © 2022 Neo4j, Inc. All rights reserved. Graph-Chef With our recipe dataset loaded into Neo4j, lets use NeoDash for: 1. Creating a search engine for recipes 2. Avoiding food waste! Look up recipes with what is in my fridge 3. Identifying common combinations of ingredients. What goes well together? 4. Cooking inspiration. Can we create new recipes by looking at graph patterns?
  • 33. © 2022 Neo4j, Inc. All rights reserved. Final note before getting started We will be using Neo4j Aura for this demo. You can create your own Neo4j Aura instance for free at https://neo4j.io. You can access NeoDash at https://neodash.graphapp.io.
  • 34. © 2022 Neo4j, Inc. All rights reserved. Page 1 - Overview We start off with some simple Cypher queries to analyze the graph. - Show me the graph schema. - How many recipes in total? - How many ingredients in total? - How many steps in total? Looking at burgers: - How many burger recipes? - How many unique ingredients in burgers? - How many steps on average to create a burger? Bar chart! - What is the most complex burger? Graph - What top 10 ingredients are common across burger recipes? Pie chart! - Is there a preparation step that burger recipes share?
  • 35. © 2022 Neo4j, Inc. All rights reserved. Page 2 - Recipes Moving on to slightly more complex queries, using parameters for interactivity. Search functionality: - Show me a graph of all ingredients for ‘Pear Pancakes’. - Turn it into a searchable widget. - Show me also a table of ingredients, side-by-side. - Add a table of steps. - Try ‘Dutch Pancakes’. Do we see an interesting pattern?
  • 36. © 2022 Neo4j, Inc. All rights reserved. Page 3 - Ingredients Finally we do some more complex queries to demonstrate the power of Cypher. Ingredient search: - Create a search for ingredients - Show a graph of recipes with the ingredient - Common pairings with selected ingredient Multi-ingredients: - Change selector to multi-selector - Fix the graph visualization to work with multiple parameters - Suggest ingredient pairings based on the set of ingredients selected // Subqueries with post-processing UNWIND $neodash_ingredient_name as name CALL { WITH name MATCH p=(i:Ingredient)-[:IN]-(r:Recipe) WHERE i.name = name RETURN r } WITH r, COUNT(r) as count WHERE count = size($neodash_ingredient_name) WITH r LIMIT 10 MATCH (r)-[in:IN]-(i:Ingredient) RETURN r, in, i // Using subqueries UNWIND $neodash_ingredient_name as name CALL { WITH name MATCH p=(i:Ingredient)-[in:IN]-(r:Recipe) WHERE i.name = name RETURN i, in, r LIMIT 10 } RETURN i, in, r // Even more post-processing! UNWIND $neodash_ingredient_name as name CALL { WITH name MATCH p=(i:Ingredient)-[:IN]-(r:Recipe) WHERE i.name = name RETURN r } WITH r, COUNT(r) as count WHERE count = size($neodash_ingredient_name) WITH r MATCH (r)-[in:IN]-(i:Ingredient) WHERE NOT i.name in $neodash_ingredient_name RETURN i.name, COUNT(r) ORDER BY COUNT(r) DESC
  • 37. © 2022 Neo4j, Inc. All rights reserved. Wrapping up We will continue working on this dataset on October 26, at NODES 2023! The recipe dataset will be published around this time. Want to try out NeoDash in the meantime? Visit https://neodash-gallery.graphapp.io for public demo dashboards.