SlideShare a Scribd company logo
Virtual Graphs & Graph Views in Cypher
Sascha Peukert1, Hannes Voigt1, Michael Hunger2
1TU Dresden
2Neo Technology
22
Concept Chasm
 USERS TALK ABOUT…
! Application entities
! e.g. discussions, topics,
communities, etc.
! Likely multiple
abstraction levels
 BASE DATA CONTAINS…
! Fine granular data
! Low abstraction
! E.g. individual
twitter messages,
retweet relationships,
etc.
e.g. discussions, topics,
communities, etc.
Likely multiple
levels
CONTAINS
Fine granular data
Low abstraction
[Martin Grandjean, https://commons.wikimedia.org/wiki/File:Social_Network_Analysis_Visualization.png, 2014]
communities, etc.
levels
CONTAINS…
Fine granular data
Low abstraction [http://nodexlgraphgallery.org/Pages/Graph.aspx?graphID=70790]
Query
language
main means
to bridge
concept
chasm
Users talk in high level concepts ! Data captured in low level concepts
" Concept chasm
3
Base data
What do you need?
 1. LET USER CREATE ABSTRACT GRAPHS
! Nodes and relationships not present in the base data
but derived from base data
1
2
3
4
5
6 7
8
[:FRIENDS]
MATCH (p1)-[:FRIENDS]-(p2)-[:FRIENDS]-(p3)-[:FRIENDS]-(p1)
CREATE VIRTUAL (t:FriendsTriangle)-[:CONTAINS]->(p1),
(t)-[:CONTAINS]->(p2),
(t)-[:CONTAINS]->(p3)
MATCH (t1)-[:CONTAINS]->()<-[:CONTAINS]-(t2)
-[:CONTAINS]->()<-[:CONTAINS]-(t1)
CREATE VIRTUAL (t1)-[:CONNECTED]->(t2)
[:CONTAINS]
[:CONNECTED]
1
2 3
4
4
Base data
What do you need?
 1. LET USER CREATE ABSTRACT GRAPHS
! Nodes and relationships not present in the base data
but derived from base data
1
3
4
5
7
8
[:FRIENDS]
5
MATCH (p1)-[:FRIENDS]-(p2)-[:FRIENDS]-(p3)-[:FRIENDS]-(p1)
CREATE VIRTUAL (t:FriendsTriangle)-[:CONTAINS]->(p1),
(t)-[:CONTAINS]->(p2),
(t)-[:CONTAINS]->(p3)
MATCH (t1)-[:CONTAINS]->()<-[:CONTAINS]-(t2)
-[:CONTAINS]->()<-[:CONTAINS]-(t1)
CREATE VIRTUAL (t1)-[:CONNECTED]->(t2)
[:CONTAINS]
MATCH (pa)<-[:CONTAINS]-(ta),
tp=shortestPath((ta)-[:CONNECTED*]->(tb)),
(tb)-[:CONTAINS]->(pb)
RETURN pa, pb, length(tp)+1 AS triangleDist
pa pb triangleDist
2 6 3
! ! !
[:CONNECTED]
,
1
2 3
4
[:FRIENDS]
2
6
5
What do you need?
 2. LET USER MODULARIZE AND REUSE (SUB)-QUERIES WITH VIEWS
! Create view
! Use view
! Use multiple
views
IN VIEW friendsTriangles { MATCH (p)<-[:CONTAINS]-(t) }
RETURN p, count(t) AS numTriangles
ORDER BY numTriangles DESC LIMIT 10
CREATE VIEW friendsTriangles {
MATCH (p1)-[:FRIENDS]-(p2)-[:FRIENDS]-(p3)-[:FRIENDS]-(p1)
CREATE VIRTUAL (t:FriendsTriangle)-[e1:CONTAINS]->(p1),
(t)-[e2:CONTAINS]->(p2),
(t)-[e3:CONTAINS]->(p3)
SAVE t,e1,e2,e3,p1,p2,p3
}
IN VIEW friendsTriangles, connected, ALL { //ALL is base data
MATCH (t1)-[:CONTAINS]->(p)<-[:CONTAINS]-(t2)
-[:CONTAINS]->(q1)-[:KNOWS]-(q2)<-[:CONTAINS]-(t2)
WHERE NOT (t1)-[:CONNECTED]-(t2)
}
RETURN t1,t2,q1,q2
6
Summary
 VIEWS ARE AWESOME FOR
! Query modularization
! Reuse of query concepts
! Employing Need to Know for applications (fine-grained access control)
! Performance tuning (with materialized views)
 OUR CURRENT IMPLEMENTATION IN NEO4J
! Two specializations of the OperationsFacade for handling virtual entities and views
! VirtualEntitiesFacade create entities internally and discards them after end of transaction
! ViewFacade
- Keeps list of node and relationship id that are part of the view
- Filter queries on views are execution on base data for results that are part of the view
 GOAL: TRUE CYPHER QUERY REWRITE
grained access control)

More Related Content

PPTX
Data Visualization with graphviz
PPTX
Intro to hadoop ecosystem
PPT
Hive ICDE 2010
PDF
Telemetry doesn't have to be scary; Ben Ford
PDF
Ben ford intro
PDF
Poetry with R -- Dissecting the code
PPTX
An introduction to Hadoop for large scale data analysis
PDF
Software Analytics with Jupyter, Pandas, jQAssistant, and Neo4j [Neo4j Online...
Data Visualization with graphviz
Intro to hadoop ecosystem
Hive ICDE 2010
Telemetry doesn't have to be scary; Ben Ford
Ben ford intro
Poetry with R -- Dissecting the code
An introduction to Hadoop for large scale data analysis
Software Analytics with Jupyter, Pandas, jQAssistant, and Neo4j [Neo4j Online...

Similar to Virtual Graphs & Graph Views in Cypher (20)

PDF
Data Modeling with Neo4j
PDF
Jan Lehnardt Couch Db In A Real World Setting
PPT
Hadoop Hive Talk At IIT-Delhi
PPT
Hands on Mahout!
PDF
GitConnect
KEY
Visualising data: Seeing is Believing - CS Forum 2012
PDF
HBaseCon 2015: S2Graph - A Large-scale Graph Database with HBase
PDF
Language-agnostic data analysis workflows and reproducible research
PPTX
Natural Language Processing in R (rNLP)
PDF
R basics
PDF
Data Visualization in R (Graph, Trend, etc)
PPT
MiniGrid Project - UI
PPTX
Introduction to D3.js
PPT
Hive @ Hadoop day seattle_2010
PPT
Hive Training -- Motivations and Real World Use Cases
PPTX
Big Data Analytics 3: Machine Learning to Engage the Customer, with Apache Sp...
PDF
The Web Science MacroScope: Mixed-methods Approach for Understanding Web Acti...
PPTX
Where are yours vertexes and what are they talking about?
PDF
FScaFi: A Core Calculus for Collective Adaptive Systems Programming
PDF
Fast track to getting started with DSE Max @ ING
Data Modeling with Neo4j
Jan Lehnardt Couch Db In A Real World Setting
Hadoop Hive Talk At IIT-Delhi
Hands on Mahout!
GitConnect
Visualising data: Seeing is Believing - CS Forum 2012
HBaseCon 2015: S2Graph - A Large-scale Graph Database with HBase
Language-agnostic data analysis workflows and reproducible research
Natural Language Processing in R (rNLP)
R basics
Data Visualization in R (Graph, Trend, etc)
MiniGrid Project - UI
Introduction to D3.js
Hive @ Hadoop day seattle_2010
Hive Training -- Motivations and Real World Use Cases
Big Data Analytics 3: Machine Learning to Engage the Customer, with Apache Sp...
The Web Science MacroScope: Mixed-methods Approach for Understanding Web Acti...
Where are yours vertexes and what are they talking about?
FScaFi: A Core Calculus for Collective Adaptive Systems Programming
Fast track to getting started with DSE Max @ ING
Ad

More from openCypher (20)

PDF
Learning Timed Automata with Cypher
PDF
Incremental View Maintenance for openCypher Queries
PDF
Formal semantics for Cypher queries and updates
PDF
Cypher.PL: an executable specification of Cypher semantics
PDF
Multiple Graphs: Updatable Views
PDF
Micro-Servicing Linked Data
PDF
Graph abstraction
PDF
From Cypher 9 to GQL: Conceptual overview of multiple named graphs and compos...
PDF
Cypher for Gremlin
PDF
Comparing PGQL, G-Core and Cypher
PDF
Multiple graphs in openCypher
PDF
Eighth openCypher Implementers Group Meeting: Status Update
PDF
Cypher for Gremlin
PDF
Supporting dates and times in Cypher
PDF
Seventh openCypher Implementers Group Meeting: Status Update
PDF
Academic research on graph processing: connecting recent findings to industri...
PDF
Property Graphs with Time
PDF
Cypher.PL: Executable Specification of Cypher written in Prolog
PDF
Use case: processing multiple graphs
PDF
openCypher Technology Compatibility Kit (TCK)
Learning Timed Automata with Cypher
Incremental View Maintenance for openCypher Queries
Formal semantics for Cypher queries and updates
Cypher.PL: an executable specification of Cypher semantics
Multiple Graphs: Updatable Views
Micro-Servicing Linked Data
Graph abstraction
From Cypher 9 to GQL: Conceptual overview of multiple named graphs and compos...
Cypher for Gremlin
Comparing PGQL, G-Core and Cypher
Multiple graphs in openCypher
Eighth openCypher Implementers Group Meeting: Status Update
Cypher for Gremlin
Supporting dates and times in Cypher
Seventh openCypher Implementers Group Meeting: Status Update
Academic research on graph processing: connecting recent findings to industri...
Property Graphs with Time
Cypher.PL: Executable Specification of Cypher written in Prolog
Use case: processing multiple graphs
openCypher Technology Compatibility Kit (TCK)
Ad

Recently uploaded (20)

PDF
Empathic Computing: Creating Shared Understanding
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Spectroscopy.pptx food analysis technology
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Electronic commerce courselecture one. Pdf
PDF
cuic standard and advanced reporting.pdf
Empathic Computing: Creating Shared Understanding
The AUB Centre for AI in Media Proposal.docx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Agricultural_Statistics_at_a_Glance_2022_0.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Spectroscopy.pptx food analysis technology
Diabetes mellitus diagnosis method based random forest with bat algorithm
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
MYSQL Presentation for SQL database connectivity
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Chapter 3 Spatial Domain Image Processing.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Programs and apps: productivity, graphics, security and other tools
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Network Security Unit 5.pdf for BCA BBA.
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Electronic commerce courselecture one. Pdf
cuic standard and advanced reporting.pdf

Virtual Graphs & Graph Views in Cypher

  • 1. Virtual Graphs & Graph Views in Cypher Sascha Peukert1, Hannes Voigt1, Michael Hunger2 1TU Dresden 2Neo Technology
  • 2. 22 Concept Chasm  USERS TALK ABOUT… ! Application entities ! e.g. discussions, topics, communities, etc. ! Likely multiple abstraction levels  BASE DATA CONTAINS… ! Fine granular data ! Low abstraction ! E.g. individual twitter messages, retweet relationships, etc. e.g. discussions, topics, communities, etc. Likely multiple levels CONTAINS Fine granular data Low abstraction [Martin Grandjean, https://commons.wikimedia.org/wiki/File:Social_Network_Analysis_Visualization.png, 2014] communities, etc. levels CONTAINS… Fine granular data Low abstraction [http://nodexlgraphgallery.org/Pages/Graph.aspx?graphID=70790] Query language main means to bridge concept chasm Users talk in high level concepts ! Data captured in low level concepts " Concept chasm
  • 3. 3 Base data What do you need?  1. LET USER CREATE ABSTRACT GRAPHS ! Nodes and relationships not present in the base data but derived from base data 1 2 3 4 5 6 7 8 [:FRIENDS] MATCH (p1)-[:FRIENDS]-(p2)-[:FRIENDS]-(p3)-[:FRIENDS]-(p1) CREATE VIRTUAL (t:FriendsTriangle)-[:CONTAINS]->(p1), (t)-[:CONTAINS]->(p2), (t)-[:CONTAINS]->(p3) MATCH (t1)-[:CONTAINS]->()<-[:CONTAINS]-(t2) -[:CONTAINS]->()<-[:CONTAINS]-(t1) CREATE VIRTUAL (t1)-[:CONNECTED]->(t2) [:CONTAINS] [:CONNECTED] 1 2 3 4
  • 4. 4 Base data What do you need?  1. LET USER CREATE ABSTRACT GRAPHS ! Nodes and relationships not present in the base data but derived from base data 1 3 4 5 7 8 [:FRIENDS] 5 MATCH (p1)-[:FRIENDS]-(p2)-[:FRIENDS]-(p3)-[:FRIENDS]-(p1) CREATE VIRTUAL (t:FriendsTriangle)-[:CONTAINS]->(p1), (t)-[:CONTAINS]->(p2), (t)-[:CONTAINS]->(p3) MATCH (t1)-[:CONTAINS]->()<-[:CONTAINS]-(t2) -[:CONTAINS]->()<-[:CONTAINS]-(t1) CREATE VIRTUAL (t1)-[:CONNECTED]->(t2) [:CONTAINS] MATCH (pa)<-[:CONTAINS]-(ta), tp=shortestPath((ta)-[:CONNECTED*]->(tb)), (tb)-[:CONTAINS]->(pb) RETURN pa, pb, length(tp)+1 AS triangleDist pa pb triangleDist 2 6 3 ! ! ! [:CONNECTED] , 1 2 3 4 [:FRIENDS] 2 6
  • 5. 5 What do you need?  2. LET USER MODULARIZE AND REUSE (SUB)-QUERIES WITH VIEWS ! Create view ! Use view ! Use multiple views IN VIEW friendsTriangles { MATCH (p)<-[:CONTAINS]-(t) } RETURN p, count(t) AS numTriangles ORDER BY numTriangles DESC LIMIT 10 CREATE VIEW friendsTriangles { MATCH (p1)-[:FRIENDS]-(p2)-[:FRIENDS]-(p3)-[:FRIENDS]-(p1) CREATE VIRTUAL (t:FriendsTriangle)-[e1:CONTAINS]->(p1), (t)-[e2:CONTAINS]->(p2), (t)-[e3:CONTAINS]->(p3) SAVE t,e1,e2,e3,p1,p2,p3 } IN VIEW friendsTriangles, connected, ALL { //ALL is base data MATCH (t1)-[:CONTAINS]->(p)<-[:CONTAINS]-(t2) -[:CONTAINS]->(q1)-[:KNOWS]-(q2)<-[:CONTAINS]-(t2) WHERE NOT (t1)-[:CONNECTED]-(t2) } RETURN t1,t2,q1,q2
  • 6. 6 Summary  VIEWS ARE AWESOME FOR ! Query modularization ! Reuse of query concepts ! Employing Need to Know for applications (fine-grained access control) ! Performance tuning (with materialized views)  OUR CURRENT IMPLEMENTATION IN NEO4J ! Two specializations of the OperationsFacade for handling virtual entities and views ! VirtualEntitiesFacade create entities internally and discards them after end of transaction ! ViewFacade - Keeps list of node and relationship id that are part of the view - Filter queries on views are execution on base data for results that are part of the view  GOAL: TRUE CYPHER QUERY REWRITE grained access control)