SlideShare ist ein Scribd-Unternehmen logo
1 von 104
Downloaden Sie, um offline zu lesen
Graph Abstraction
Hannes Voigt
MATCH (oldGraph)
CONSTRUCT (newGraph)
2
Hannes Voigt
Starting June 2018
! Language and Standards Group, Neo4j
Before
! Postdoc at Database System Group,
! Technische Universität Dresden
Education and Experience
! Ph.D. from Technische Universität Dresden in 2014
! Visiting scholar at SAP Labs, Palo Alto for one year in 2010
! Visiting scholar at University Waterloo, for 4 months in 2007
Activities
! LDBC Graph Query Language Standardization Task Force
! Graph-related industry activities with SAP HANA Graph and openCypher
! Involvement with Graphs and Graph QLs since early 2010
3
Short Commercial Break
Life of a Property Graph Query
! Data Models
! Query Languages
! Constraints
! Query Specification
! Data Structures and Indexing
! Query Processing
! Physical Operators
Currently under review …
… and to be appear soon
10,000 ft View
5
Concept Chasm
Users talk about…
! Application entities
! e.g. discussions, communities,
topics, etc.
! Multiple abstraction
levels
Base data contains…
! Fine granular data
! Low abstraction
! E.g. individual
twitter messages,
retweet relationships,
etc.
e.g. discussions, communities,
abstrac
Base data contains
Fine granular data
Low abstraction
[Martin Grandjean, https://commons.wikimedia.org/wiki/File:Social_Network_Analysis_Visualization.png, 2014]
abstraction
Base data 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
6
Graph Abstraction
Match -> variable bindings
Different types of variables
▪ Value variable
▪ Vertex variable
▪ Edge variables
▪ (Path variables)
▪ ((Sub)Graph variables)
Match Pattern
!" … !$
Variable Bindings
7
Graph Abstraction
Match -> variable bindings -> production
Different types of variables
▪ Value variable
▪ Vertex variable
▪ Edge variables
▪ (Path variables)
▪ ((Sub)Graph variables)
Idea in general
▪ Create the resulting graph by instantiate
production pattern
▪ Make it is intuitive as match patterns
▪ Make it use the same intuition as match
Match Pattern Production Pattern
!" … !$
Variable Bindings
8
Graph Abstraction
Match -> variable bindings -> production
Different types of variables
▪ Value variable
▪ Vertex variable
▪ Edge variables
▪ (Path variables)
▪ ((Sub)Graph variables)
Idea in little more detail
▪ Existing vertices from bound vertex variables
▪ New vertices with new unbound vertex
variables
▪ Edges either implicit (via vertex variable) or
explicit (with edge variables)
▪ Existing values from bound value variable
▪ Bound/unbound is a parse time property
Match Pattern Production Pattern
!" … !$
Variable Bindings
9
Graph Abstraction
Match -> variable bindings -> production
Different types of variables
▪ Value variable
▪ Vertex variable
▪ Edge variables
▪ (Path variables)
▪ ((Sub)Graph variables)
Production
▪ Existing vertices from bound vertex variables
▪ New vertices with new unbound vertex
variables
▪ Edges either implicit (via vertex variable) or
explicit (with edge variables)
▪ Existing values from bound value variable
▪ Bound/unbound is a parse time property
Production Pattern
!" … !$
Variable Bindings
Scope of this talk
10
Graph Abstraction
Match -> variable bindings -> production
Different types of variables
▪ Value variable
▪ Vertex variable
▪ Edge variables
▪ (Path variables)
▪ ((Sub)Graph variables)
Production
▪ Existing vertices from bound vertex variables
▪ New vertices with new unbound vertex
variables
▪ Edges either implicit (via vertex variable) or
explicit (with edge variables)
▪ Existing values from bound value variable
▪ Bound/unbound is a parse time property
Match Pattern Production Pattern
!" … !$
Variable Bindings
Scope of this talk
Hi, I am
just
for beauty
Graph Construction – Level 1
12
Super Simple Example
2 3
1
Base Graph
Result Graph
MATCH (a)-->(b)
CONSTRUCT (a)-->(c)<--(b)
13
Super Simple Example
! "
#
! "
$
Result Graph
a
b a b
c
Base Graph
MATCH (a)-->(b)
CONSTRUCT (a)-->(c)<--(b)
14
MATCH (a)-->(b)
CONSTRUCT (a)-->(c)<--(b)
Super Simple Example
! "
#
! "
#
$
%
Result Graph
$
a
b
!
a
b
%
c
Base Graph
15
MATCH (a)-->(b)
CONSTRUCT (a)-->(c)<--(b)
Super Simple Example
! "
#
! "
#
$
%
&
Result Graph
"
a
b
a
#
b
%
c
Base Graph
16
MATCH (a)-->(b)
CONSTRUCT (a)-->(c)<--(b)
Super Simple Example
! "
#
! "
#
$
%
&
Result Graph
"
a
b
Base Graph
same as
MATCHMATCH (a)(a)------>(b)MATCH
CONSTRUCT
(a)MATCH (a)
CONSTRUCTCONSTRUCTCONSTRUCTCONSTRUCT (a)
(a)
(a)(a)(a)(a)(a)------>-- ()<--(b)
>(b)>(b)>(b)>(b)
>>>()()()
>(b)>(b)
()()()()()()
>(b)
<<<----------(b)(b)(b)(b)
Not mentioned variables are unbound.
Think of it as there is a variable, you just
don’t know its name
17
same as
MATCH (a)-->(b)
CONSTRUCT (a)-->()<--(b)
MATCH (a)-->(b)
CONSTRUCT (a)-->(c)<--(b)
Super Simple Example
! "
#
! "
#
$
%
&
Result Graph
"
a
b
Note:Note:
!
Note:Note:
Identities for new vertices are systemIdentities for new vertices are system-Identities for new vertices are system-generated!! Identities for new vertices are system
!
Identities for new vertices are systemIdentities for new vertices are systemIdentities for new vertices are systemIdentities for new vertices are systemIdentities for new vertices are system-generatedgeneratedgenerated! Identities for new vertices are systemIdentities for new vertices are system
Specific ID values (e.g. 4) are not important!!! Specific ID values (e.g. 4) are not important
!
17
Specific ID values (e.g. 4) are not importantSpecific ID values (e.g. 4) are not importantSpecific ID values (e.g. 4) are not importantSpecific ID values (e.g. 4) are not importantSpecific ID values (e.g. 4) are not importantSpecific ID values (e.g. 4) are not importantSpecific ID values (e.g. 4) are not important! Specific ID values (e.g. 4) are not importantSpecific ID values (e.g. 4) are not importantSpecific ID values (e.g. 4) are not importantSpecific ID values (e.g. 4) are not important
! As long as they are unique per variable and match group
Base Graph
18
Identities
New object identities
▪ Assuming a binding table ! with schema " ! = $%, … , $( and
▪ An object construction pattern with variable ) with ) ∉ " !
▪ A new identity + is generated with
+ = , variableNameOf ) , $%, … , $(
where , is a Skolem function
Match Pattern Production Pattern
89 … 8:
Variable Bindings
19
Identities
New object identities
▪ Assuming a binding table ! with schema " ! = $%, … , $( and
▪ An object construction pattern with variable ) with ) ∉ " !
▪ A new identity + is generated with
+ = , variableNameOf ) , $%, … , $(
where , is a Skolem function
Match Pattern Production Pattern
89 … 8:
Variable Bindings
Construction
Domain
Construction
Instance
20
Identities
New object identities
! Assuming a binding table ! with schema " ! # $%& ' & $( and
! An object construction pattern with variable ) with ) * " !
! A new identity + is generated with
+ # , -./0.1234.5367 ) & $%& ' & $(
where , is a Skolem function
Match Pattern Production Pattern
89 ' 8:
Variable Bindings
Construction
Domain
Construction
Instance
In a nutshell:
,
In a nutshell:
returns same identities for the
In a nutshell:
In a nutshell:
In a nutshell:
,, returns same identities for the
returns same identities for the
returns same identities for the
same input parameter
returns same identities for the
returns same identities for the
same input parameter values
21
Identities
New object identities
▪ Assuming a binding table ! with schema " ! = $%, … , $( and
▪ An object construction pattern with variable ) with ) ∉ " !
▪ A new identity + is generated with
+ = , variableNameOf ) , 89:;<
where , is a Skolem function
Match Pattern Production Pattern
=> … =?
Variable Bindings
Construction
Domain
Construction
Instance
For bag semantics construction
instance is determined by the
row id of the row in the binding
table
22
Aspects of Identity Generation
Object Identities
▪ Should be a pure technical aspect and not of user concern
- System-generated in any case
▪ Queries can involve object (node, edge) constructors
▪ Object constructor produces new object identities (ID values)
The scope of ID uniqueness is the transaction (query)
▪ ID uniqueness guarantied within a single transactions (query)
▪ ID uniqueness not guarantied across multiple transactions (query)
Repeatability of ID generation is not guarantied
▪ The same query on an unchanged dataset can return different IDs
Gain: Composability
24
Find vertices connected by chain of triangles
Composability
Base data G1
3
4
5
7
8
[:friends]
2
6
25
Composability
Find vertices connected by chain of triangles
▪ Simplified syntax Base data G1
3
4
5
7
8
[:friends]
1 2 3 4
2
6
[:contains]
--1st abstraction step
MATCH (p1)-[:friends]-(p2),
(p2)-[:friends]-(p3)-[:friends]-(p1)
CONSTRUCT (t:FriendsTriangle)-[:contains]->(p1),
(t)-[:contains]->(p2),
(t)-[:contains]->(p3)
26
Composability
Find vertices connected by chain of triangles
▪ Simplified syntax Base data G1
3
4
5
7
8
[:friends]
[:connected]
1 2 3 4
2
6
[:contains]
--1st abstraction step
MATCH (p1)-[:friends]-(p2),
(p2)-[:friends]-(p3)-[:friends]-(p1)
CONSTRUCT (t:FriendsTriangle)-[:contains]->(p1),
(t)-[:contains]->(p2),
(t)-[:contains]->(p3)
--2nd abstraction step
MATCH (t1)-[:contains]->(pa)<-[:contains]-(t2),
(t1)-[:contains]->(pb)<-[:contains]-(t2)
WHERE pa!=pb
CONSTRUCT (t1)-[:connected]->(t2)
27
Composability
Find vertices connected by chain of triangles
! Simplified syntax
--1st abstraction step
MATCH (p1)-[:friends]-(p2),
(p2)-[:friends]-(p3)-[:friends]-(p1)
CONSTRUCT (t:FriendsTriangle)-[:contains]->(p1),
(t)-[:contains]->(p2),
(t)-[:contains]->(p3)
--2nd abstraction step
MATCH (t1)-[:contains]->(pa)<-[:contains]-(t2),
(t1)-[:contains]->(pb)<-[:contains]-(t2)
WHERE pa!=pb
CONSTRUCT (t1)-[:connected]->(t2)
--3rd abstraction step
MATCH (pa)<-[:contains]-(ta),
(ta)-/tp:connected*/->(tb),
(tb)-[:contains]->(pb)
RETURN pa, pb, length(tp)+1 AS triangleDist
Base data G1
3
4
5
7
8
[:friends]
5
pa pb triangleDist
2 6 3
! ! !
[:connected]
1 2 3 4
[:friends]
2
6
[:contains]
28
Use for DML
General
▪ Just a matter of the target graph, which the concept is agnostic about
Create new elements
▪ CONSTRUCT (:Person {name: 'Hannes’}), (:Talk {title: 'GraghAgg'})
CONSTRUCT (h)-[g:GIVES]->(t)
▪ Input per definition: Binding table containing one empty tuples (no columns)
▪ 1st CONSTRUCT: Nodes h and t unbound à are created
▪ 2nd CONSTRUCT: Nodes h and t are bound à are already in the target graph
Edge g is unbound à is created
Merge in new elements
▪ Assume (:Person {name: 'Hannes'}) already exists in the target graph
▪ MATCH (h:Person {name: 'Hannes'})
CONSTRUCT (h)-[g:GIVES]->(t:Talk {title: 'GraghAgg'})
▪ Node h is bound à are already in the target graph
▪ Edge g and node t are unbound à are created
29
Graph Abstraction
Abstract
single Subgraphs
…
…
Graph Aggregation – Level 2
31
Simple Example with Grouping
2 3
1
Base Graph
MATCH (a)-->(b)
CONSTRUCT (c GROUP a)
32
Simple Example with Grouping
! "
#
Base Graph
Syntax alternative
! PER
! GROUP BY! Outside the pattern
! …
MATCH (a)-->(b)
CONSTRUCT (c GROUP a)
33
Base Graph
<
Simple Example with Grouping
2 3
1 4
Result Graph
Group
with a=2
MATCH (a)-->(b)
CONSTRUCT (c GROUP a)
34
Base Graph
<
Simple Example with Grouping
2 3
1
5
4
Result Graph
Group
with a=2
Group
with a=3
MATCH (a)-->(b)
CONSTRUCT (c GROUP a)
35
Simple Example with Grouping
2 3
1
MATCH (a)-[e]->(b)
CONSTRUCT (c GROUP a,b,e)
Base Graph
36
Base Graph
Simple Example with Grouping
2 3
1
6
54
Result Graph
MATCH (a)-[e]->(b)
CONSTRUCT (c GROUP a,b,e)
37
Base Graph
Simple Example with Grouping
! "
#
$
%&
Result Graph
same as
MATCH (a)-[e]->(b)
CONSTRUCT (c GROUP a,b,e)
Grouping subsumes simple
construction (level 1).
Allows syntax shortcuts.
(Assuming set semantics.)MATCH (a)-->(b)
CONSTRUCT (c)
38
Simple Example with Grouping
MATCH (a)-->(b)
CONSTRUCT (c GROUP a), (d GROUP b)
2 3
1
Base Graph
39
Base Graph
<
Simple Example with Grouping
2 3
1
5
4
Result Graph
Group
with a=2
Group
with a=3
MATCH (a)-->(b)
CONSTRUCT (c GROUP a), (d GROUP b)
40
Base Graph
<
Simple Example with Grouping
2 3
1
5
4
7
6
Result GraphGroup
with b=1
Group
with b=3
MATCH (a)-->(b)
CONSTRUCT (c GROUP a), (d GROUP b)
41
Simple Example with Grouping
2 3
1
5
4
7
6
Result GraphBase Graph
MATCH (a)-->(b)
CONSTRUCT (c GROUP a)-[e]->(d GROUP b)
?
42
Simple Example with Grouping
2 3
1
5
4
7
6
Result GraphBase Graph
MATCH (a)-->(b)
CONSTRUCT (c GROUP a)-[e GROUP a,b]->(d GROUP b)
same as
MATCH (a)-->(b)
CONSTRUCT (c GROUP a)-[e]->(d GROUP b)
Edges are implicitly grouped by
the grouping keys of their nodes
(and may define additional
grouping keys themselves)
43
Simple Example with Grouping
! "
#
$$
Result Graph
%
& '
Base Graph
MATCH (a)-->(b)
CONSTRUCT (c GROUP a)-[e GROUP a,b]->(d GROUP b)
same as
MATCH (a)-->(b)
CONSTRUCT (c GROUP a)-[e]->(d GROUP b)
Edges are implicitly grouped by
the grouping keys of their nodes
(and may define additional
grouping keys themselves)
44
Base Graph
Simple Example with Grouping
! "
#
$$
Result Graph
%
& '
MATCH (a)-->(b)
CONSTRUCT (c GROUP a)-[e GROUP a,b]->(d GROUP b)
same as
MATCH (a)-->(b)
CONSTRUCT (c GROUP a)-[e]->(d GROUP b)
Edges are implicitly grouped by
the grouping keys of their nodes
(and may define additional
grouping keys themselves)
45
Base Graph
Simple Example with Grouping
! "
#
Result Graph
$
% &
'
MATCH (a)-->(b)
CONSTRUCT (c GROUP a)-[e GROUP a,b]->(d GROUP b)
same as
MATCH (a)-->(b)
CONSTRUCT (c GROUP a)-[e]->(d GROUP b)
Edges are implicitly grouped by
the grouping keys of their nodes
(and may define additional
grouping keys themselves)
46
Base Graph
Simple Example with Grouping
! "
#
Result Graph
$
% #
MATCH (a)-->(b)
CONSTRUCT (c GROUP a)-[e GROUP a,b]->(b GROUP b)
same as
b is bound, hence, already
in the graph or replicated
depending on the target
graph
MATCH (a)-->(b)
CONSTRUCT (c GROUP a)-[e]->(b)
"
47
Aggregation in Graph Construction
Vertex patterns
▪ Have grouping variables: (x GROUP a,b …)
▪ Grouping variables must be a subset of the set of all bound variables
▪ Bound vertices must have their vertex variable as grouping variable,
hence (x GROUP x …) is the same as (x …) if x is a bound variable
▪ Unbound vertices without specified grouping variables, are implicitly grouped by all bound variables,
hence (x …) is the same as (x GROUP a,b …) if x is an unbound variable and a and b are all
bound variables
Edge patterns
▪ Inherit grouping if they connect one or two grouping vertices
▪ Edges can have own grouping variables, that are added to the inherit grouping attributes
General
▪ All bound variables not used as group variable can be used in the same object patter only in an
aggregation function
48
Identities
New object identities with Aggregation
▪ Assuming a binding table ! with schema " ! and
▪ An object construction pattern with variable # ∉ " ! and grouping variables %&, … , %) ⊆ " !
▪ A new identity + is generated with
+ = - variableNameOf # , %&, … , %)
where - is a Skolem function
Match Pattern Production Pattern
9: … 9;
Variable Bindings
Construction
Domain
Construction
Instance
49
Replicating and Copying (cf. Stefan’s Talk)
Let x be a bound variable à Replication
▪ (x) à Replication is standard behavior for bound variables
▪ Note that (x) is a shortcut for (x GROUP x)
▪ Clones x into the output graph
▪ Creates new node with identity ! = # variableNameOf / , /
▪ System may also track lineage of x
50
Replicating and Copying (cf. Stefan’s Talk)
Let x be a bound variable à Replication
▪ (x) à Cloning is standard behavior for bound variables
▪ Note that (x) is a shortcut for (x GROUP x)
▪ Clones x into the output graph
▪ Creates new node with identity ! = # variableNameOf / , /
▪ System may also track lineage of x
Let x be a bound variable à Copying
▪ (y COPY x) à new node with all labels and properties of x copied over
▪ Copies x‘s data into the output graph
▪ Creates new node with identity ! = # variableNameOf / , 12, … , 14
▪ Note that this may copy the data of a specific node x multiple time into the target graph
▪ 1:1 copying can be ensured by grouping: (y COPY x GROUP x)
▪ No lineage tracking
51
Use for DML
General
▪ Grouping gives explicit control over distinctness of created elements
Create new nodes for distinct values
▪ MATCH (p:Person)
UNWIND p.talks AS s
CONSTRUCT (p)-[:GIVES]->(t GROUP s :Talk {title: s})
▪ Gives you a :Talk node for every distinct s value
▪ If multiple people gave the same talk, they all will be connected to the same :Talk node
52
Use for DML
Create new edges for distinct values
▪ MATCH (h:Person)-[:GIVES]->(t:Talk)
UNWIND t.dates AS d
CONSTRUCT (h)-[g GROUP d :GIVES {date: d}]->(t)
▪ If a talk was given at multiple times, the same pair of person and talk node will get connected by one
edge for each distinct date the talk was given between (g grouped by h, t, and d)
53
Use for DML
Create new edges for distinct values
▪ MATCH (h:Person)-[:GIVES]->(t:Talk)
UNWIND t.dates AS d
CONSTRUCT (h)-[g GROUP d :GIVES {date: d}]->(t)
▪ If a talk was given at multiple times, the same pair of person and talk node will get connected by one
edge for each distinct date the talk was given between (g grouped by h, t, and d)
▪ What happens if a talk was given multiple times at the same day?
54
Use for DML
Create new edges for distinct values
▪ MATCH (h:Person)-[:GIVES]->(t:Talk)
UNWIND t.dates AS d
CONSTRUCT (h)-[g GROUP d :GIVES {date: d}]->(t)
▪ If a talk was given at multiple times, the same pair of person and talk node will get connected by one
edge for each distinct date the talk was given between (g grouped by h, t, and d)
▪ What happens if a talk was given multiple times at the same day?
Create new elements for every row in the binding table
▪ Note, binding table has bag semantics
▪ MATCH (h:Person {name: 'Hannes'})
UWIND [1,2,2,3] AS x
CONSTRUCT (h)-[g:FAVORITE_NUMBERS]->(n GROUP ROW {num: x})
▪ Will definitely create four n nodes: ({num:1}), ({num:2}), ({num:2}), ({num:3})
Gain: Graph-only Aggregation Queries
56
Example with Grouping
age=40
!"
age=35
!#
class=Compact
$"
class=Intermediate
$%
MATCH (p:Person {age=a})-[:drives]->(c:Car {class=k})
CONSTRUCT
…
class=Compact
$#
age=35
!&
Syntax
Proposal:
age=45
!'
Matched Base Graph
Individual match with
! ( !#, ) ( *+, $ ( $", and , ( -./0123
57
Example with Grouping
age=40
!"
age=35
!#
class=Compact
$"
MATCH (p:Person {age=a})-[:drives]->(c:Car {class=k})
CONSTRUCT
…
class=Compact
$#
age=35
!%
Syntax
Proposal:
class=Compact
Matched Base Graph
Individual match with
! & !#, ' & (), $ & $", and * & +,-./01
Another individual match with
! & !2, ' & 3), $ & $4, and * & 56178-79:/17
class=Compactclass=Compact
class=Intermediate
$4age=45
!2
58
Example with Grouping
age=40
!"
age=35
!#
name=Intermediate
$%
name=Compact
$&
number=3
number=1 number=1
class=Compact
'"
class=Intermediate
'(
MATCH (p:Person {age=a})-[:drives]->(c:Car {class=k})
CONSTRUCT (g GROUP a :AgeGroup {age=a, number=COUNT(DISTINCT p)})
-[:{numdrivers=COUNT(*)}]->
(z GROUP k :Class {name=k})
class=Compact
'#
age=35
!)
Syntax
Proposal:
age=45
!&
number=1
Matched Base Graph Result Graph
name=Intermediate
$%
name=Compact
$&
number=3
number=1 number=1
number=1
-[:{numdrivers=COUNT(*)}]->
(z GROUP k :Class {name=k})
age=40
number=1
*&
age=35
number=2
*%
age=45
number=1
*)
59
Example with Grouping
age=40
!"
age=35
!# number=3
number=1 number=1
class=Compact
$"
class=Intermediate
$%
MATCH (p:Person {age=a})-[:drives]->(c:Car {class=k})
CONSTRUCT (g GROUP a :AgeGroup {age=a, number=COUNT(DISTINCT p)})
-[:{numdrivers=COUNT(*)}]->
(z GROUP k :Class {name=k})
class=Compact
$#
age=35
!&
Syntax
Proposal:
age=45
!'
number=1
Matched Base Graph Result Graph
number=3
number=1 number=1
number=1
-[:{numdrivers=COUNT(*)}]->
age=40
number=1
('
age=35
number=2
()
age=45
number=1
(&
name=Intermediate
*)
name=Compact
*'
60
Example with Grouping
age=40
!"
age=35
!#
age=40
number=1
$%
name=Intermediate
&'
age=35
number=2
$'
name=Compact
&%
number=3
number=1 number=1
class=Compact
("
class=Intermediate
()
class=Compact
(#
age=35
!*
Syntax
Proposal:
age=45
!%
age=45
number=1
$*
number=1
Matched Base Graph Result Graph
MATCH (p:Person {age=a})-[:drives]->(c:Car {class=k})
CONSTRUCT (g GROUP a :AgeGroup {age=a, number=COUNT(DISTINCT p)})
-[:{numdrivers=COUNT(*)}]->
(z GROUP k :Class {name=k})
61
Graph Abstraction
…
Abstract
multiple Subgraphs
Abstract
single Subgraphs
…
…
Structure Aggregation – Level 3
63
Summarize the structure of a graph in a smaller graph
▪ Group all vertices and all edge
▪ Represent the relationship
of the groups in a graph
Graph Summarization
[Peixiang Zhao et al.: Graph Cube: On Warehousing and OLAP Multidimensional Networks, SIGMOD 2011]
c
a
f
d
h i
b
e
g
j
!gender,COUNT ∗ ., !∅,COUNT ∗ 0 9
13
5 5
FriendsCo-workersSchema: Male/Teacher Female/Teacher Male/Lawyer Female/Lawyer
64
Summarize the structure of a graph in a smaller graph
▪ Group all vertices and all edge
▪ Represent the relationship
of the groups in a graph
!gender,job,COUNT ∗ 1, !∅,COUNT ∗ 3
Graph Summarization
[Peixiang Zhao et al.: Graph Cube: On Warehousing and OLAP Multidimensional Networks, SIGMOD 2011]
c
a
f
d
h i
b
e
g
j
2
1
1
2
4 3
3 3
2 2
!gender,COUNT ∗ 1, !∅,COUNT ∗ 3 9
13
5 5
FriendsCo-workersSchema: Male/Teacher Female/Teacher Male/Lawyer Female/Lawyer
65
Summarize the structure of a graph in a smaller graph
▪ Group all vertices and all edge
▪ Represent the relationship
of the groups in a graph
!gender,job,COUNT ∗ 1, !∅,COUNT ∗ 3
!gender,COUNT ∗ 1, !status,COUNT ∗ 3
Graph Summarization
[Peixiang Zhao et al.: Graph Cube: On Warehousing and OLAP Multidimensional Networks, SIGMOD 2011]
c
a
f
d
h i
b
e
g
j
6 12
31
5 5
2
1
1
2
4 3
3 3
2 2
!gender,COUNT ∗ 1, !∅,COUNT ∗ 3 9
13
5 5
FriendsCo-workersSchema: Male/Teacher Female/Teacher Male/Lawyer Female/Lawyer
66
Summarize with Construction
Can Graph Summarization expressed as Graph Construction?
▪ Consider summarization !color &, !∅ )
▪ First try:
MATCH (a)-[e]->(b)
CONSTRUCT (x GROUP a.color)-->(y GROUP b.color)
67
Summarize with Construction
Can Graph Summarization expressed as Graph Construction?
▪ Consider summarization !color &, !∅ )
▪ First try:
Group with
a.color=red
MATCH (a)-[e]->(b)
CONSTRUCT (x GROUP a.color)-->(y GROUP b.color)
68
Summarize with Construction
Can Graph Summarization expressed as Graph Construction?
▪ Consider summarization !color &, !∅ )
▪ First try:
Group with
b.color=blue
MATCH (a)-[e]->(b)
CONSTRUCT (x GROUP a.color)-->(y GROUP b.color)
69
Summarize with Construction
Can Graph Summarization expressed as Graph Construction?
▪ Consider summarization !color &, !∅ )
▪ First try:
Group with
b.color=red
MATCH (a)-[e]->(b)
CONSTRUCT (x GROUP a.color)-->(y GROUP b.color)
70
Summarize with Construction
Can Graph Summarization expressed as Graph Construction?
▪ Consider summarization !color &, !∅ )
▪ First try:
Correct
Summarization
≠
Does not
work!
MATCH (a)-[e]->(b)
CONSTRUCT (x GROUP a.color)-->(y GROUP b.color)
71
Summarize with Construction
Can Graph Summarization expressed as Graph Construction?
▪ Consider summarization !color &, !∅ )
▪ First try:
Correct
Summarization
≠
Does not
work!
Problem: x and y are separate construction domains
MATCH (a)-[e]->(b)
CONSTRUCT (x GROUP a.color)-->(y GROUP b.color)
72
Summarize with Construction
Can Graph Summarization expressed as Graph Construction?
▪ Consider summarization !color &, !∅ )
▪ Solution:
MATCH (a)-[e]->(b)
CONSTRUCT (z AS x GROUP a.color)-->(z AS y GROUP b.color)
Idea: Aliasing – Two instances (x and y) in a construction
pattern from the same construction domain (z)
73
Summarize with Construction
Can Graph Summarization expressed as Graph Construction?
▪ Consider summarization !color &, !∅ )
▪ Solution:
Group with
a.color=red
MATCH (a)-[e]->(b)
CONSTRUCT (z AS x GROUP a.color)-->(z AS y GROUP b.color)
74
Summarize with Construction
Can Graph Summarization expressed as Graph Construction?
▪ Consider summarization !color &, !∅ )
▪ Solution:
Group with
b.color=blue
MATCH (a)-[e]->(b)
CONSTRUCT (z AS x GROUP a.color)-->(z AS y GROUP b.color)
75
Summarize with Construction
Can Graph Summarization expressed as Graph Construction?
▪ Consider summarization !color &, !∅ )
▪ Solution:
Group with
b.color=red
MATCH (a)-[e]->(b)
CONSTRUCT (z AS x GROUP a.color)-->(z AS y GROUP b.color)
76
Identities
New object identities with Aggregation
▪ Assuming a binding table ! with schema ! " and
▪ An object construction pattern with variable # ∉ ! " , domain % ∉ ! " , grouping &', … , &* ⊆ ! "
▪ A new identity , is generated with
, = . variableNameOf % , &', … , &*
where . is a Skolem function
Match Pattern Production Pattern
:; … :<
Variable Bindings
Construction
Domain
Construction
Instance
Gain: Flexible Graph Summarization
78
Example
Money Transfer between Groups
100
300
150
450 50
300220
130
100
500
750
900
600 50
MATCH (s1)<-[e:in]-(c1)-[e:transfer]->(c2)-[:in]->(s2)
CONSTRUCT (g AS g1 GROUP s1)
-[{amount=SUM(e.amount)}]->
(g AS g2 GROUP s2)
79
Example
Money Movement of each Group
100
300
150
450 50
300220
130
100
500
flow: 2850
MATCH (s1)<-[e:in]-(c1)-[e:transfer]->(c2)-[:in]->(s2)
CONSTRUCT (g AS g1 GROUP s1 {flow=SUM(e.amount)})
-->
(g AS g2 GROUP s2 {flow=SUM(e.amount)})
flow: 1750
80
Example
Cost and Revenue of each Group
100
300
150
450 50
300220
130
100
500
cost: -1350
revn: 1500
MATCH (s1)<-[e:in]-(c1)-[e:transfer]->(c2)-[:in]->(s2)
CONSTRUCT (g AS g1 GROUP s1 {cost=SUM(-1*e.amount)})
-->
(g AS g2 GROUP s2 {revn=SUM(e.amount)})
cost: -950
revn: 800
81
Example
Profit of each Group
100
300
150
450 50
300220
130
100
500
prof: 150
MATCH (s1)<-[e:in]-(c1)-[e:transfer]->(c2)-[:in]->(s2)
CONSTRUCT (g AS g1 GROUP s1 {prof=SUM(-1*e.amount)})
-->
(g AS g2 GROUP s2 {prof=SUM(e.amount)})
prof: -150
82
Graph Abstraction
… …
Abstract
Structure
Abstract
multiple Subgraphs
Abstract
single Subgraphs
…
…
Cross-Match Construction – Level 4
Experimental!
84
Reminder: Regular Per-Match Construction
Base Graph
2 3
1
Result Graph
5
4
MATCH (a)-->(b)
CONSTRUCT (c GROUP a)
Base Graph
<2 3
1 4Group
with a=2
Group
with a=3
85
Cross-Match Construction
Base Graph
! "
#
Result Graph
$
MATCH (a)-->(b)
CONSTRUCT (c GROUP a)-[e]->(ORDER BY id(a) 1 PRECEDING c)
Base Graph
! "
#
id(a)=2 < id(a)=3
$
%
$
Idea: Refer to nodes coming from
a different match result
The c created for
the preceding
match result
according to
ascending id of a
86
Cross-Match Construction
Base Graph
2 3
1
Result Graph
5
4
MATCH (a)-->(b)
CONSTRUCT (c)-[e]->(ORDER BY id(b),id(a) 1 PRECEDING c)
Base Graph
2 3
1 4 6
87
Referencing relative to a given order
Cross-Match Construction
Base Graph
! "
#
Result Graph
$
MATCH (a)-->(b)
CONSTRUCT (c)-[e]->(ORDER BY id(b),id(a) 1 PRECEDING c)
Base Graph
! "
# $
%
$ &
ORDER BY id(b),id(a): (1,2) < (1,3) < (3,2)
88
Referencing relative to a given order
Cross-Match Construction
Base Graph
! "
#
Result Graph
$
MATCH (a)-->(b)
CONSTRUCT (c)-[e]->(ORDER BY id(b),id(a) 1 PRECEDING c)
(c)-[e]->(ORDER BY id(b),id(a) 1 SUCCEEDING c)
Base Graph
! "
#
ORDER BY id(b),id(a): (1,2) < (1,3) < (3,2)
$
%
$ &
89
Order is local to reference
Cross-Match Construction
Base Graph
! "
#
Result Graph
$
MATCH (a)-->(b)
CONSTRUCT (c)-[e]->(ORDER BY id(b),id(a) 1 PRECEDING c)
(c)-[e]->(ORDER BY id(b),id(a) 1 SUCCEEDING c)
(c)-[e]->(ORDER BY id(a),id(b) 1 PRECEDING c)
Base Graph
! "
#
ORDER BY id(b),id(a): (1,2) < (1,3) < (3,2)
ORDER BY id(a),id(b): (2,1) < (2,3) < (3,1)
$
%
$ &
90
In conjunction with Aliasing
Cross-Match Construction
Base Graph
! "
#
Result Graph
$
MATCH (a)-->(b)
CONSTRUCT (c)-[e:Prev]->(ORDER BY id(b),id(a) 1 PRECEDING c AS ca),
(c)-[f:Succ]->(ORDER BY id(b),id(a) 1 SUCCEEDING c),
(c)-[g:Prev2]->(ORDER BY id(a),id(b) 1 PRECEDING c AS cb),
(ca)-[h:Cross]->(cb)
Base Graph
! "
#
ORDER BY id(b),id(a): (1,2) < (1,3) < (3,2)
ORDER BY id(a),id(b): (2,1) < (2,3) < (3,1)
Result Graph
$
%
$ &
91
Referencing absolute to a given order
Cross-Match Construction
Base Graph
! "
#
Result Graph
$
MATCH (a)-->(b)
CONSTRUCT (c)-[e]->(ORDER BY id(b),id(a) FIRST c)
Base Graph
! "
#
ORDER BY id(b),id(a): (1,2) < (1,3) < (3,2)
$
%
$ &
92
Referencing many
Cross-Match Construction
Base Graph
! "
#
Result Graph
$
MATCH (a)-->(b)
CONSTRUCT (c)-[e]->(ORDER BY id(b),id(a) ALL PRECEDING c)
Base Graph
! "
#
ORDER BY id(b),id(a): (1,2) < (1,3) < (3,2)
$
%
$ &
93
Partitioning the order
Cross-Match Construction
Base Graph
! "
#
Result Graph
$
MATCH (a)-->(b)
CONSTRUCT (c)-[e]->(PARTITION a ORDER BY id(b),id(a) 1 PRECEDING c)
Base Graph
! "
#
ORDER BY id(b),id(a): (1,2) < (3,2) | (1,3)
$
%
$ &
94
Cross-Match Construction
Reference Production of other Match Results
▪ No additional identities are produced from the given match
▪ Only referring to identities produced of another match in the match result set
▪ The construction domain which is referred to does not have to be part of the pattern
Syntax
▪ Referencing syntax can be design analogously to window specification in SQL OLAP functions
Open questions
▪ Self referencing? Non-total orders? How does it compare to joins? …
Matches Productions
!" … !$
Variable Bindings
Gain: New connections out of thin air
96
Example
Coauthor network
QueryGraphs GCORE Cypher
Hannes
Nikolay
Tobias
Stefan
SIGMODSynthesis Lectures on DM
97
Example
Coauthor network
QueryGraphs GCORE Cypher
Hannes
Nikolay
Tobias
Stefan
SIGMODSynthesis Lectures on DM
MATCH (a)-[:AUTHORED]->(p)-[:APPEARED_IN]->(v), (b)-[:AUTHORED]->(p)
a b p p.cit… v.imp…
Stefan Tobias Cypher 150 50
Stefan Tobias GCORE 100 50
Stefan Hannes GCORE 100 50
Tobias Stefan Cypher 150 50
Tobias Stefan GCORE 100 50
Tobias Hannes GCORE 100 50
Hannes Stefan GCORE 100 50
Hannes Tobias GCORE 100 50
Hannes Nikolay QG 100 40
Nikolay Hannes QG 100 40
98
Example
Coauthor network
Top-coauthor network
QueryGraphs GCORE Cypher
Hannes
Nikolay
Tobias
Stefan
SIGMODSynthesis Lectures on DM
MATCH (a)-[:AUTHORED]->(p)-[:APPEARED_IN]->(v), (b)-[:AUTHORED]->(p)
CONSTRUCT (a)-[:TOP_COAUTHOR {paper: p.name}]->
(PARTITION a ORDER v.impactFactor * p.citations DESC ALL FIRST b)
Hannes
Nikolay
Tobias
Stefan
a b p p.cit… v.imp…
Stefan Tobias Cypher 150 50
Stefan Tobias GCORE 100 50
Stefan Hannes GCORE 100 50
Tobias Stefan Cypher 150 50
Tobias Stefan GCORE 100 50
Tobias Hannes GCORE 100 50
Hannes Stefan GCORE 100 50
Hannes Tobias GCORE 100 50
Hannes Nikolay QG 100 40
Nikolay Hannes QG 100 40
{name: GCORE}
{name: GCORE}{name: QG} {name: Cypher}
99
Example
Coauthor network
Top-coauthor network
QueryGraphs GCORE Cypher
Hannes
Nikolay
Tobias
Stefan
SIGMODSynthesis Lectures on DM
MATCH (a)-[:AUTHORED]->(p)-[:APPEARED_IN]->(v), (b)-[:AUTHORED]->(p)
CONSTRUCT (a)-[:TOP_COAUTHOR {paper: p.name}]->
(PARTITION a ORDER v.impactFactor * p.citations DESC ALL FIRST b)
Hannes
Nikolay
Tobias
Stefan
a b p p.cit… v.imp…
Stefan Tobias Cypher 150 50
Stefan Tobias GCORE 100 50
Stefan Hannes GCORE 100 50
Tobias Stefan Cypher 150 50
Tobias Stefan GCORE 100 50
Tobias Hannes GCORE 100 50
Hannes Stefan GCORE 100 50
Hannes Tobias GCORE 100 50
Hannes Nikolay QG 100 40
Nikolay Hannes QG 100 40
{name: GCORE}
{name: GCORE}{name: QG} {name: Cypher}
Hannes
100
Example
Coauthor network
Top-coauthor network
QueryGraphs GCORE Cypher
Hannes
Nikolay
Tobias
Stefan
SIGMODSynthesis Lectures on DM
MATCH (a)-[:AUTHORED]->(p)-[:APPEARED_IN]->(v), (b)-[:AUTHORED]->(p)
CONSTRUCT (a)-[:TOP_COAUTHOR {paper: p.name}]->
(PARTITION a ORDER v.impactFactor * p.citations DESC ALL FIRST b)
Hannes
Nikolay
Tobias
Stefan
a b p p.cit… v.imp…
Stefan Tobias Cypher 150 50
Stefan Tobias GCORE 100 50
Stefan Hannes GCORE 100 50
Tobias Stefan Cypher 150 50
Tobias Stefan GCORE 100 50
Tobias Hannes GCORE 100 50
Hannes Stefan GCORE 100 50
Hannes Tobias GCORE 100 50
Hannes Nikolay QG 100 40
Nikolay Hannes QG 100 40
{name: GCORE}
{name: GCORE}{name: QG} {name: Cypher}
Tobias
101
Graph Abstraction
… … …
Abstract
Structure
Link
Abstractions
Abstract
multiple Subgraphs
Abstract
single Subgraph
…
…
Warp Up
103
Concept Chasm
Users talk about…
! Application entities
! e.g. discussions, communities,
topics, etc.
! Multiple abstraction
levels
Base data contains…
! Fine granular data
! Low abstraction
! E.g. individual
twitter messages,
retweet relationships,
etc.
e.g. discussions, communities,
abstrac
Base data contains
Fine granular data
Low abstraction
[Martin Grandjean, https://commons.wikimedia.org/wiki/File:Social_Network_Analysis_Visualization.png, 2014]
abstraction
Base data 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
104
Summary
… … …
Abstract
Structure
Link
Abstraction
Abstract
multiple Subgraphs
Abstract
single Subgraph
…
…
Experimental!

Weitere ähnliche Inhalte

Ähnlich wie Graph Abstraction Concepts

A picture speaks a thousand words - Data Visualisation with R
A picture speaks a thousand words - Data Visualisation with RA picture speaks a thousand words - Data Visualisation with R
A picture speaks a thousand words - Data Visualisation with RBarbara Fusinska
 
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
 
Software Architecture: Principles, Patterns and Practices
Software Architecture: Principles, Patterns and PracticesSoftware Architecture: Principles, Patterns and Practices
Software Architecture: Principles, Patterns and PracticesGanesh Samarthyam
 
Advanced sass/compass
Advanced sass/compassAdvanced sass/compass
Advanced sass/compassNick Cooley
 
MongoDB.local DC 2018: Tutorial - Data Analytics with MongoDB
MongoDB.local DC 2018: Tutorial - Data Analytics with MongoDBMongoDB.local DC 2018: Tutorial - Data Analytics with MongoDB
MongoDB.local DC 2018: Tutorial - Data Analytics with MongoDBMongoDB
 
MongoDB at ZPUGDC
MongoDB at ZPUGDCMongoDB at ZPUGDC
MongoDB at ZPUGDCMike Dirolf
 
Building DSLs with the Spoofax Language Workbench
Building DSLs with the Spoofax Language WorkbenchBuilding DSLs with the Spoofax Language Workbench
Building DSLs with the Spoofax Language WorkbenchEelco Visser
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBantoinegirbal
 
2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introduction2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introductionantoinegirbal
 
JavaScript / Web Engineering / Web Development / html + css + js/presentation
JavaScript / Web Engineering / Web Development / html + css + js/presentationJavaScript / Web Engineering / Web Development / html + css + js/presentation
JavaScript / Web Engineering / Web Development / html + css + js/presentationM Sajid R
 
From Shabby to Chic
From Shabby to ChicFrom Shabby to Chic
From Shabby to ChicRichard Bair
 
SVGo: a Go Library for SVG generation
SVGo: a Go Library for SVG generationSVGo: a Go Library for SVG generation
SVGo: a Go Library for SVG generationAnthony Starks
 
Mongo db washington dc 2014
Mongo db washington dc 2014Mongo db washington dc 2014
Mongo db washington dc 2014ikanow
 
Advanced Technology for Web Application Design
Advanced Technology for Web Application DesignAdvanced Technology for Web Application Design
Advanced Technology for Web Application DesignBryce Kerley
 
Neo4j: Import and Data Modelling
Neo4j: Import and Data ModellingNeo4j: Import and Data Modelling
Neo4j: Import and Data ModellingNeo4j
 
Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...
Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...
Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...Julian Hyde
 
MongoDB Aggregation Framework
MongoDB Aggregation FrameworkMongoDB Aggregation Framework
MongoDB Aggregation FrameworkCaserta
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasminePaulo Ragonha
 
managing big data
managing big datamanaging big data
managing big dataSuveeksha
 

Ähnlich wie Graph Abstraction Concepts (20)

A picture speaks a thousand words - Data Visualisation with R
A picture speaks a thousand words - Data Visualisation with RA picture speaks a thousand words - Data Visualisation with R
A picture speaks a thousand words - Data Visualisation with R
 
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
 
Software Architecture: Principles, Patterns and Practices
Software Architecture: Principles, Patterns and PracticesSoftware Architecture: Principles, Patterns and Practices
Software Architecture: Principles, Patterns and Practices
 
Advanced sass/compass
Advanced sass/compassAdvanced sass/compass
Advanced sass/compass
 
MongoDB.local DC 2018: Tutorial - Data Analytics with MongoDB
MongoDB.local DC 2018: Tutorial - Data Analytics with MongoDBMongoDB.local DC 2018: Tutorial - Data Analytics with MongoDB
MongoDB.local DC 2018: Tutorial - Data Analytics with MongoDB
 
MongoDB at ZPUGDC
MongoDB at ZPUGDCMongoDB at ZPUGDC
MongoDB at ZPUGDC
 
Building DSLs with the Spoofax Language Workbench
Building DSLs with the Spoofax Language WorkbenchBuilding DSLs with the Spoofax Language Workbench
Building DSLs with the Spoofax Language Workbench
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introduction2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introduction
 
JavaScript / Web Engineering / Web Development / html + css + js/presentation
JavaScript / Web Engineering / Web Development / html + css + js/presentationJavaScript / Web Engineering / Web Development / html + css + js/presentation
JavaScript / Web Engineering / Web Development / html + css + js/presentation
 
From Shabby to Chic
From Shabby to ChicFrom Shabby to Chic
From Shabby to Chic
 
SVGo: a Go Library for SVG generation
SVGo: a Go Library for SVG generationSVGo: a Go Library for SVG generation
SVGo: a Go Library for SVG generation
 
Mongo db washington dc 2014
Mongo db washington dc 2014Mongo db washington dc 2014
Mongo db washington dc 2014
 
Advanced Technology for Web Application Design
Advanced Technology for Web Application DesignAdvanced Technology for Web Application Design
Advanced Technology for Web Application Design
 
Neo4j: Import and Data Modelling
Neo4j: Import and Data ModellingNeo4j: Import and Data Modelling
Neo4j: Import and Data Modelling
 
Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...
Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...
Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...
 
Polyalgebra
PolyalgebraPolyalgebra
Polyalgebra
 
MongoDB Aggregation Framework
MongoDB Aggregation FrameworkMongoDB Aggregation Framework
MongoDB Aggregation Framework
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
 
managing big data
managing big datamanaging big data
managing big data
 

Mehr von openCypher

Learning Timed Automata with Cypher
Learning Timed Automata with CypherLearning Timed Automata with Cypher
Learning Timed Automata with CypheropenCypher
 
Incremental View Maintenance for openCypher Queries
Incremental View Maintenance for openCypher QueriesIncremental View Maintenance for openCypher Queries
Incremental View Maintenance for openCypher QueriesopenCypher
 
Formal semantics for Cypher queries and updates
Formal semantics for Cypher queries and updatesFormal semantics for Cypher queries and updates
Formal semantics for Cypher queries and updatesopenCypher
 
Cypher.PL: an executable specification of Cypher semantics
Cypher.PL: an executable specification of Cypher semanticsCypher.PL: an executable specification of Cypher semantics
Cypher.PL: an executable specification of Cypher semanticsopenCypher
 
Multiple Graphs: Updatable Views
Multiple Graphs: Updatable ViewsMultiple Graphs: Updatable Views
Multiple Graphs: Updatable ViewsopenCypher
 
Micro-Servicing Linked Data
Micro-Servicing Linked DataMicro-Servicing Linked Data
Micro-Servicing Linked DataopenCypher
 
From Cypher 9 to GQL: Conceptual overview of multiple named graphs and compos...
From Cypher 9 to GQL: Conceptual overview of multiple named graphs and compos...From Cypher 9 to GQL: Conceptual overview of multiple named graphs and compos...
From Cypher 9 to GQL: Conceptual overview of multiple named graphs and compos...openCypher
 
Cypher for Gremlin
Cypher for GremlinCypher for Gremlin
Cypher for GremlinopenCypher
 
Comparing PGQL, G-Core and Cypher
Comparing PGQL, G-Core and CypherComparing PGQL, G-Core and Cypher
Comparing PGQL, G-Core and CypheropenCypher
 
Multiple graphs in openCypher
Multiple graphs in openCypherMultiple graphs in openCypher
Multiple graphs in openCypheropenCypher
 
Eighth openCypher Implementers Group Meeting: Status Update
Eighth openCypher Implementers Group Meeting: Status UpdateEighth openCypher Implementers Group Meeting: Status Update
Eighth openCypher Implementers Group Meeting: Status UpdateopenCypher
 
Cypher for Gremlin
Cypher for GremlinCypher for Gremlin
Cypher for GremlinopenCypher
 
Supporting dates and times in Cypher
Supporting dates and times in CypherSupporting dates and times in Cypher
Supporting dates and times in CypheropenCypher
 
Seventh openCypher Implementers Group Meeting: Status Update
Seventh openCypher Implementers Group Meeting: Status UpdateSeventh openCypher Implementers Group Meeting: Status Update
Seventh openCypher Implementers Group Meeting: Status UpdateopenCypher
 
Academic research on graph processing: connecting recent findings to industri...
Academic research on graph processing: connecting recent findings to industri...Academic research on graph processing: connecting recent findings to industri...
Academic research on graph processing: connecting recent findings to industri...openCypher
 
Property Graphs with Time
Property Graphs with TimeProperty Graphs with Time
Property Graphs with TimeopenCypher
 
Cypher.PL: Executable Specification of Cypher written in Prolog
Cypher.PL: Executable Specification of Cypher written in PrologCypher.PL: Executable Specification of Cypher written in Prolog
Cypher.PL: Executable Specification of Cypher written in PrologopenCypher
 
Use case: processing multiple graphs
Use case: processing multiple graphsUse case: processing multiple graphs
Use case: processing multiple graphsopenCypher
 
openCypher Technology Compatibility Kit (TCK)
openCypher Technology Compatibility Kit (TCK)openCypher Technology Compatibility Kit (TCK)
openCypher Technology Compatibility Kit (TCK)openCypher
 
Cypher Editor in the Web
Cypher Editor in the WebCypher Editor in the Web
Cypher Editor in the WebopenCypher
 

Mehr von openCypher (20)

Learning Timed Automata with Cypher
Learning Timed Automata with CypherLearning Timed Automata with Cypher
Learning Timed Automata with Cypher
 
Incremental View Maintenance for openCypher Queries
Incremental View Maintenance for openCypher QueriesIncremental View Maintenance for openCypher Queries
Incremental View Maintenance for openCypher Queries
 
Formal semantics for Cypher queries and updates
Formal semantics for Cypher queries and updatesFormal semantics for Cypher queries and updates
Formal semantics for Cypher queries and updates
 
Cypher.PL: an executable specification of Cypher semantics
Cypher.PL: an executable specification of Cypher semanticsCypher.PL: an executable specification of Cypher semantics
Cypher.PL: an executable specification of Cypher semantics
 
Multiple Graphs: Updatable Views
Multiple Graphs: Updatable ViewsMultiple Graphs: Updatable Views
Multiple Graphs: Updatable Views
 
Micro-Servicing Linked Data
Micro-Servicing Linked DataMicro-Servicing Linked Data
Micro-Servicing Linked Data
 
From Cypher 9 to GQL: Conceptual overview of multiple named graphs and compos...
From Cypher 9 to GQL: Conceptual overview of multiple named graphs and compos...From Cypher 9 to GQL: Conceptual overview of multiple named graphs and compos...
From Cypher 9 to GQL: Conceptual overview of multiple named graphs and compos...
 
Cypher for Gremlin
Cypher for GremlinCypher for Gremlin
Cypher for Gremlin
 
Comparing PGQL, G-Core and Cypher
Comparing PGQL, G-Core and CypherComparing PGQL, G-Core and Cypher
Comparing PGQL, G-Core and Cypher
 
Multiple graphs in openCypher
Multiple graphs in openCypherMultiple graphs in openCypher
Multiple graphs in openCypher
 
Eighth openCypher Implementers Group Meeting: Status Update
Eighth openCypher Implementers Group Meeting: Status UpdateEighth openCypher Implementers Group Meeting: Status Update
Eighth openCypher Implementers Group Meeting: Status Update
 
Cypher for Gremlin
Cypher for GremlinCypher for Gremlin
Cypher for Gremlin
 
Supporting dates and times in Cypher
Supporting dates and times in CypherSupporting dates and times in Cypher
Supporting dates and times in Cypher
 
Seventh openCypher Implementers Group Meeting: Status Update
Seventh openCypher Implementers Group Meeting: Status UpdateSeventh openCypher Implementers Group Meeting: Status Update
Seventh openCypher Implementers Group Meeting: Status Update
 
Academic research on graph processing: connecting recent findings to industri...
Academic research on graph processing: connecting recent findings to industri...Academic research on graph processing: connecting recent findings to industri...
Academic research on graph processing: connecting recent findings to industri...
 
Property Graphs with Time
Property Graphs with TimeProperty Graphs with Time
Property Graphs with Time
 
Cypher.PL: Executable Specification of Cypher written in Prolog
Cypher.PL: Executable Specification of Cypher written in PrologCypher.PL: Executable Specification of Cypher written in Prolog
Cypher.PL: Executable Specification of Cypher written in Prolog
 
Use case: processing multiple graphs
Use case: processing multiple graphsUse case: processing multiple graphs
Use case: processing multiple graphs
 
openCypher Technology Compatibility Kit (TCK)
openCypher Technology Compatibility Kit (TCK)openCypher Technology Compatibility Kit (TCK)
openCypher Technology Compatibility Kit (TCK)
 
Cypher Editor in the Web
Cypher Editor in the WebCypher Editor in the Web
Cypher Editor in the Web
 

Kürzlich hochgeladen

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
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
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
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
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
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
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 

Kürzlich hochgeladen (20)

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
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
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
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!
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
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
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 

Graph Abstraction Concepts

  • 1. Graph Abstraction Hannes Voigt MATCH (oldGraph) CONSTRUCT (newGraph)
  • 2. 2 Hannes Voigt Starting June 2018 ! Language and Standards Group, Neo4j Before ! Postdoc at Database System Group, ! Technische Universität Dresden Education and Experience ! Ph.D. from Technische Universität Dresden in 2014 ! Visiting scholar at SAP Labs, Palo Alto for one year in 2010 ! Visiting scholar at University Waterloo, for 4 months in 2007 Activities ! LDBC Graph Query Language Standardization Task Force ! Graph-related industry activities with SAP HANA Graph and openCypher ! Involvement with Graphs and Graph QLs since early 2010
  • 3. 3 Short Commercial Break Life of a Property Graph Query ! Data Models ! Query Languages ! Constraints ! Query Specification ! Data Structures and Indexing ! Query Processing ! Physical Operators Currently under review … … and to be appear soon
  • 5. 5 Concept Chasm Users talk about… ! Application entities ! e.g. discussions, communities, topics, etc. ! Multiple abstraction levels Base data contains… ! Fine granular data ! Low abstraction ! E.g. individual twitter messages, retweet relationships, etc. e.g. discussions, communities, abstrac Base data contains Fine granular data Low abstraction [Martin Grandjean, https://commons.wikimedia.org/wiki/File:Social_Network_Analysis_Visualization.png, 2014] abstraction Base data 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
  • 6. 6 Graph Abstraction Match -> variable bindings Different types of variables ▪ Value variable ▪ Vertex variable ▪ Edge variables ▪ (Path variables) ▪ ((Sub)Graph variables) Match Pattern !" … !$ Variable Bindings
  • 7. 7 Graph Abstraction Match -> variable bindings -> production Different types of variables ▪ Value variable ▪ Vertex variable ▪ Edge variables ▪ (Path variables) ▪ ((Sub)Graph variables) Idea in general ▪ Create the resulting graph by instantiate production pattern ▪ Make it is intuitive as match patterns ▪ Make it use the same intuition as match Match Pattern Production Pattern !" … !$ Variable Bindings
  • 8. 8 Graph Abstraction Match -> variable bindings -> production Different types of variables ▪ Value variable ▪ Vertex variable ▪ Edge variables ▪ (Path variables) ▪ ((Sub)Graph variables) Idea in little more detail ▪ Existing vertices from bound vertex variables ▪ New vertices with new unbound vertex variables ▪ Edges either implicit (via vertex variable) or explicit (with edge variables) ▪ Existing values from bound value variable ▪ Bound/unbound is a parse time property Match Pattern Production Pattern !" … !$ Variable Bindings
  • 9. 9 Graph Abstraction Match -> variable bindings -> production Different types of variables ▪ Value variable ▪ Vertex variable ▪ Edge variables ▪ (Path variables) ▪ ((Sub)Graph variables) Production ▪ Existing vertices from bound vertex variables ▪ New vertices with new unbound vertex variables ▪ Edges either implicit (via vertex variable) or explicit (with edge variables) ▪ Existing values from bound value variable ▪ Bound/unbound is a parse time property Production Pattern !" … !$ Variable Bindings Scope of this talk
  • 10. 10 Graph Abstraction Match -> variable bindings -> production Different types of variables ▪ Value variable ▪ Vertex variable ▪ Edge variables ▪ (Path variables) ▪ ((Sub)Graph variables) Production ▪ Existing vertices from bound vertex variables ▪ New vertices with new unbound vertex variables ▪ Edges either implicit (via vertex variable) or explicit (with edge variables) ▪ Existing values from bound value variable ▪ Bound/unbound is a parse time property Match Pattern Production Pattern !" … !$ Variable Bindings Scope of this talk Hi, I am just for beauty
  • 12. 12 Super Simple Example 2 3 1 Base Graph Result Graph MATCH (a)-->(b) CONSTRUCT (a)-->(c)<--(b)
  • 13. 13 Super Simple Example ! " # ! " $ Result Graph a b a b c Base Graph MATCH (a)-->(b) CONSTRUCT (a)-->(c)<--(b)
  • 14. 14 MATCH (a)-->(b) CONSTRUCT (a)-->(c)<--(b) Super Simple Example ! " # ! " # $ % Result Graph $ a b ! a b % c Base Graph
  • 15. 15 MATCH (a)-->(b) CONSTRUCT (a)-->(c)<--(b) Super Simple Example ! " # ! " # $ % & Result Graph " a b a # b % c Base Graph
  • 16. 16 MATCH (a)-->(b) CONSTRUCT (a)-->(c)<--(b) Super Simple Example ! " # ! " # $ % & Result Graph " a b Base Graph same as MATCHMATCH (a)(a)------>(b)MATCH CONSTRUCT (a)MATCH (a) CONSTRUCTCONSTRUCTCONSTRUCTCONSTRUCT (a) (a) (a)(a)(a)(a)(a)------>-- ()<--(b) >(b)>(b)>(b)>(b) >>>()()() >(b)>(b) ()()()()()() >(b) <<<----------(b)(b)(b)(b) Not mentioned variables are unbound. Think of it as there is a variable, you just don’t know its name
  • 17. 17 same as MATCH (a)-->(b) CONSTRUCT (a)-->()<--(b) MATCH (a)-->(b) CONSTRUCT (a)-->(c)<--(b) Super Simple Example ! " # ! " # $ % & Result Graph " a b Note:Note: ! Note:Note: Identities for new vertices are systemIdentities for new vertices are system-Identities for new vertices are system-generated!! Identities for new vertices are system ! Identities for new vertices are systemIdentities for new vertices are systemIdentities for new vertices are systemIdentities for new vertices are systemIdentities for new vertices are system-generatedgeneratedgenerated! Identities for new vertices are systemIdentities for new vertices are system Specific ID values (e.g. 4) are not important!!! Specific ID values (e.g. 4) are not important ! 17 Specific ID values (e.g. 4) are not importantSpecific ID values (e.g. 4) are not importantSpecific ID values (e.g. 4) are not importantSpecific ID values (e.g. 4) are not importantSpecific ID values (e.g. 4) are not importantSpecific ID values (e.g. 4) are not importantSpecific ID values (e.g. 4) are not important! Specific ID values (e.g. 4) are not importantSpecific ID values (e.g. 4) are not importantSpecific ID values (e.g. 4) are not importantSpecific ID values (e.g. 4) are not important ! As long as they are unique per variable and match group Base Graph
  • 18. 18 Identities New object identities ▪ Assuming a binding table ! with schema " ! = $%, … , $( and ▪ An object construction pattern with variable ) with ) ∉ " ! ▪ A new identity + is generated with + = , variableNameOf ) , $%, … , $( where , is a Skolem function Match Pattern Production Pattern 89 … 8: Variable Bindings
  • 19. 19 Identities New object identities ▪ Assuming a binding table ! with schema " ! = $%, … , $( and ▪ An object construction pattern with variable ) with ) ∉ " ! ▪ A new identity + is generated with + = , variableNameOf ) , $%, … , $( where , is a Skolem function Match Pattern Production Pattern 89 … 8: Variable Bindings Construction Domain Construction Instance
  • 20. 20 Identities New object identities ! Assuming a binding table ! with schema " ! # $%& ' & $( and ! An object construction pattern with variable ) with ) * " ! ! A new identity + is generated with + # , -./0.1234.5367 ) & $%& ' & $( where , is a Skolem function Match Pattern Production Pattern 89 ' 8: Variable Bindings Construction Domain Construction Instance In a nutshell: , In a nutshell: returns same identities for the In a nutshell: In a nutshell: In a nutshell: ,, returns same identities for the returns same identities for the returns same identities for the same input parameter returns same identities for the returns same identities for the same input parameter values
  • 21. 21 Identities New object identities ▪ Assuming a binding table ! with schema " ! = $%, … , $( and ▪ An object construction pattern with variable ) with ) ∉ " ! ▪ A new identity + is generated with + = , variableNameOf ) , 89:;< where , is a Skolem function Match Pattern Production Pattern => … =? Variable Bindings Construction Domain Construction Instance For bag semantics construction instance is determined by the row id of the row in the binding table
  • 22. 22 Aspects of Identity Generation Object Identities ▪ Should be a pure technical aspect and not of user concern - System-generated in any case ▪ Queries can involve object (node, edge) constructors ▪ Object constructor produces new object identities (ID values) The scope of ID uniqueness is the transaction (query) ▪ ID uniqueness guarantied within a single transactions (query) ▪ ID uniqueness not guarantied across multiple transactions (query) Repeatability of ID generation is not guarantied ▪ The same query on an unchanged dataset can return different IDs
  • 24. 24 Find vertices connected by chain of triangles Composability Base data G1 3 4 5 7 8 [:friends] 2 6
  • 25. 25 Composability Find vertices connected by chain of triangles ▪ Simplified syntax Base data G1 3 4 5 7 8 [:friends] 1 2 3 4 2 6 [:contains] --1st abstraction step MATCH (p1)-[:friends]-(p2), (p2)-[:friends]-(p3)-[:friends]-(p1) CONSTRUCT (t:FriendsTriangle)-[:contains]->(p1), (t)-[:contains]->(p2), (t)-[:contains]->(p3)
  • 26. 26 Composability Find vertices connected by chain of triangles ▪ Simplified syntax Base data G1 3 4 5 7 8 [:friends] [:connected] 1 2 3 4 2 6 [:contains] --1st abstraction step MATCH (p1)-[:friends]-(p2), (p2)-[:friends]-(p3)-[:friends]-(p1) CONSTRUCT (t:FriendsTriangle)-[:contains]->(p1), (t)-[:contains]->(p2), (t)-[:contains]->(p3) --2nd abstraction step MATCH (t1)-[:contains]->(pa)<-[:contains]-(t2), (t1)-[:contains]->(pb)<-[:contains]-(t2) WHERE pa!=pb CONSTRUCT (t1)-[:connected]->(t2)
  • 27. 27 Composability Find vertices connected by chain of triangles ! Simplified syntax --1st abstraction step MATCH (p1)-[:friends]-(p2), (p2)-[:friends]-(p3)-[:friends]-(p1) CONSTRUCT (t:FriendsTriangle)-[:contains]->(p1), (t)-[:contains]->(p2), (t)-[:contains]->(p3) --2nd abstraction step MATCH (t1)-[:contains]->(pa)<-[:contains]-(t2), (t1)-[:contains]->(pb)<-[:contains]-(t2) WHERE pa!=pb CONSTRUCT (t1)-[:connected]->(t2) --3rd abstraction step MATCH (pa)<-[:contains]-(ta), (ta)-/tp:connected*/->(tb), (tb)-[:contains]->(pb) RETURN pa, pb, length(tp)+1 AS triangleDist Base data G1 3 4 5 7 8 [:friends] 5 pa pb triangleDist 2 6 3 ! ! ! [:connected] 1 2 3 4 [:friends] 2 6 [:contains]
  • 28. 28 Use for DML General ▪ Just a matter of the target graph, which the concept is agnostic about Create new elements ▪ CONSTRUCT (:Person {name: 'Hannes’}), (:Talk {title: 'GraghAgg'}) CONSTRUCT (h)-[g:GIVES]->(t) ▪ Input per definition: Binding table containing one empty tuples (no columns) ▪ 1st CONSTRUCT: Nodes h and t unbound à are created ▪ 2nd CONSTRUCT: Nodes h and t are bound à are already in the target graph Edge g is unbound à is created Merge in new elements ▪ Assume (:Person {name: 'Hannes'}) already exists in the target graph ▪ MATCH (h:Person {name: 'Hannes'}) CONSTRUCT (h)-[g:GIVES]->(t:Talk {title: 'GraghAgg'}) ▪ Node h is bound à are already in the target graph ▪ Edge g and node t are unbound à are created
  • 31. 31 Simple Example with Grouping 2 3 1 Base Graph MATCH (a)-->(b) CONSTRUCT (c GROUP a)
  • 32. 32 Simple Example with Grouping ! " # Base Graph Syntax alternative ! PER ! GROUP BY! Outside the pattern ! … MATCH (a)-->(b) CONSTRUCT (c GROUP a)
  • 33. 33 Base Graph < Simple Example with Grouping 2 3 1 4 Result Graph Group with a=2 MATCH (a)-->(b) CONSTRUCT (c GROUP a)
  • 34. 34 Base Graph < Simple Example with Grouping 2 3 1 5 4 Result Graph Group with a=2 Group with a=3 MATCH (a)-->(b) CONSTRUCT (c GROUP a)
  • 35. 35 Simple Example with Grouping 2 3 1 MATCH (a)-[e]->(b) CONSTRUCT (c GROUP a,b,e) Base Graph
  • 36. 36 Base Graph Simple Example with Grouping 2 3 1 6 54 Result Graph MATCH (a)-[e]->(b) CONSTRUCT (c GROUP a,b,e)
  • 37. 37 Base Graph Simple Example with Grouping ! " # $ %& Result Graph same as MATCH (a)-[e]->(b) CONSTRUCT (c GROUP a,b,e) Grouping subsumes simple construction (level 1). Allows syntax shortcuts. (Assuming set semantics.)MATCH (a)-->(b) CONSTRUCT (c)
  • 38. 38 Simple Example with Grouping MATCH (a)-->(b) CONSTRUCT (c GROUP a), (d GROUP b) 2 3 1 Base Graph
  • 39. 39 Base Graph < Simple Example with Grouping 2 3 1 5 4 Result Graph Group with a=2 Group with a=3 MATCH (a)-->(b) CONSTRUCT (c GROUP a), (d GROUP b)
  • 40. 40 Base Graph < Simple Example with Grouping 2 3 1 5 4 7 6 Result GraphGroup with b=1 Group with b=3 MATCH (a)-->(b) CONSTRUCT (c GROUP a), (d GROUP b)
  • 41. 41 Simple Example with Grouping 2 3 1 5 4 7 6 Result GraphBase Graph MATCH (a)-->(b) CONSTRUCT (c GROUP a)-[e]->(d GROUP b) ?
  • 42. 42 Simple Example with Grouping 2 3 1 5 4 7 6 Result GraphBase Graph MATCH (a)-->(b) CONSTRUCT (c GROUP a)-[e GROUP a,b]->(d GROUP b) same as MATCH (a)-->(b) CONSTRUCT (c GROUP a)-[e]->(d GROUP b) Edges are implicitly grouped by the grouping keys of their nodes (and may define additional grouping keys themselves)
  • 43. 43 Simple Example with Grouping ! " # $$ Result Graph % & ' Base Graph MATCH (a)-->(b) CONSTRUCT (c GROUP a)-[e GROUP a,b]->(d GROUP b) same as MATCH (a)-->(b) CONSTRUCT (c GROUP a)-[e]->(d GROUP b) Edges are implicitly grouped by the grouping keys of their nodes (and may define additional grouping keys themselves)
  • 44. 44 Base Graph Simple Example with Grouping ! " # $$ Result Graph % & ' MATCH (a)-->(b) CONSTRUCT (c GROUP a)-[e GROUP a,b]->(d GROUP b) same as MATCH (a)-->(b) CONSTRUCT (c GROUP a)-[e]->(d GROUP b) Edges are implicitly grouped by the grouping keys of their nodes (and may define additional grouping keys themselves)
  • 45. 45 Base Graph Simple Example with Grouping ! " # Result Graph $ % & ' MATCH (a)-->(b) CONSTRUCT (c GROUP a)-[e GROUP a,b]->(d GROUP b) same as MATCH (a)-->(b) CONSTRUCT (c GROUP a)-[e]->(d GROUP b) Edges are implicitly grouped by the grouping keys of their nodes (and may define additional grouping keys themselves)
  • 46. 46 Base Graph Simple Example with Grouping ! " # Result Graph $ % # MATCH (a)-->(b) CONSTRUCT (c GROUP a)-[e GROUP a,b]->(b GROUP b) same as b is bound, hence, already in the graph or replicated depending on the target graph MATCH (a)-->(b) CONSTRUCT (c GROUP a)-[e]->(b) "
  • 47. 47 Aggregation in Graph Construction Vertex patterns ▪ Have grouping variables: (x GROUP a,b …) ▪ Grouping variables must be a subset of the set of all bound variables ▪ Bound vertices must have their vertex variable as grouping variable, hence (x GROUP x …) is the same as (x …) if x is a bound variable ▪ Unbound vertices without specified grouping variables, are implicitly grouped by all bound variables, hence (x …) is the same as (x GROUP a,b …) if x is an unbound variable and a and b are all bound variables Edge patterns ▪ Inherit grouping if they connect one or two grouping vertices ▪ Edges can have own grouping variables, that are added to the inherit grouping attributes General ▪ All bound variables not used as group variable can be used in the same object patter only in an aggregation function
  • 48. 48 Identities New object identities with Aggregation ▪ Assuming a binding table ! with schema " ! and ▪ An object construction pattern with variable # ∉ " ! and grouping variables %&, … , %) ⊆ " ! ▪ A new identity + is generated with + = - variableNameOf # , %&, … , %) where - is a Skolem function Match Pattern Production Pattern 9: … 9; Variable Bindings Construction Domain Construction Instance
  • 49. 49 Replicating and Copying (cf. Stefan’s Talk) Let x be a bound variable à Replication ▪ (x) à Replication is standard behavior for bound variables ▪ Note that (x) is a shortcut for (x GROUP x) ▪ Clones x into the output graph ▪ Creates new node with identity ! = # variableNameOf / , / ▪ System may also track lineage of x
  • 50. 50 Replicating and Copying (cf. Stefan’s Talk) Let x be a bound variable à Replication ▪ (x) à Cloning is standard behavior for bound variables ▪ Note that (x) is a shortcut for (x GROUP x) ▪ Clones x into the output graph ▪ Creates new node with identity ! = # variableNameOf / , / ▪ System may also track lineage of x Let x be a bound variable à Copying ▪ (y COPY x) à new node with all labels and properties of x copied over ▪ Copies x‘s data into the output graph ▪ Creates new node with identity ! = # variableNameOf / , 12, … , 14 ▪ Note that this may copy the data of a specific node x multiple time into the target graph ▪ 1:1 copying can be ensured by grouping: (y COPY x GROUP x) ▪ No lineage tracking
  • 51. 51 Use for DML General ▪ Grouping gives explicit control over distinctness of created elements Create new nodes for distinct values ▪ MATCH (p:Person) UNWIND p.talks AS s CONSTRUCT (p)-[:GIVES]->(t GROUP s :Talk {title: s}) ▪ Gives you a :Talk node for every distinct s value ▪ If multiple people gave the same talk, they all will be connected to the same :Talk node
  • 52. 52 Use for DML Create new edges for distinct values ▪ MATCH (h:Person)-[:GIVES]->(t:Talk) UNWIND t.dates AS d CONSTRUCT (h)-[g GROUP d :GIVES {date: d}]->(t) ▪ If a talk was given at multiple times, the same pair of person and talk node will get connected by one edge for each distinct date the talk was given between (g grouped by h, t, and d)
  • 53. 53 Use for DML Create new edges for distinct values ▪ MATCH (h:Person)-[:GIVES]->(t:Talk) UNWIND t.dates AS d CONSTRUCT (h)-[g GROUP d :GIVES {date: d}]->(t) ▪ If a talk was given at multiple times, the same pair of person and talk node will get connected by one edge for each distinct date the talk was given between (g grouped by h, t, and d) ▪ What happens if a talk was given multiple times at the same day?
  • 54. 54 Use for DML Create new edges for distinct values ▪ MATCH (h:Person)-[:GIVES]->(t:Talk) UNWIND t.dates AS d CONSTRUCT (h)-[g GROUP d :GIVES {date: d}]->(t) ▪ If a talk was given at multiple times, the same pair of person and talk node will get connected by one edge for each distinct date the talk was given between (g grouped by h, t, and d) ▪ What happens if a talk was given multiple times at the same day? Create new elements for every row in the binding table ▪ Note, binding table has bag semantics ▪ MATCH (h:Person {name: 'Hannes'}) UWIND [1,2,2,3] AS x CONSTRUCT (h)-[g:FAVORITE_NUMBERS]->(n GROUP ROW {num: x}) ▪ Will definitely create four n nodes: ({num:1}), ({num:2}), ({num:2}), ({num:3})
  • 56. 56 Example with Grouping age=40 !" age=35 !# class=Compact $" class=Intermediate $% MATCH (p:Person {age=a})-[:drives]->(c:Car {class=k}) CONSTRUCT … class=Compact $# age=35 !& Syntax Proposal: age=45 !' Matched Base Graph Individual match with ! ( !#, ) ( *+, $ ( $", and , ( -./0123
  • 57. 57 Example with Grouping age=40 !" age=35 !# class=Compact $" MATCH (p:Person {age=a})-[:drives]->(c:Car {class=k}) CONSTRUCT … class=Compact $# age=35 !% Syntax Proposal: class=Compact Matched Base Graph Individual match with ! & !#, ' & (), $ & $", and * & +,-./01 Another individual match with ! & !2, ' & 3), $ & $4, and * & 56178-79:/17 class=Compactclass=Compact class=Intermediate $4age=45 !2
  • 58. 58 Example with Grouping age=40 !" age=35 !# name=Intermediate $% name=Compact $& number=3 number=1 number=1 class=Compact '" class=Intermediate '( MATCH (p:Person {age=a})-[:drives]->(c:Car {class=k}) CONSTRUCT (g GROUP a :AgeGroup {age=a, number=COUNT(DISTINCT p)}) -[:{numdrivers=COUNT(*)}]-> (z GROUP k :Class {name=k}) class=Compact '# age=35 !) Syntax Proposal: age=45 !& number=1 Matched Base Graph Result Graph name=Intermediate $% name=Compact $& number=3 number=1 number=1 number=1 -[:{numdrivers=COUNT(*)}]-> (z GROUP k :Class {name=k}) age=40 number=1 *& age=35 number=2 *% age=45 number=1 *)
  • 59. 59 Example with Grouping age=40 !" age=35 !# number=3 number=1 number=1 class=Compact $" class=Intermediate $% MATCH (p:Person {age=a})-[:drives]->(c:Car {class=k}) CONSTRUCT (g GROUP a :AgeGroup {age=a, number=COUNT(DISTINCT p)}) -[:{numdrivers=COUNT(*)}]-> (z GROUP k :Class {name=k}) class=Compact $# age=35 !& Syntax Proposal: age=45 !' number=1 Matched Base Graph Result Graph number=3 number=1 number=1 number=1 -[:{numdrivers=COUNT(*)}]-> age=40 number=1 (' age=35 number=2 () age=45 number=1 (& name=Intermediate *) name=Compact *'
  • 60. 60 Example with Grouping age=40 !" age=35 !# age=40 number=1 $% name=Intermediate &' age=35 number=2 $' name=Compact &% number=3 number=1 number=1 class=Compact (" class=Intermediate () class=Compact (# age=35 !* Syntax Proposal: age=45 !% age=45 number=1 $* number=1 Matched Base Graph Result Graph MATCH (p:Person {age=a})-[:drives]->(c:Car {class=k}) CONSTRUCT (g GROUP a :AgeGroup {age=a, number=COUNT(DISTINCT p)}) -[:{numdrivers=COUNT(*)}]-> (z GROUP k :Class {name=k})
  • 63. 63 Summarize the structure of a graph in a smaller graph ▪ Group all vertices and all edge ▪ Represent the relationship of the groups in a graph Graph Summarization [Peixiang Zhao et al.: Graph Cube: On Warehousing and OLAP Multidimensional Networks, SIGMOD 2011] c a f d h i b e g j !gender,COUNT ∗ ., !∅,COUNT ∗ 0 9 13 5 5 FriendsCo-workersSchema: Male/Teacher Female/Teacher Male/Lawyer Female/Lawyer
  • 64. 64 Summarize the structure of a graph in a smaller graph ▪ Group all vertices and all edge ▪ Represent the relationship of the groups in a graph !gender,job,COUNT ∗ 1, !∅,COUNT ∗ 3 Graph Summarization [Peixiang Zhao et al.: Graph Cube: On Warehousing and OLAP Multidimensional Networks, SIGMOD 2011] c a f d h i b e g j 2 1 1 2 4 3 3 3 2 2 !gender,COUNT ∗ 1, !∅,COUNT ∗ 3 9 13 5 5 FriendsCo-workersSchema: Male/Teacher Female/Teacher Male/Lawyer Female/Lawyer
  • 65. 65 Summarize the structure of a graph in a smaller graph ▪ Group all vertices and all edge ▪ Represent the relationship of the groups in a graph !gender,job,COUNT ∗ 1, !∅,COUNT ∗ 3 !gender,COUNT ∗ 1, !status,COUNT ∗ 3 Graph Summarization [Peixiang Zhao et al.: Graph Cube: On Warehousing and OLAP Multidimensional Networks, SIGMOD 2011] c a f d h i b e g j 6 12 31 5 5 2 1 1 2 4 3 3 3 2 2 !gender,COUNT ∗ 1, !∅,COUNT ∗ 3 9 13 5 5 FriendsCo-workersSchema: Male/Teacher Female/Teacher Male/Lawyer Female/Lawyer
  • 66. 66 Summarize with Construction Can Graph Summarization expressed as Graph Construction? ▪ Consider summarization !color &, !∅ ) ▪ First try: MATCH (a)-[e]->(b) CONSTRUCT (x GROUP a.color)-->(y GROUP b.color)
  • 67. 67 Summarize with Construction Can Graph Summarization expressed as Graph Construction? ▪ Consider summarization !color &, !∅ ) ▪ First try: Group with a.color=red MATCH (a)-[e]->(b) CONSTRUCT (x GROUP a.color)-->(y GROUP b.color)
  • 68. 68 Summarize with Construction Can Graph Summarization expressed as Graph Construction? ▪ Consider summarization !color &, !∅ ) ▪ First try: Group with b.color=blue MATCH (a)-[e]->(b) CONSTRUCT (x GROUP a.color)-->(y GROUP b.color)
  • 69. 69 Summarize with Construction Can Graph Summarization expressed as Graph Construction? ▪ Consider summarization !color &, !∅ ) ▪ First try: Group with b.color=red MATCH (a)-[e]->(b) CONSTRUCT (x GROUP a.color)-->(y GROUP b.color)
  • 70. 70 Summarize with Construction Can Graph Summarization expressed as Graph Construction? ▪ Consider summarization !color &, !∅ ) ▪ First try: Correct Summarization ≠ Does not work! MATCH (a)-[e]->(b) CONSTRUCT (x GROUP a.color)-->(y GROUP b.color)
  • 71. 71 Summarize with Construction Can Graph Summarization expressed as Graph Construction? ▪ Consider summarization !color &, !∅ ) ▪ First try: Correct Summarization ≠ Does not work! Problem: x and y are separate construction domains MATCH (a)-[e]->(b) CONSTRUCT (x GROUP a.color)-->(y GROUP b.color)
  • 72. 72 Summarize with Construction Can Graph Summarization expressed as Graph Construction? ▪ Consider summarization !color &, !∅ ) ▪ Solution: MATCH (a)-[e]->(b) CONSTRUCT (z AS x GROUP a.color)-->(z AS y GROUP b.color) Idea: Aliasing – Two instances (x and y) in a construction pattern from the same construction domain (z)
  • 73. 73 Summarize with Construction Can Graph Summarization expressed as Graph Construction? ▪ Consider summarization !color &, !∅ ) ▪ Solution: Group with a.color=red MATCH (a)-[e]->(b) CONSTRUCT (z AS x GROUP a.color)-->(z AS y GROUP b.color)
  • 74. 74 Summarize with Construction Can Graph Summarization expressed as Graph Construction? ▪ Consider summarization !color &, !∅ ) ▪ Solution: Group with b.color=blue MATCH (a)-[e]->(b) CONSTRUCT (z AS x GROUP a.color)-->(z AS y GROUP b.color)
  • 75. 75 Summarize with Construction Can Graph Summarization expressed as Graph Construction? ▪ Consider summarization !color &, !∅ ) ▪ Solution: Group with b.color=red MATCH (a)-[e]->(b) CONSTRUCT (z AS x GROUP a.color)-->(z AS y GROUP b.color)
  • 76. 76 Identities New object identities with Aggregation ▪ Assuming a binding table ! with schema ! " and ▪ An object construction pattern with variable # ∉ ! " , domain % ∉ ! " , grouping &', … , &* ⊆ ! " ▪ A new identity , is generated with , = . variableNameOf % , &', … , &* where . is a Skolem function Match Pattern Production Pattern :; … :< Variable Bindings Construction Domain Construction Instance
  • 77. Gain: Flexible Graph Summarization
  • 78. 78 Example Money Transfer between Groups 100 300 150 450 50 300220 130 100 500 750 900 600 50 MATCH (s1)<-[e:in]-(c1)-[e:transfer]->(c2)-[:in]->(s2) CONSTRUCT (g AS g1 GROUP s1) -[{amount=SUM(e.amount)}]-> (g AS g2 GROUP s2)
  • 79. 79 Example Money Movement of each Group 100 300 150 450 50 300220 130 100 500 flow: 2850 MATCH (s1)<-[e:in]-(c1)-[e:transfer]->(c2)-[:in]->(s2) CONSTRUCT (g AS g1 GROUP s1 {flow=SUM(e.amount)}) --> (g AS g2 GROUP s2 {flow=SUM(e.amount)}) flow: 1750
  • 80. 80 Example Cost and Revenue of each Group 100 300 150 450 50 300220 130 100 500 cost: -1350 revn: 1500 MATCH (s1)<-[e:in]-(c1)-[e:transfer]->(c2)-[:in]->(s2) CONSTRUCT (g AS g1 GROUP s1 {cost=SUM(-1*e.amount)}) --> (g AS g2 GROUP s2 {revn=SUM(e.amount)}) cost: -950 revn: 800
  • 81. 81 Example Profit of each Group 100 300 150 450 50 300220 130 100 500 prof: 150 MATCH (s1)<-[e:in]-(c1)-[e:transfer]->(c2)-[:in]->(s2) CONSTRUCT (g AS g1 GROUP s1 {prof=SUM(-1*e.amount)}) --> (g AS g2 GROUP s2 {prof=SUM(e.amount)}) prof: -150
  • 82. 82 Graph Abstraction … … Abstract Structure Abstract multiple Subgraphs Abstract single Subgraphs … …
  • 83. Cross-Match Construction – Level 4 Experimental!
  • 84. 84 Reminder: Regular Per-Match Construction Base Graph 2 3 1 Result Graph 5 4 MATCH (a)-->(b) CONSTRUCT (c GROUP a) Base Graph <2 3 1 4Group with a=2 Group with a=3
  • 85. 85 Cross-Match Construction Base Graph ! " # Result Graph $ MATCH (a)-->(b) CONSTRUCT (c GROUP a)-[e]->(ORDER BY id(a) 1 PRECEDING c) Base Graph ! " # id(a)=2 < id(a)=3 $ % $ Idea: Refer to nodes coming from a different match result The c created for the preceding match result according to ascending id of a
  • 86. 86 Cross-Match Construction Base Graph 2 3 1 Result Graph 5 4 MATCH (a)-->(b) CONSTRUCT (c)-[e]->(ORDER BY id(b),id(a) 1 PRECEDING c) Base Graph 2 3 1 4 6
  • 87. 87 Referencing relative to a given order Cross-Match Construction Base Graph ! " # Result Graph $ MATCH (a)-->(b) CONSTRUCT (c)-[e]->(ORDER BY id(b),id(a) 1 PRECEDING c) Base Graph ! " # $ % $ & ORDER BY id(b),id(a): (1,2) < (1,3) < (3,2)
  • 88. 88 Referencing relative to a given order Cross-Match Construction Base Graph ! " # Result Graph $ MATCH (a)-->(b) CONSTRUCT (c)-[e]->(ORDER BY id(b),id(a) 1 PRECEDING c) (c)-[e]->(ORDER BY id(b),id(a) 1 SUCCEEDING c) Base Graph ! " # ORDER BY id(b),id(a): (1,2) < (1,3) < (3,2) $ % $ &
  • 89. 89 Order is local to reference Cross-Match Construction Base Graph ! " # Result Graph $ MATCH (a)-->(b) CONSTRUCT (c)-[e]->(ORDER BY id(b),id(a) 1 PRECEDING c) (c)-[e]->(ORDER BY id(b),id(a) 1 SUCCEEDING c) (c)-[e]->(ORDER BY id(a),id(b) 1 PRECEDING c) Base Graph ! " # ORDER BY id(b),id(a): (1,2) < (1,3) < (3,2) ORDER BY id(a),id(b): (2,1) < (2,3) < (3,1) $ % $ &
  • 90. 90 In conjunction with Aliasing Cross-Match Construction Base Graph ! " # Result Graph $ MATCH (a)-->(b) CONSTRUCT (c)-[e:Prev]->(ORDER BY id(b),id(a) 1 PRECEDING c AS ca), (c)-[f:Succ]->(ORDER BY id(b),id(a) 1 SUCCEEDING c), (c)-[g:Prev2]->(ORDER BY id(a),id(b) 1 PRECEDING c AS cb), (ca)-[h:Cross]->(cb) Base Graph ! " # ORDER BY id(b),id(a): (1,2) < (1,3) < (3,2) ORDER BY id(a),id(b): (2,1) < (2,3) < (3,1) Result Graph $ % $ &
  • 91. 91 Referencing absolute to a given order Cross-Match Construction Base Graph ! " # Result Graph $ MATCH (a)-->(b) CONSTRUCT (c)-[e]->(ORDER BY id(b),id(a) FIRST c) Base Graph ! " # ORDER BY id(b),id(a): (1,2) < (1,3) < (3,2) $ % $ &
  • 92. 92 Referencing many Cross-Match Construction Base Graph ! " # Result Graph $ MATCH (a)-->(b) CONSTRUCT (c)-[e]->(ORDER BY id(b),id(a) ALL PRECEDING c) Base Graph ! " # ORDER BY id(b),id(a): (1,2) < (1,3) < (3,2) $ % $ &
  • 93. 93 Partitioning the order Cross-Match Construction Base Graph ! " # Result Graph $ MATCH (a)-->(b) CONSTRUCT (c)-[e]->(PARTITION a ORDER BY id(b),id(a) 1 PRECEDING c) Base Graph ! " # ORDER BY id(b),id(a): (1,2) < (3,2) | (1,3) $ % $ &
  • 94. 94 Cross-Match Construction Reference Production of other Match Results ▪ No additional identities are produced from the given match ▪ Only referring to identities produced of another match in the match result set ▪ The construction domain which is referred to does not have to be part of the pattern Syntax ▪ Referencing syntax can be design analogously to window specification in SQL OLAP functions Open questions ▪ Self referencing? Non-total orders? How does it compare to joins? … Matches Productions !" … !$ Variable Bindings
  • 95. Gain: New connections out of thin air
  • 96. 96 Example Coauthor network QueryGraphs GCORE Cypher Hannes Nikolay Tobias Stefan SIGMODSynthesis Lectures on DM
  • 97. 97 Example Coauthor network QueryGraphs GCORE Cypher Hannes Nikolay Tobias Stefan SIGMODSynthesis Lectures on DM MATCH (a)-[:AUTHORED]->(p)-[:APPEARED_IN]->(v), (b)-[:AUTHORED]->(p) a b p p.cit… v.imp… Stefan Tobias Cypher 150 50 Stefan Tobias GCORE 100 50 Stefan Hannes GCORE 100 50 Tobias Stefan Cypher 150 50 Tobias Stefan GCORE 100 50 Tobias Hannes GCORE 100 50 Hannes Stefan GCORE 100 50 Hannes Tobias GCORE 100 50 Hannes Nikolay QG 100 40 Nikolay Hannes QG 100 40
  • 98. 98 Example Coauthor network Top-coauthor network QueryGraphs GCORE Cypher Hannes Nikolay Tobias Stefan SIGMODSynthesis Lectures on DM MATCH (a)-[:AUTHORED]->(p)-[:APPEARED_IN]->(v), (b)-[:AUTHORED]->(p) CONSTRUCT (a)-[:TOP_COAUTHOR {paper: p.name}]-> (PARTITION a ORDER v.impactFactor * p.citations DESC ALL FIRST b) Hannes Nikolay Tobias Stefan a b p p.cit… v.imp… Stefan Tobias Cypher 150 50 Stefan Tobias GCORE 100 50 Stefan Hannes GCORE 100 50 Tobias Stefan Cypher 150 50 Tobias Stefan GCORE 100 50 Tobias Hannes GCORE 100 50 Hannes Stefan GCORE 100 50 Hannes Tobias GCORE 100 50 Hannes Nikolay QG 100 40 Nikolay Hannes QG 100 40 {name: GCORE} {name: GCORE}{name: QG} {name: Cypher}
  • 99. 99 Example Coauthor network Top-coauthor network QueryGraphs GCORE Cypher Hannes Nikolay Tobias Stefan SIGMODSynthesis Lectures on DM MATCH (a)-[:AUTHORED]->(p)-[:APPEARED_IN]->(v), (b)-[:AUTHORED]->(p) CONSTRUCT (a)-[:TOP_COAUTHOR {paper: p.name}]-> (PARTITION a ORDER v.impactFactor * p.citations DESC ALL FIRST b) Hannes Nikolay Tobias Stefan a b p p.cit… v.imp… Stefan Tobias Cypher 150 50 Stefan Tobias GCORE 100 50 Stefan Hannes GCORE 100 50 Tobias Stefan Cypher 150 50 Tobias Stefan GCORE 100 50 Tobias Hannes GCORE 100 50 Hannes Stefan GCORE 100 50 Hannes Tobias GCORE 100 50 Hannes Nikolay QG 100 40 Nikolay Hannes QG 100 40 {name: GCORE} {name: GCORE}{name: QG} {name: Cypher} Hannes
  • 100. 100 Example Coauthor network Top-coauthor network QueryGraphs GCORE Cypher Hannes Nikolay Tobias Stefan SIGMODSynthesis Lectures on DM MATCH (a)-[:AUTHORED]->(p)-[:APPEARED_IN]->(v), (b)-[:AUTHORED]->(p) CONSTRUCT (a)-[:TOP_COAUTHOR {paper: p.name}]-> (PARTITION a ORDER v.impactFactor * p.citations DESC ALL FIRST b) Hannes Nikolay Tobias Stefan a b p p.cit… v.imp… Stefan Tobias Cypher 150 50 Stefan Tobias GCORE 100 50 Stefan Hannes GCORE 100 50 Tobias Stefan Cypher 150 50 Tobias Stefan GCORE 100 50 Tobias Hannes GCORE 100 50 Hannes Stefan GCORE 100 50 Hannes Tobias GCORE 100 50 Hannes Nikolay QG 100 40 Nikolay Hannes QG 100 40 {name: GCORE} {name: GCORE}{name: QG} {name: Cypher} Tobias
  • 101. 101 Graph Abstraction … … … Abstract Structure Link Abstractions Abstract multiple Subgraphs Abstract single Subgraph … …
  • 103. 103 Concept Chasm Users talk about… ! Application entities ! e.g. discussions, communities, topics, etc. ! Multiple abstraction levels Base data contains… ! Fine granular data ! Low abstraction ! E.g. individual twitter messages, retweet relationships, etc. e.g. discussions, communities, abstrac Base data contains Fine granular data Low abstraction [Martin Grandjean, https://commons.wikimedia.org/wiki/File:Social_Network_Analysis_Visualization.png, 2014] abstraction Base data 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
  • 104. 104 Summary … … … Abstract Structure Link Abstraction Abstract multiple Subgraphs Abstract single Subgraph … … Experimental!