incremental graph queries for cypher€¦ · batch vs. incremental queries batch queries (pull /...
TRANSCRIPT
![Page 1: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/1.jpg)
Budapest University of Technology and EconomicsDepartment of Measurement and Information SystemsDepartment of Telecommunications and Media Informatics
Budapest University of Technology and EconomicsMcGill University, Montréal
Incremental Graph Queries for Cypher
Gábor Szárnyas, József Marton
![Page 2: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/2.jpg)
Live railway model
![Page 3: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/3.jpg)
Live railway model
![Page 4: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/4.jpg)
Live railway model
![Page 5: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/5.jpg)
Live railway model
![Page 6: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/6.jpg)
Live railway model
Proximity detection
![Page 7: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/7.jpg)
Live railway model
Proximity detection
![Page 8: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/8.jpg)
Live railway model
Proximity detection
![Page 9: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/9.jpg)
Live railway model
Trailing the switch
Proximity detection
![Page 10: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/10.jpg)
Live railway model
![Page 11: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/11.jpg)
Live railway model
![Page 12: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/12.jpg)
Live railway model
c d e
g
fdiv
2
a b
1
![Page 13: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/13.jpg)
Live railway model
c d e
g
fdiv
2
NEXT NEXT
STRAIGHT TOP
ON
a b
1
NEXT
ON
NEXT
![Page 14: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/14.jpg)
Proximity detection
Proximity detection
≤ 𝟐 segments
![Page 15: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/15.jpg)
Proximity detection
seg1
NEXT: 1..2
t1
ON
Proximity detection
seg2
t2
ON≤ 𝟐 segments
![Page 16: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/16.jpg)
Proximity detection
seg1
NEXT: 1..2
t1
ON
MATCH
(t1:Train)-[:ON]->(seg1:Segment)
-[:NEXT*1..2]->(seg2:Segment)
<-[:ON]-(t2:Train)
RETURN t1, t2, seg1, seg2
Proximity detection
seg2
t2
ON≤ 𝟐 segments
![Page 17: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/17.jpg)
Proximity detection
seg1
NEXT: 1..2
t1
ON
MATCH
(t1:Train)-[:ON]->(seg1:Segment)
-[:NEXT*1..2]->(seg2:Segment)
<-[:ON]-(t2:Train)
RETURN t1, t2, seg1, seg2
Proximity detection
seg2
t2
ON≤ 𝟐 segments
![Page 18: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/18.jpg)
Trailing the switch
![Page 19: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/19.jpg)
Trailing the switch
seg div
t
STRAIGHT
ON
![Page 20: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/20.jpg)
Trailing the switch
seg div
t
STRAIGHT
ON
MATCH (t:Train)-[:ON]->(seg:Segment)
<-[:STRAIGHT]-(sw:Switch)
WHERE sw.position = 'diverging'
RETURN t.number, sw
![Page 21: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/21.jpg)
Trailing the switch
seg div
t
STRAIGHT
ON
MATCH (t:Train)-[:ON]->(seg:Segment)
<-[:STRAIGHT]-(sw:Switch)
WHERE sw.position = 'diverging'
RETURN t.number, sw
![Page 22: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/22.jpg)
Trailing the switch
seg div
t
STRAIGHT
ON
MATCH (t:Train)-[:ON]->(seg:Segment)
<-[:STRAIGHT]-(sw:Switch)
WHERE sw.position = 'diverging'
RETURN t.number, sw
Evaluate continuously
![Page 23: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/23.jpg)
Incremental queries
![Page 24: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/24.jpg)
Incremental queries
Register a set of standing queries
Continuously evaluate queries on changes
![Page 25: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/25.jpg)
Incremental queries
Register a set of standing queries
Continuously evaluate queries on changes
The Rete algorithm (1974)
o Originally for rule-based expert systems
o Indexes the graph and caches interim query results
![Page 26: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/26.jpg)
πt.number, sw
σsw.position = ′diverging′
⋈
STRAIGHTON
divSTRAIGHT
Trailing the switchO
N
![Page 27: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/27.jpg)
πt.number, sw
σsw.position = ′diverging′
⋈
STRAIGHTON
c d e
g
fdiv
2
NEXT NEXT
STRAIGHT TOPa b
1
NEXT NEXTO
N
ON
divSTRAIGHT
Trailing the switchO
N
![Page 28: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/28.jpg)
πt.number, sw
σsw.position = ′diverging′
⋈
STRAIGHTON
c d e
g
fdiv
2
NEXT NEXT
STRAIGHT TOPa b
1
NEXT NEXTO
N
ON
divSTRAIGHT
Trailing the switchO
N
![Page 29: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/29.jpg)
πt.number, sw
σsw.position = ′diverging′
⋈
STRAIGHTON
c d e
g
fdiv
2
NEXT NEXT
STRAIGHT TOPa b
1
NEXT NEXTO
N
ON
divSTRAIGHT
Trailing the switchO
N
a
1
ON
e
2
ON
![Page 30: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/30.jpg)
πt.number, sw
σsw.position = ′diverging′
⋈
STRAIGHTON e2ON
a1ON
c d e
g
fdiv
2
NEXT NEXT
STRAIGHT TOPa b
1
NEXT NEXTO
N
ON
divSTRAIGHT
Trailing the switchO
N
a
1
ON
e
2
ON
![Page 31: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/31.jpg)
πt.number, sw
σsw.position = ′diverging′
⋈
STRAIGHTON e2ON
a1ON
c d e
g
fdiv
2
NEXT NEXT
STRAIGHT TOPa b
1
NEXT NEXTO
N
ON
divSTRAIGHT
Trailing the switchO
N
![Page 32: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/32.jpg)
πt.number, sw
σsw.position = ′diverging′
⋈
STRAIGHTON e2ON
a1ON
c d e
g
fdiv
2
NEXT NEXT
STRAIGHT TOPa b
1
NEXT NEXTO
N
ON
divSTRAIGHT
Trailing the switchO
N
e divSTRAIGHT
![Page 33: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/33.jpg)
πt.number, sw
σsw.position = ′diverging′
⋈
STRAIGHTON e2ON
a1ON
c d e
g
fdiv
2
NEXT NEXT
STRAIGHT TOPa b
1
NEXT NEXTO
N
ON
divSTRAIGHT
Trailing the switchO
N
e divSTRAIGHT
e divSTRAIGHT
![Page 34: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/34.jpg)
πt.number, sw
σsw.position = ′diverging′
⋈
STRAIGHTON e divSTRAIGHT
e2ON
a1ON
c d e
g
fdiv
2
NEXT NEXT
STRAIGHT TOPa b
1
NEXT NEXTO
N
ON
divSTRAIGHT
Trailing the switchO
N
![Page 35: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/35.jpg)
πt.number, sw
σsw.position = ′diverging′
⋈
STRAIGHTON e divSTRAIGHT
e2ON
a1ON
c d e
g
fdiv
2
NEXT NEXT
STRAIGHT TOPa b
1
NEXT NEXTO
N
ON
divSTRAIGHT
Trailing the switchO
N
e divSTRAIGHT
e2ON
![Page 36: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/36.jpg)
πt.number, sw
σsw.position = ′diverging′
⋈
STRAIGHTON e divSTRAIGHT
e2ON
a1ON
c d e
g
fdiv
2
NEXT NEXT
STRAIGHT TOPa b
1
NEXT NEXTO
N
ON
divSTRAIGHT
Trailing the switchO
N
e divSTRAIGHT
e2ON
e div
2
STRAIGHT
ON
![Page 37: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/37.jpg)
πt.number, sw
σsw.position = ′diverging′
⋈
STRAIGHTON e divSTRAIGHT
e2ON
a1ON
e divSTRAIGHT
2ON
c d e
g
fdiv
2
NEXT NEXT
STRAIGHT TOPa b
1
NEXT NEXTO
N
ON
divSTRAIGHT
Trailing the switchO
N
e divSTRAIGHT
e2ON
e div
2
STRAIGHT
ON
![Page 38: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/38.jpg)
πt.number, sw
σsw.position = ′diverging′
⋈
STRAIGHTON e divSTRAIGHT
e2ON
a1ON
divSTRAIGHTON
c d e
g
fdiv
2
NEXT NEXT
STRAIGHT TOPa b
1
NEXT NEXTO
N
ON
divSTRAIGHT
Trailing the switchO
N
e2 divSTRAIGHTON
e2
![Page 39: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/39.jpg)
πt.number, sw
σsw.position = ′diverging′
⋈
STRAIGHTON e divSTRAIGHT
e2ON
a1ON
divSTRAIGHTON
e divSTRAIGHT
2ON
c d e
g
fdiv
2
NEXT NEXT
STRAIGHT TOPa b
1
NEXT NEXTO
N
ON
divSTRAIGHT
Trailing the switchO
N
e2 divSTRAIGHTON
e2
![Page 40: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/40.jpg)
πt.number, sw
σsw.position = ′diverging′
⋈
STRAIGHTON e divSTRAIGHT
e2ON
a1ON
e divSTRAIGHT
2ON
e divSTRAIGHT
2ON
c d e
g
fdiv
2
NEXT NEXT
STRAIGHT TOPa b
1
NEXT NEXTO
N
ON
divSTRAIGHT
Trailing the switchO
N
div
2
![Page 41: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/41.jpg)
πt.number, sw
σsw.position = ′diverging′
⋈
STRAIGHTON e divSTRAIGHT
e2ON
a1ON
e divSTRAIGHT
2ON
e divSTRAIGHT
2ON
div2
c d e
g
fdiv
2
NEXT NEXT
STRAIGHT TOPa b
1
NEXT NEXTO
N
ON
divSTRAIGHT
Trailing the switchO
N
div
2
![Page 42: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/42.jpg)
πt.number, sw
σsw.position = ′diverging′
⋈
STRAIGHTON e divSTRAIGHT
e2ON
a1ON
e divSTRAIGHT
2ON
e divSTRAIGHT
2ON
div2
c d e
g
fdiv
2
NEXT NEXT
STRAIGHT TOPa b
1
NEXT NEXTO
N
ON
divSTRAIGHT
Trailing the switchO
N
div
2
![Page 43: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/43.jpg)
πt.number, sw
σsw.position = ′diverging′
⋈
STRAIGHTON e divSTRAIGHT
e2ON
a1ON
e divSTRAIGHT
2ON
e divSTRAIGHT
2ON
div2
c e
g
fdivNEXT NEXT
STRAIGHT TOPa b
1
NEXT NEXT
ON
divSTRAIGHT
Trailing the switchO
N
div
ON
2
d
![Page 44: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/44.jpg)
πt.number, sw
σsw.position = ′diverging′
⋈
STRAIGHTON e divSTRAIGHT
d2ON
a1ON
e divSTRAIGHT
2ON
e divSTRAIGHT
2ON
div2
c e
g
fdivNEXT NEXT
STRAIGHT TOPa b
1
NEXT NEXT
ON
divSTRAIGHT
Trailing the switchO
N
div
ON
2
d
![Page 45: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/45.jpg)
πt.number, sw
σsw.position = ′diverging′
⋈
STRAIGHTON e divSTRAIGHT
d2ON
a1ON
e divSTRAIGHT
2ON
div2
c e
g
fdivNEXT NEXT
STRAIGHT TOPa b
1
NEXT NEXT
ON
divSTRAIGHT
Trailing the switchO
N
div
ON
2
d
![Page 46: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/46.jpg)
πt.number, sw
σsw.position = ′diverging′
⋈
STRAIGHTON e divSTRAIGHT
d2ON
a1ON
div2
c e
g
fdivNEXT NEXT
STRAIGHT TOPa b
1
NEXT NEXT
ON
divSTRAIGHT
Trailing the switchO
N
div
ON
2
d
![Page 47: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/47.jpg)
πt.number, sw
σsw.position = ′diverging′
⋈
STRAIGHTON e divSTRAIGHT
d2ON
a1ON
c e
g
fdivNEXT NEXT
STRAIGHT TOPa b
1
NEXT NEXT
ON
divSTRAIGHT
Trailing the switchO
N
div
ON
2
d
![Page 48: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/48.jpg)
Batch vs. incremental queries
Batch queries(pull / request-driven):
1. Client selects a query
2. Results are calculated
Query resultsobtained on demand
![Page 49: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/49.jpg)
Batch vs. incremental queries
Batch queries(pull / request-driven):
1. Client selects a query
2. Results are calculated
Query resultsobtained on demand
Incremental queries(push / event-driven):
1. Client registers queries
2. Graph is changed
3. Results are maintained
4. Goto 2
Query results arealways available
![Page 50: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/50.jpg)
Incremental query engines
CLIPS C structures NASA
Drools POJO Red Hat
VIATRA EMF BME / IncQuery Labs.
![Page 51: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/51.jpg)
Incremental query engines
CLIPS C structures NASA
Drools POJO Red Hat
VIATRA EMF BME / IncQuery Labs.
INSTANS RDF Aalto University
i3QL POJO TU Darmstadt
IncQuery-D RDF BME
![Page 52: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/52.jpg)
Incremental query engines
CLIPS C structures NASA
Drools POJO Red Hat
VIATRA EMF BME / IncQuery Labs.
INSTANS RDF Aalto University
i3QL POJO TU Darmstadt
IncQuery-D RDF BME
No implementations for property graphs yet
![Page 53: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/53.jpg)
ingraph
An incremental, in-memory graph query engine
![Page 54: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/54.jpg)
ingraph
An incremental, in-memory graph query engine
ingraphclient
![Page 55: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/55.jpg)
ingraph
An incremental, in-memory graph query engine
ingraphclient
register queries
![Page 56: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/56.jpg)
ingraph
An incremental, in-memory graph query engine
ingraphclient
register queries
update graph
![Page 57: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/57.jpg)
ingraph
An incremental, in-memory graph query engine
ingraphclient
register queries
query results
update graph
![Page 58: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/58.jpg)
ingraph
An incremental, in-memory graph query engine
ingraphclient
register queries
query results
change notifications
update graph
![Page 59: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/59.jpg)
MATCH (t:Train)-[:ON]->(seg:Segment)
<-[:STRAIGHT]-(sw:Switch)
WHERE sw.position = 'diverging'
RETURN t.number, sw
openCypherquery
![Page 60: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/60.jpg)
MATCH (t:Train)-[:ON]->(seg:Segment)
<-[:STRAIGHT]-(sw:Switch)
WHERE sw.position = 'diverging'
RETURN t.number, sw
openCypherquery
Querysyntax tree
![Page 61: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/61.jpg)
MATCH (t:Train)-[:ON]->(seg:Segment)
<-[:STRAIGHT]-(sw:Switch)
WHERE sw.position = 'diverging'
RETURN t.number, sw
Queryparser
openCypherquery
Querysyntax tree
![Page 62: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/62.jpg)
MATCH (t:Train)-[:ON]->(seg:Segment)
<-[:STRAIGHT]-(sw:Switch)
WHERE sw.position = 'diverging'
RETURN t.number, sw
Queryparser
openCypherquery
Relationalalgebramodel
Querysyntax tree
![Page 63: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/63.jpg)
MATCH (t:Train)-[:ON]->(seg:Segment)
<-[:STRAIGHT]-(sw:Switch)
WHERE sw.position = 'diverging'
RETURN t.number, sw
Relationalalgebra builder
Queryparser
openCypherquery
Relationalalgebramodel
Querysyntax tree
![Page 64: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/64.jpg)
MATCH (t:Train)-[:ON]->(seg:Segment)
<-[:STRAIGHT]-(sw:Switch)
WHERE sw.position = 'diverging'
RETURN t.number, sw
Relationalalgebra builder
Queryparser
openCypherquery
Relationalalgebramodel
Querysyntax tree
![Page 65: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/65.jpg)
Relationalalgebra model
Rete network
Rete network model
![Page 66: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/66.jpg)
Relationalalgebra model
Rete network
Rete network model
Transformerand optimizer
VIATRA
![Page 67: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/67.jpg)
Relationalalgebra model
Rete network
Rete network model
Transformerand optimizer
VIATRA
![Page 68: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/68.jpg)
Relationalalgebra model
Rete network
Rete network model
Transformerand optimizer
Querydeployer
VIATRA
![Page 69: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/69.jpg)
FORMALIZATION OF OPENCYPHER
![Page 70: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/70.jpg)
Relational algebra
Standard relational algebra
o 𝜋, 𝜎
o∪,∩,∖
o×,⋈
Common extensions
o 𝛿 – duplicate elimination
o 𝛾 – grouping
o 𝜏 – sorting
![Page 71: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/71.jpg)
Graph-specific operators
Jürgen Hölsch, Michael Grossniklaus:An Algebra and Equivalences to Transform Graph Patterns in Neo4j, GraphQ 2016, EDBT,http://ceur-ws.org/Vol-1558/paper24.pdf
GetVertices: returns a graph relation containing all vertices of the underlying graph G
Expand: return the neighbors of a given node
![Page 72: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/72.jpg)
Additional extensions
GetEdges: returns a graph relation containing all edges of the underlying graph G
Gábor Szárnyas, József Marton:openCypher specification, Technical reporthttp://docs.inf.mit.bme.hu/ingraph/pub/opencypher-report.pdf
![Page 73: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/73.jpg)
While pattern matching, Neo4j makes sure to not include matches where the same graph relationship is found multiple times in a single pattern.
Uniqueness of edges
All-different operator
![Page 74: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/74.jpg)
EXAMPLE QUERIES
![Page 75: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/75.jpg)
Uniqueness of edges
![Page 76: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/76.jpg)
Get neighbours
![Page 77: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/77.jpg)
Filter out based on node prop name
![Page 78: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/78.jpg)
Use multiple MATCH clauses to do a Cartesian product
![Page 79: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/79.jpg)
Two subgraphs
![Page 80: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/80.jpg)
SwitchMonitored
![Page 81: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/81.jpg)
![Page 82: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/82.jpg)
INCREMENTAL GRAPH QUERIESWITH OPENCYPHER
![Page 83: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/83.jpg)
openCypher constructs
Standard constructs
o pattern matching
o filtering
o lists, maps
o data manipulation
o variable length paths
![Page 84: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/84.jpg)
openCypher constructs
Standard constructs
o pattern matching
o filtering
o lists, maps
o data manipulation
o variable length paths
Legacy constructs
o indexing, constraints
o regular expressions
o some list functions, including reduce
omost predicate functions
o shortest path functions
o CASE expressions
o id()
![Page 85: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/85.jpg)
openCypher constructs
Standard constructs
o pattern matching
o filtering
o lists, maps
o data manipulation
o variable length paths
Legacy constructs
o indexing, constraints
o regular expressions
o some list functions, including reduce
omost predicate functions
o shortest path functions
o CASE expressions
o id()Difficult to handle
incrementally
![Page 86: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/86.jpg)
Challenges for incremental openCypher
Lists
o ['a', 1, 2, true]
o ['a', [1, [2]], true]
o UNWIND
Efficient aggregation
o min(), max()
o collect()
Bag semantics, ORDER BY, SKIP and LIMIT
o Idea: collect(x ORDER BY x.name)
![Page 87: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/87.jpg)
Incremental queries – use cases
Standing queries on large & quickly changing graph
Runtime monitoring (train example)
Model validation: The Train Benchmark
Static analysis of JavaScript source code
Fraud detection
IT infrastructure monitoring
![Page 88: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/88.jpg)
Future work
Path operatorGiacomo Bergami, Matteo Magnani, and Danilo Montesi, A join operator for property graphs, GraphQ 2016, EDBT, http://jackbergus.alwaysdata.net/paper_graph_graphq2017.pdf
Unwind operator: 𝜔Elena Botoeva et al.:A Formal Presentation of MongoDB,https://arxiv.org/abs/1603.09291
![Page 89: Incremental Graph Queries for Cypher€¦ · Batch vs. incremental queries Batch queries (pull / request-driven): 1. Client selects a query 2. Results are calculated Query results](https://reader033.vdocuments.site/reader033/viewer/2022042812/5faf81eb13114217794c736f/html5/thumbnails/89.jpg)
Open-Source Projects
Incremental Graph Engine:https://github.com/ftsrg/ingraph
Train Benchmark:https://github.com/ftsrg/trainbenchmark
BME-MODES3:https://github.com/ftsrg/bme-modes3
Available under EPL v1.0.