SlideShare a Scribd company logo
1 of 74
Download to read offline
In a League of their Own:
Neo4j and Premiership Football
Mark Needham
@markhneedham
•
•
•
•
•
•

Intro to graphs
When do we need a graph?
Property graph model
Neo4j’s query language
The football graph
Using Neo4j from .NET

Outline
Let’s talk graphs
Dancing With
Michael Jackson

Eating Brains

You mean these?
Dancing With
Michael Jackson

Eating Brains

Nope!
Node

Relationship

Ok so what’s a graph then?
The tube
The social network (graph)
Complexity
What are graphs good for?
complexity = f(size, semi-structure, connectedness)

Data Complexity
Size
complexity = f(size

, semi-structure, connectedness)

The Real Complexity
Semi-Structure
USER_ID

FIRST_NAME

LAST_NAME

EMAIL_1

EMAIL_2

FACEBOOK

315

Mark

Needham

mark.needham@neotech
nology.com

m.h.needham@gmail.com

NULL

Email: mark.needham@neotechnology.com
Email: m.h.needham@gmail.com
Twitter: @markhneedham
Skype: mk_jnr1984

TWITTER
@markhneedham

CONTACT

USER

Semi-Structure

CONTACT_TYPE

SKYPE
mk_jnr1984
complexity = f(size

, semi-structure, connectedness)

The Real Complexity
Connectedness
Connectedness
Connectedness
Densely Connected

Semi Structured

When do we need a graph?
Lots of join tables
Densely connected?
Lots of sparse
tables
Semi-Structured?
• Millions of ‘joins’ per second
• Consistent query times as dataset
grows
• Join Complexity and Performance
• Easy to evolve data model
• Easy to ‘layer’ different types of
data together

Properties of graph databases
Property Graph Data Model
Nodes
• Used to represent entity attributes and/or metadata
(e.g. timestamps, version)
• Key-value pairs
• Java primitives
• Arrays
• null is not a valid value
• Every node can have different properties

Nodes can have properties
What’s a node?
Relationships
• Relationships are first class citizens
• Every relationship has a name and a direction
– Add structure to the graph
– Provide semantic context for nodes

• Properties used to represent quality or weight
of relationship, or metadata
• Every relationship must have a start node and
end node

Relationships
Nodes can be connected by
more than one relationship

Nodes can have more
than one relationship
Self relationships are allowed

Relationships
Labels
Think Gmail labels
• Nodes
– Entities

• Relationships
– Connect entities and structure domain

• Properties
– Entity attributes, relationship qualities, and
metadata

• Labels
– Group nodes by role

Four Building Blocks
Purposeful abstraction of a domain designed to
satisfy particular application/end-user goals

Models
Model
Query

Design for Queryability
Model

Design for Queryability
Model
Query

Design for Queryability
• Declarative Pattern-Matching language
• SQL-like syntax
• Designed for graphs

Introducing Cypher
A

B

C

Patterns, patterns, everywhere
a

b

(a) --> (b)
It’s all about the ASCII art!
MATCH (a)-->(b)
RETURN a, b

a

b

The most basic query
a

ACTED IN

m

(a)–[:ACTED_IN]->(m)
Adding in a relationship type
MATCH (a)-[:ACTED_IN]->(m)
RETURN a.name, m.name

a

ACTED IN

m

Adding in a relationship type
The football graph
The football graph
Find Arsenal’s away matches
Find Arsenal’s away matches
MATCH (team:Team)<-[:away_team]-(game)
WHERE team.name = "Arsenal"
RETURN game

Find Arsenal’s away matches
MATCH (team:Team)<-[:away_team]-(game)
WHERE team.name = "Arsenal"
RETURN game.name

Graph Pattern
MATCH (team:Team)<-[:away_team]-(game)
WHERE team.name = "Arsenal"
RETURN game.name

Anchor pattern in graph
MATCH (team:Team)<-[:away_team]-(game)
WHERE team.name = "Arsenal"
RETURN game.name

Create projection of results
Find Arsenal’s away matches
Evolving the football graph
Find the top away goal scorers
MATCH (team)<-[:away_team]-(game:Game),

(game)<-[:contains_match]-(season:Season),
(team)<-[:for]-(stats)<-[:played]-(player),
(stats)-[:in]->(game)
WHERE season.name = "2012-2013"
RETURN player.name,
COLLECT(DISTINCT team.name),
SUM(stats.goals) as goals
ORDER BY goals DESC
LIMIT 10

Find the top away goal scorers
MATCH (team)<-[:away_team]-(game:Game),

(game)<-[:contains_match]-(season:Season),
(team)<-[:for]-(stats)<-[:played]-(player),
(stats)-[:in]->(game)
WHERE season.name = "2012-2013"
RETURN player.name,
COLLECT(DISTINCT team.name),
SUM(stats.goals) as goals
ORDER BY goals DESC
LIMIT 10

Multiple graph patterns
MATCH (team)<-[:away_team]-(game:Game),

(game)<-[:contains_match]-(season:Season),
(team)<-[:for]-(stats)<-[:played]-(player),
(stats)-[:in]->(game)
WHERE season.name = "2012-2013"
RETURN player.name,
COLLECT(DISTINCT team.name),
SUM(stats.goals) as goals
ORDER BY goals DESC
LIMIT 10

Anchor pattern in the graph
MATCH (team)<-[:away_team]-(game:Game),

(game)<-[:contains_match]-(season:Season),
(team)<-[:for]-(stats)<-[:played]-(player),
(stats)-[:in]->(game)
WHERE season.name = "2012-2013"
RETURN player.name,
COLLECT(DISTINCT team.name),
SUM(stats.goals) as goals
ORDER BY goals DESC
LIMIT 10

Group by player
Find the top away goal scorers
• Goals scored in each month by
Michu
• Tottenham results when Gareth Bale
scores
• What did Wayne Rooney do in April?
• Which players only score when a
game is televised?

Other football queries
Graph Query Design
The relational version
Relational

Graphs

Tables

Nodes
- no need to set a property if it

- assume records all have the
same structure

doesn’t exist

Foreign keys between tables Relationships
- joins calculated at run time
- stored as a ‘Pre-computed
- the more tables you join to a
query the slower the query gets

index’ at write time
- very easy to do lots of ‘hops’
between relationships

Graph vs Relational
Neo4j Server

Application
H
T
T
P
REST Client

.NET and Neo4j
Neo4j Server

Application
H
T
T
P

Neo4jClient
REST Client

.NET and Neo4j
.NET and Neo4j
.NET and Neo4j
.NET and Neo4j
.NET and Neo4j
.NET and Neo4j
Thinking in graphs
Graphs should be fun!
Last Wednesday of the month

Ask for help if you get stuck
www.graphdatabases.com

Come take a copy, it’s free!
Mark Needham
@markhneedham
mark.needham@neotechnology.com

Questions?

More Related Content

What's hot

AI Restart 2024: Roman Číhalík - Jsou stále informace údajem o reálném dění o...
AI Restart 2024: Roman Číhalík - Jsou stále informace údajem o reálném dění o...AI Restart 2024: Roman Číhalík - Jsou stále informace údajem o reálném dění o...
AI Restart 2024: Roman Číhalík - Jsou stále informace údajem o reálném dění o...Taste
 
Depression Detection Based On Title Of Video
Depression Detection Based On Title Of VideoDepression Detection Based On Title Of Video
Depression Detection Based On Title Of VideoIJSRED
 
AI Restart 2024: Lukáš Benzl - Keynote: AI v roce 2024? Myslete globálně, jed...
AI Restart 2024: Lukáš Benzl - Keynote: AI v roce 2024? Myslete globálně, jed...AI Restart 2024: Lukáš Benzl - Keynote: AI v roce 2024? Myslete globálně, jed...
AI Restart 2024: Lukáš Benzl - Keynote: AI v roce 2024? Myslete globálně, jed...Taste
 
Deepfakes: Trick or Treat?
Deepfakes: Trick or Treat?Deepfakes: Trick or Treat?
Deepfakes: Trick or Treat?Ian McCarthy
 
AI Restart 2024: Lukáš Kostka - Automatizace analýzy klíčových slov aneb změn...
AI Restart 2024: Lukáš Kostka - Automatizace analýzy klíčových slov aneb změn...AI Restart 2024: Lukáš Kostka - Automatizace analýzy klíčových slov aneb změn...
AI Restart 2024: Lukáš Kostka - Automatizace analýzy klíčových slov aneb změn...Taste
 
AI in Healthcare a hands on workshop resource
AI in Healthcare a hands on workshop resourceAI in Healthcare a hands on workshop resource
AI in Healthcare a hands on workshop resourceVaikunthan Rajaratnam
 
AI Restart 2024: José Kadlec - Megapraktické využití AI v LinkedIn brandingu
AI Restart 2024: José Kadlec - Megapraktické využití AI v LinkedIn brandinguAI Restart 2024: José Kadlec - Megapraktické využití AI v LinkedIn brandingu
AI Restart 2024: José Kadlec - Megapraktické využití AI v LinkedIn brandinguTaste
 
Ethics for Conversational AI
Ethics for Conversational AIEthics for Conversational AI
Ethics for Conversational AIVerena Rieser
 
Ihc2016.2 aula 3 introdução ao design de interação
Ihc2016.2 aula 3   introdução ao design de interaçãoIhc2016.2 aula 3   introdução ao design de interação
Ihc2016.2 aula 3 introdução ao design de interaçãoTicianne Darin
 
Generative Design and Design Hacking
Generative Design and Design HackingGenerative Design and Design Hacking
Generative Design and Design HackingDesignit
 
ai-powered-marketing-and-sales-reach-new-heights-with-generative-ai.pdf
ai-powered-marketing-and-sales-reach-new-heights-with-generative-ai.pdfai-powered-marketing-and-sales-reach-new-heights-with-generative-ai.pdf
ai-powered-marketing-and-sales-reach-new-heights-with-generative-ai.pdfjason668539
 
Explainability for Natural Language Processing
Explainability for Natural Language ProcessingExplainability for Natural Language Processing
Explainability for Natural Language ProcessingYunyao Li
 
AI Restart 2024: Vojtěch Dlouhý - Automatizace komunikace za pomoci konverzač...
AI Restart 2024: Vojtěch Dlouhý - Automatizace komunikace za pomoci konverzač...AI Restart 2024: Vojtěch Dlouhý - Automatizace komunikace za pomoci konverzač...
AI Restart 2024: Vojtěch Dlouhý - Automatizace komunikace za pomoci konverzač...Taste
 

What's hot (14)

AI Restart 2024: Roman Číhalík - Jsou stále informace údajem o reálném dění o...
AI Restart 2024: Roman Číhalík - Jsou stále informace údajem o reálném dění o...AI Restart 2024: Roman Číhalík - Jsou stále informace údajem o reálném dění o...
AI Restart 2024: Roman Číhalík - Jsou stále informace údajem o reálném dění o...
 
Depression Detection Based On Title Of Video
Depression Detection Based On Title Of VideoDepression Detection Based On Title Of Video
Depression Detection Based On Title Of Video
 
AI Restart 2024: Lukáš Benzl - Keynote: AI v roce 2024? Myslete globálně, jed...
AI Restart 2024: Lukáš Benzl - Keynote: AI v roce 2024? Myslete globálně, jed...AI Restart 2024: Lukáš Benzl - Keynote: AI v roce 2024? Myslete globálně, jed...
AI Restart 2024: Lukáš Benzl - Keynote: AI v roce 2024? Myslete globálně, jed...
 
Deepfakes: Trick or Treat?
Deepfakes: Trick or Treat?Deepfakes: Trick or Treat?
Deepfakes: Trick or Treat?
 
AI Restart 2024: Lukáš Kostka - Automatizace analýzy klíčových slov aneb změn...
AI Restart 2024: Lukáš Kostka - Automatizace analýzy klíčových slov aneb změn...AI Restart 2024: Lukáš Kostka - Automatizace analýzy klíčových slov aneb změn...
AI Restart 2024: Lukáš Kostka - Automatizace analýzy klíčových slov aneb změn...
 
AI in Healthcare a hands on workshop resource
AI in Healthcare a hands on workshop resourceAI in Healthcare a hands on workshop resource
AI in Healthcare a hands on workshop resource
 
AI Restart 2024: José Kadlec - Megapraktické využití AI v LinkedIn brandingu
AI Restart 2024: José Kadlec - Megapraktické využití AI v LinkedIn brandinguAI Restart 2024: José Kadlec - Megapraktické využití AI v LinkedIn brandingu
AI Restart 2024: José Kadlec - Megapraktické využití AI v LinkedIn brandingu
 
Ethics for Conversational AI
Ethics for Conversational AIEthics for Conversational AI
Ethics for Conversational AI
 
Ihc2016.2 aula 3 introdução ao design de interação
Ihc2016.2 aula 3   introdução ao design de interaçãoIhc2016.2 aula 3   introdução ao design de interação
Ihc2016.2 aula 3 introdução ao design de interação
 
Generative Design and Design Hacking
Generative Design and Design HackingGenerative Design and Design Hacking
Generative Design and Design Hacking
 
typography
 typography typography
typography
 
ai-powered-marketing-and-sales-reach-new-heights-with-generative-ai.pdf
ai-powered-marketing-and-sales-reach-new-heights-with-generative-ai.pdfai-powered-marketing-and-sales-reach-new-heights-with-generative-ai.pdf
ai-powered-marketing-and-sales-reach-new-heights-with-generative-ai.pdf
 
Explainability for Natural Language Processing
Explainability for Natural Language ProcessingExplainability for Natural Language Processing
Explainability for Natural Language Processing
 
AI Restart 2024: Vojtěch Dlouhý - Automatizace komunikace za pomoci konverzač...
AI Restart 2024: Vojtěch Dlouhý - Automatizace komunikace za pomoci konverzač...AI Restart 2024: Vojtěch Dlouhý - Automatizace komunikace za pomoci konverzač...
AI Restart 2024: Vojtěch Dlouhý - Automatizace komunikace za pomoci konverzač...
 

Viewers also liked

Global BRT (Bus Rapid Transit ) Market
Global BRT (Bus Rapid Transit ) MarketGlobal BRT (Bus Rapid Transit ) Market
Global BRT (Bus Rapid Transit ) MarketSandeep Kar
 
Philippines provincial bus industry
Philippines provincial bus industryPhilippines provincial bus industry
Philippines provincial bus industryDeepak Mitra
 
Global Hybrid and Electric Transit Bus Market
Global Hybrid and Electric Transit Bus MarketGlobal Hybrid and Electric Transit Bus Market
Global Hybrid and Electric Transit Bus MarketSandeep Kar
 
The #StartupStack
The #StartupStackThe #StartupStack
The #StartupStackStripe
 
Tata International business mgt
Tata   International business mgtTata   International business mgt
Tata International business mgtJoel Pais
 
Tata motors - International Business Project Report
Tata motors - International Business Project ReportTata motors - International Business Project Report
Tata motors - International Business Project ReportPrathamesh Gawane
 
INTERNATIONAL MARKETING OF TATA MOTORS
INTERNATIONAL MARKETING OF TATA MOTORSINTERNATIONAL MARKETING OF TATA MOTORS
INTERNATIONAL MARKETING OF TATA MOTORSJiten Menghani
 
A project report on Competitor analysis of_tata_motors
A project report on Competitor analysis of_tata_motorsA project report on Competitor analysis of_tata_motors
A project report on Competitor analysis of_tata_motorsMba projects free
 
How Steve Jobs Would Disrupt The Truck & Bus Industry
How Steve Jobs Would Disrupt The Truck & Bus IndustryHow Steve Jobs Would Disrupt The Truck & Bus Industry
How Steve Jobs Would Disrupt The Truck & Bus IndustryJohan Ronnestam
 

Viewers also liked (12)

Global BRT (Bus Rapid Transit ) Market
Global BRT (Bus Rapid Transit ) MarketGlobal BRT (Bus Rapid Transit ) Market
Global BRT (Bus Rapid Transit ) Market
 
Philippines provincial bus industry
Philippines provincial bus industryPhilippines provincial bus industry
Philippines provincial bus industry
 
Global Hybrid and Electric Transit Bus Market
Global Hybrid and Electric Transit Bus MarketGlobal Hybrid and Electric Transit Bus Market
Global Hybrid and Electric Transit Bus Market
 
The #StartupStack
The #StartupStackThe #StartupStack
The #StartupStack
 
Anmol
AnmolAnmol
Anmol
 
Tata International business mgt
Tata   International business mgtTata   International business mgt
Tata International business mgt
 
Globalization of TATA Motors
Globalization of TATA MotorsGlobalization of TATA Motors
Globalization of TATA Motors
 
Tata motors - International Business Project Report
Tata motors - International Business Project ReportTata motors - International Business Project Report
Tata motors - International Business Project Report
 
INTERNATIONAL MARKETING OF TATA MOTORS
INTERNATIONAL MARKETING OF TATA MOTORSINTERNATIONAL MARKETING OF TATA MOTORS
INTERNATIONAL MARKETING OF TATA MOTORS
 
A project report on Competitor analysis of_tata_motors
A project report on Competitor analysis of_tata_motorsA project report on Competitor analysis of_tata_motors
A project report on Competitor analysis of_tata_motors
 
How Steve Jobs Would Disrupt The Truck & Bus Industry
How Steve Jobs Would Disrupt The Truck & Bus IndustryHow Steve Jobs Would Disrupt The Truck & Bus Industry
How Steve Jobs Would Disrupt The Truck & Bus Industry
 
Tyre Industry Analysis
Tyre Industry AnalysisTyre Industry Analysis
Tyre Industry Analysis
 

Similar to Football graph - Neo4j and the Premier League

The Football Graph - Neo4j and the Premier League
The Football Graph - Neo4j and the Premier LeagueThe Football Graph - Neo4j and the Premier League
The Football Graph - Neo4j and the Premier LeagueMark Needham
 
The 2nd graph database in sv meetup
The 2nd graph database in sv meetupThe 2nd graph database in sv meetup
The 2nd graph database in sv meetupJoshua Bae
 
Introduction to SQL Server Graph DB
Introduction to SQL Server Graph DBIntroduction to SQL Server Graph DB
Introduction to SQL Server Graph DBGreg McMurray
 
Graph Search: The Power of Connected Data
Graph Search: The Power of Connected DataGraph Search: The Power of Connected Data
Graph Search: The Power of Connected DataCodemotion
 
Tactical data engineering
Tactical data engineeringTactical data engineering
Tactical data engineeringJulian Hyde
 
Graph db - Pramati Technologies [Meetup]
Graph db - Pramati Technologies [Meetup]Graph db - Pramati Technologies [Meetup]
Graph db - Pramati Technologies [Meetup]Pramati Technologies
 
managing big data
managing big datamanaging big data
managing big dataSuveeksha
 
Neo4j Graph Database และการประยุกตร์ใช้
Neo4j Graph Database และการประยุกตร์ใช้Neo4j Graph Database และการประยุกตร์ใช้
Neo4j Graph Database และการประยุกตร์ใช้Chakrit Phain
 
Introduction to Bootstrap: Design for Developers
Introduction to Bootstrap: Design for DevelopersIntroduction to Bootstrap: Design for Developers
Introduction to Bootstrap: Design for DevelopersMelvin John
 
Designing and Building a Graph Database Application - Ian Robinson (Neo Techn...
Designing and Building a Graph Database Application - Ian Robinson (Neo Techn...Designing and Building a Graph Database Application - Ian Robinson (Neo Techn...
Designing and Building a Graph Database Application - Ian Robinson (Neo Techn...jaxLondonConference
 
Data Modeling with Neo4j
Data Modeling with Neo4jData Modeling with Neo4j
Data Modeling with Neo4jNeo4j
 
Graph Features in Spark 3.0: Integrating Graph Querying and Algorithms in Spa...
Graph Features in Spark 3.0: Integrating Graph Querying and Algorithms in Spa...Graph Features in Spark 3.0: Integrating Graph Querying and Algorithms in Spa...
Graph Features in Spark 3.0: Integrating Graph Querying and Algorithms in Spa...Databricks
 
Designing and Building a Graph Database Application – Architectural Choices, ...
Designing and Building a Graph Database Application – Architectural Choices, ...Designing and Building a Graph Database Application – Architectural Choices, ...
Designing and Building a Graph Database Application – Architectural Choices, ...Neo4j
 
Introduction to Graphs with Neo4j
Introduction to Graphs with Neo4jIntroduction to Graphs with Neo4j
Introduction to Graphs with Neo4jNeo4j
 
The openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query LanguageThe openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query LanguageNeo4j
 
Optimizing Cypher Queries in Neo4j
Optimizing Cypher Queries in Neo4jOptimizing Cypher Queries in Neo4j
Optimizing Cypher Queries in Neo4jNeo4j
 
Graphs fun vjug2
Graphs fun vjug2Graphs fun vjug2
Graphs fun vjug2Neo4j
 

Similar to Football graph - Neo4j and the Premier League (20)

The Football Graph - Neo4j and the Premier League
The Football Graph - Neo4j and the Premier LeagueThe Football Graph - Neo4j and the Premier League
The Football Graph - Neo4j and the Premier League
 
The 2nd graph database in sv meetup
The 2nd graph database in sv meetupThe 2nd graph database in sv meetup
The 2nd graph database in sv meetup
 
Introduction to SQL Server Graph DB
Introduction to SQL Server Graph DBIntroduction to SQL Server Graph DB
Introduction to SQL Server Graph DB
 
Graph Search: The Power of Connected Data
Graph Search: The Power of Connected DataGraph Search: The Power of Connected Data
Graph Search: The Power of Connected Data
 
Tactical data engineering
Tactical data engineeringTactical data engineering
Tactical data engineering
 
Graph db - Pramati Technologies [Meetup]
Graph db - Pramati Technologies [Meetup]Graph db - Pramati Technologies [Meetup]
Graph db - Pramati Technologies [Meetup]
 
managing big data
managing big datamanaging big data
managing big data
 
Neo4j Graph Database และการประยุกตร์ใช้
Neo4j Graph Database และการประยุกตร์ใช้Neo4j Graph Database และการประยุกตร์ใช้
Neo4j Graph Database และการประยุกตร์ใช้
 
Introduction to Bootstrap: Design for Developers
Introduction to Bootstrap: Design for DevelopersIntroduction to Bootstrap: Design for Developers
Introduction to Bootstrap: Design for Developers
 
Designing and Building a Graph Database Application - Ian Robinson (Neo Techn...
Designing and Building a Graph Database Application - Ian Robinson (Neo Techn...Designing and Building a Graph Database Application - Ian Robinson (Neo Techn...
Designing and Building a Graph Database Application - Ian Robinson (Neo Techn...
 
Data Modeling with Neo4j
Data Modeling with Neo4jData Modeling with Neo4j
Data Modeling with Neo4j
 
Intro to Cypher
Intro to CypherIntro to Cypher
Intro to Cypher
 
Cypher
CypherCypher
Cypher
 
Graph Features in Spark 3.0: Integrating Graph Querying and Algorithms in Spa...
Graph Features in Spark 3.0: Integrating Graph Querying and Algorithms in Spa...Graph Features in Spark 3.0: Integrating Graph Querying and Algorithms in Spa...
Graph Features in Spark 3.0: Integrating Graph Querying and Algorithms in Spa...
 
Designing and Building a Graph Database Application – Architectural Choices, ...
Designing and Building a Graph Database Application – Architectural Choices, ...Designing and Building a Graph Database Application – Architectural Choices, ...
Designing and Building a Graph Database Application – Architectural Choices, ...
 
Introduction to Graphs with Neo4j
Introduction to Graphs with Neo4jIntroduction to Graphs with Neo4j
Introduction to Graphs with Neo4j
 
The openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query LanguageThe openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query Language
 
Optimizing Cypher Queries in Neo4j
Optimizing Cypher Queries in Neo4jOptimizing Cypher Queries in Neo4j
Optimizing Cypher Queries in Neo4j
 
GDM 2011 Talk
GDM 2011 TalkGDM 2011 Talk
GDM 2011 Talk
 
Graphs fun vjug2
Graphs fun vjug2Graphs fun vjug2
Graphs fun vjug2
 

More from Mark Needham

Neo4j GraphTour: Utilizing Powerful Extensions for Analytics and Operations
Neo4j GraphTour: Utilizing Powerful Extensions for Analytics and OperationsNeo4j GraphTour: Utilizing Powerful Extensions for Analytics and Operations
Neo4j GraphTour: Utilizing Powerful Extensions for Analytics and OperationsMark Needham
 
This week in Neo4j - 3rd February 2018
This week in Neo4j - 3rd February 2018This week in Neo4j - 3rd February 2018
This week in Neo4j - 3rd February 2018Mark Needham
 
Building a recommendation engine with python and neo4j
Building a recommendation engine with python and neo4jBuilding a recommendation engine with python and neo4j
Building a recommendation engine with python and neo4jMark Needham
 
Graph Connect: Tuning Cypher
Graph Connect: Tuning CypherGraph Connect: Tuning Cypher
Graph Connect: Tuning CypherMark Needham
 
Graph Connect: Importing data quickly and easily
Graph Connect: Importing data quickly and easilyGraph Connect: Importing data quickly and easily
Graph Connect: Importing data quickly and easilyMark Needham
 
Graph Connect Europe: From Zero To Import
Graph Connect Europe: From Zero To ImportGraph Connect Europe: From Zero To Import
Graph Connect Europe: From Zero To ImportMark Needham
 
Optimizing cypher queries in neo4j
Optimizing cypher queries in neo4jOptimizing cypher queries in neo4j
Optimizing cypher queries in neo4jMark Needham
 
Scala: An experience report
Scala: An experience reportScala: An experience report
Scala: An experience reportMark Needham
 
Mixing functional programming approaches in an object oriented language
Mixing functional programming approaches in an object oriented languageMixing functional programming approaches in an object oriented language
Mixing functional programming approaches in an object oriented languageMark Needham
 
Mixing functional and object oriented approaches to programming in C#
Mixing functional and object oriented approaches to programming in C#Mixing functional and object oriented approaches to programming in C#
Mixing functional and object oriented approaches to programming in C#Mark Needham
 
Mixing functional and object oriented approaches to programming in C#
Mixing functional and object oriented approaches to programming in C#Mixing functional and object oriented approaches to programming in C#
Mixing functional and object oriented approaches to programming in C#Mark Needham
 
F#: What I've learnt so far
F#: What I've learnt so farF#: What I've learnt so far
F#: What I've learnt so farMark Needham
 

More from Mark Needham (13)

Neo4j GraphTour: Utilizing Powerful Extensions for Analytics and Operations
Neo4j GraphTour: Utilizing Powerful Extensions for Analytics and OperationsNeo4j GraphTour: Utilizing Powerful Extensions for Analytics and Operations
Neo4j GraphTour: Utilizing Powerful Extensions for Analytics and Operations
 
This week in Neo4j - 3rd February 2018
This week in Neo4j - 3rd February 2018This week in Neo4j - 3rd February 2018
This week in Neo4j - 3rd February 2018
 
Building a recommendation engine with python and neo4j
Building a recommendation engine with python and neo4jBuilding a recommendation engine with python and neo4j
Building a recommendation engine with python and neo4j
 
Graph Connect: Tuning Cypher
Graph Connect: Tuning CypherGraph Connect: Tuning Cypher
Graph Connect: Tuning Cypher
 
Graph Connect: Importing data quickly and easily
Graph Connect: Importing data quickly and easilyGraph Connect: Importing data quickly and easily
Graph Connect: Importing data quickly and easily
 
Graph Connect Europe: From Zero To Import
Graph Connect Europe: From Zero To ImportGraph Connect Europe: From Zero To Import
Graph Connect Europe: From Zero To Import
 
Optimizing cypher queries in neo4j
Optimizing cypher queries in neo4jOptimizing cypher queries in neo4j
Optimizing cypher queries in neo4j
 
Scala: An experience report
Scala: An experience reportScala: An experience report
Scala: An experience report
 
Visualisations
VisualisationsVisualisations
Visualisations
 
Mixing functional programming approaches in an object oriented language
Mixing functional programming approaches in an object oriented languageMixing functional programming approaches in an object oriented language
Mixing functional programming approaches in an object oriented language
 
Mixing functional and object oriented approaches to programming in C#
Mixing functional and object oriented approaches to programming in C#Mixing functional and object oriented approaches to programming in C#
Mixing functional and object oriented approaches to programming in C#
 
Mixing functional and object oriented approaches to programming in C#
Mixing functional and object oriented approaches to programming in C#Mixing functional and object oriented approaches to programming in C#
Mixing functional and object oriented approaches to programming in C#
 
F#: What I've learnt so far
F#: What I've learnt so farF#: What I've learnt so far
F#: What I've learnt so far
 

Recently uploaded

Euro 2024 Serbia's Return to the European Championship.docx
Euro 2024 Serbia's Return to the European Championship.docxEuro 2024 Serbia's Return to the European Championship.docx
Euro 2024 Serbia's Return to the European Championship.docxEticketing.co
 
IPL 2024 Fixture List Match Dates, Participating Teams, Stadiums, Venues, and...
IPL 2024 Fixture List Match Dates, Participating Teams, Stadiums, Venues, and...IPL 2024 Fixture List Match Dates, Participating Teams, Stadiums, Venues, and...
IPL 2024 Fixture List Match Dates, Participating Teams, Stadiums, Venues, and...Sportsnewstec24
 
TheOrmaxSportsAudienceReport2024-MediaHighlights.pdf
TheOrmaxSportsAudienceReport2024-MediaHighlights.pdfTheOrmaxSportsAudienceReport2024-MediaHighlights.pdf
TheOrmaxSportsAudienceReport2024-MediaHighlights.pdfSocial Samosa
 
Kobe Bryant, The story of the "Black Mamba"
Kobe Bryant, The story of the "Black Mamba"Kobe Bryant, The story of the "Black Mamba"
Kobe Bryant, The story of the "Black Mamba"bmfcavalchini
 
Changing mindsets, rebuilding lives: Celebrating 25 years of First World Cup ...
Changing mindsets, rebuilding lives: Celebrating 25 years of First World Cup ...Changing mindsets, rebuilding lives: Celebrating 25 years of First World Cup ...
Changing mindsets, rebuilding lives: Celebrating 25 years of First World Cup ...mxmindia
 
Changing mindsets, rebuilding lives: Celebrating 25 years of First World Cup ...
Changing mindsets, rebuilding lives: Celebrating 25 years of First World Cup ...Changing mindsets, rebuilding lives: Celebrating 25 years of First World Cup ...
Changing mindsets, rebuilding lives: Celebrating 25 years of First World Cup ...mxmindia
 
Instruction Manual | Nightforce CFS 6-36x50 F1 | Optics Trade
Instruction Manual | Nightforce CFS 6-36x50 F1 | Optics TradeInstruction Manual | Nightforce CFS 6-36x50 F1 | Optics Trade
Instruction Manual | Nightforce CFS 6-36x50 F1 | Optics TradeOptics-Trade
 
Nicholas Kodomichalos: A Tale of Sporting Brilliance with Nick Kodos
Nicholas Kodomichalos: A Tale of Sporting Brilliance with Nick KodosNicholas Kodomichalos: A Tale of Sporting Brilliance with Nick Kodos
Nicholas Kodomichalos: A Tale of Sporting Brilliance with Nick KodosNicholasKodomichalos1
 
NCAA Tournament Free Pick, March 22 From Top March Madness Sports Handicapper
NCAA Tournament Free Pick, March 22 From  Top March Madness Sports HandicapperNCAA Tournament Free Pick, March 22 From  Top March Madness Sports Handicapper
NCAA Tournament Free Pick, March 22 From Top March Madness Sports HandicapperJoe Duffy
 

Recently uploaded (9)

Euro 2024 Serbia's Return to the European Championship.docx
Euro 2024 Serbia's Return to the European Championship.docxEuro 2024 Serbia's Return to the European Championship.docx
Euro 2024 Serbia's Return to the European Championship.docx
 
IPL 2024 Fixture List Match Dates, Participating Teams, Stadiums, Venues, and...
IPL 2024 Fixture List Match Dates, Participating Teams, Stadiums, Venues, and...IPL 2024 Fixture List Match Dates, Participating Teams, Stadiums, Venues, and...
IPL 2024 Fixture List Match Dates, Participating Teams, Stadiums, Venues, and...
 
TheOrmaxSportsAudienceReport2024-MediaHighlights.pdf
TheOrmaxSportsAudienceReport2024-MediaHighlights.pdfTheOrmaxSportsAudienceReport2024-MediaHighlights.pdf
TheOrmaxSportsAudienceReport2024-MediaHighlights.pdf
 
Kobe Bryant, The story of the "Black Mamba"
Kobe Bryant, The story of the "Black Mamba"Kobe Bryant, The story of the "Black Mamba"
Kobe Bryant, The story of the "Black Mamba"
 
Changing mindsets, rebuilding lives: Celebrating 25 years of First World Cup ...
Changing mindsets, rebuilding lives: Celebrating 25 years of First World Cup ...Changing mindsets, rebuilding lives: Celebrating 25 years of First World Cup ...
Changing mindsets, rebuilding lives: Celebrating 25 years of First World Cup ...
 
Changing mindsets, rebuilding lives: Celebrating 25 years of First World Cup ...
Changing mindsets, rebuilding lives: Celebrating 25 years of First World Cup ...Changing mindsets, rebuilding lives: Celebrating 25 years of First World Cup ...
Changing mindsets, rebuilding lives: Celebrating 25 years of First World Cup ...
 
Instruction Manual | Nightforce CFS 6-36x50 F1 | Optics Trade
Instruction Manual | Nightforce CFS 6-36x50 F1 | Optics TradeInstruction Manual | Nightforce CFS 6-36x50 F1 | Optics Trade
Instruction Manual | Nightforce CFS 6-36x50 F1 | Optics Trade
 
Nicholas Kodomichalos: A Tale of Sporting Brilliance with Nick Kodos
Nicholas Kodomichalos: A Tale of Sporting Brilliance with Nick KodosNicholas Kodomichalos: A Tale of Sporting Brilliance with Nick Kodos
Nicholas Kodomichalos: A Tale of Sporting Brilliance with Nick Kodos
 
NCAA Tournament Free Pick, March 22 From Top March Madness Sports Handicapper
NCAA Tournament Free Pick, March 22 From  Top March Madness Sports HandicapperNCAA Tournament Free Pick, March 22 From  Top March Madness Sports Handicapper
NCAA Tournament Free Pick, March 22 From Top March Madness Sports Handicapper
 

Football graph - Neo4j and the Premier League

Editor's Notes

  1. In this talk, we&apos;ll look at how graph data and Neo4j can be used to model the English Premier League. We&apos;ll see how the graph model and Cypher query language makes it natural and fun to query multidimensional semi-structured data. We&apos;ll also see how graphs encourage discoverability so that we can spot interesting correlations and become king of the arcane football facts (e.g. how many goals have been scored at grounds in the North West of England by players originating from South America) at your local pub quiz. We&apos;ll also see what the graph model would look like if modeled in a relational way and show where the approach reaches its limits and the graph addresses and resolves those challenges.
  2. Let’s get started and talk about graphs. Now in this context we’re thinking more of what are sometimes known as networks and…
  3. …many people when they hear the word graph think of this.
  4. Which isn’t what we’re going to be talking about today!
  5. It’s not a new thing, you’ll already be familiar with lots of things that are graphs but perhaps you don’t know it yet. The London tube is perhaps the most famous example that Londoners at least use every day
  6. It’s not a new thing, you’ll already be familiar with lots of things that are graphs but perhaps you don’t know it yet. The London tube is perhaps the most famous example that Londoners at least use every day
  7. Or if not then you’ve certainly heard of the social network (graph)
  8. An organisational hierarchy is a common model
  9. An organisational hierarchy is a common model
  10. Or of course as we mentioned earlier, a social network of friends of friends and so on is a popular graph
  11. Null values all over the place
  12. Now, as I say, graph databases allow you to store, manage and query your data as a graph. Neo4j adopts a very particular graph model, which we call the property graph model.So I’m going to spend the next few minutes talking about the important aspects of this model in more detail.In fact, I’m going to talk about the enhanced property graph model, which will be available in Neo4j 2.0 sometime later this year.
  13. Pointer in memory and ultimately on disk
  14. Analogy: Gmail labels. Every mail can have zero or more labels attached. Allow you to associate filters with groups of emails.
  15. Always motivated by needs, problems, goals: not transparent window onto realityC18: Seven Bridges of KönigsbergGoal: Find path through the city that crosses each bridge once and once only
  16. Which leads us perfectly into neo4j’s query language
  17. Football is quite a nice domain for
  18. Football is quite a nice domain for modelling in graphs because the data has a lot of dimensions to it
  19. Football is quite a nice domain for
  20. Football is quite a nice domain for
  21. Football is quite a nice domain for
  22. Football is quite a nice domain for
  23. Football is quite a nice domain for
  24. Football is quite a nice domain for
  25. Football is quite a nice domain for
  26. Football is quite a nice domain for
  27. Football is quite a nice domain for
  28. Football is quite a nice domain for
  29. Football is quite a nice domain for
  30. Football is quite a nice domain for
  31. Football is quite a nice domain for
  32. Football is quite a nice domain for
  33. Football is quite a nice domain for
  34. -&gt; SQL - define your tables and relationships and generally don’t change that.Might denormalise or add indexes to speed up queries-&gt; Graphs – define your initial nodes and relationships. May then add ‘layers’ to the graph to make implicit relationships explicit
  35. Football is quite a nice domain for
  36. How is this different to a relational database? We have tables (nodes) and foreign keys between tables (relationships)Those are calculated at run time – in a graph a relationship is a first Class citizen. Effectively a pre-computed indexYou can also traverse lots of ‘hops’ which becomes quite expensive when You do
  37. If it’s not fun and It seems cumbersome then perhaps it’s the wrong tool for that particular data problem or it’s modeled in the wrong way. Might be worth asking
  38. Might be worth asking for help if that isn’t happening or you’re stuck. We have a good community on Stack Overflow and a mailing list as well. You’ll get answers to any questions you have pretty quickly.
  39. Please take a copy of t
  40. Might be worth asking for help if that isn’t happening or you’re stuck. We have a good community on Stack Overflow and a mailing list as well. You’ll get answers to any questions you have pretty quickly.