formal semantics of cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10....
TRANSCRIPT
![Page 1: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/1.jpg)
Formal semantics of Cypher:towards a standard language for querying property graphs
N. Francis 1
V. Marsault 1A. Green 2
T. Lindaaker 2
S. Plantikow 2
M. Rydberg 2
P. Selmer 2
A. Taylor 2
P. Guagliardo 3
L. Libkin 3
M. Schuster 3
1. Univ. Paris-Est Marne-la-Vallee, ENPC, ESIEE, CNRS
2. Neo Technology 3. University of Edinburgh
GT AlgaInria Nord Europe, Lille
2018-10-15
![Page 2: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/2.jpg)
Outline 1
1 Introduction
2 Property graphs
3 Regular Path Queries
4 Cypher by example
5 Principles of the semantics
6 Towards a standard language for querying property graphs
![Page 3: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/3.jpg)
Representing data as graphs 1
Most databases use the relational modelRelational algebra in theoryThe language SQL in practice
Some data have intrinsically the structure of graphs:Semantic webSocial NetworksBioinformatic networks
Native representation of data as graphs allows:Efficient algorithms on graphsPattern matchingOptimisations
![Page 4: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/4.jpg)
Representing data as graphs 1
Most databases use the relational modelRelational algebra in theoryThe language SQL in practice
Some data have intrinsically the structure of graphs:Semantic webSocial NetworksBioinformatic networks
Native representation of data as graphs allows:Efficient algorithms on graphsPattern matchingOptimisations
![Page 5: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/5.jpg)
More and more ways to manipulate data as graphs 2
Data model
Property graphs, RDF
Query languages
Cypher, Gremlin, PGQL, SPARQL, G-Core
Engines
JanusGraph, Jena, Neo4j, Virtuoso
Domain
Fraud detection, Investigative journalism
![Page 6: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/6.jpg)
More and more ways to manipulate data as graphs 2
Data model
Property graphsProperty graphs, RDF
Query languages
CypherCypher, Gremlin, PGQLPGQL, SPARQL, G-CoreG-Core
Engines
JanusGraph, Jena, Neo4jNeo4j, Virtuoso
Domain
Fraud detection, Investigative journalism
![Page 7: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/7.jpg)
Cypher 3
Language for querying and updating property graphs
Invented by Neo TechnologyOriginally, part of engine Neo4j → commercial successNow, in multiple datagraph engines (e.g., SAP HANA Graph,Redis Graph, Agens Graph)
The openCypher project
Since 2015Seeks to standardise Cypher (SQL for property graphs?)
Community-led evolutionComplete specification
![Page 8: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/8.jpg)
Cypher 3
Language for querying and updating property graphs
Invented by Neo TechnologyOriginally, part of engine Neo4j → commercial successNow, in multiple datagraph engines (e.g., SAP HANA Graph,Redis Graph, Agens Graph)
The openCypher project
Since 2015Seeks to standardise Cypher (SQL for property graphs?)
Community-led evolutionComplete specification
![Page 9: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/9.jpg)
Short term goal
Full denotational semantics for the language Cypher.
Industrial partnership Neo4j/University of EdinburghReverse engineering and formalisation from Neo4jDone semantics of the “core fragment’ [Francis et al’18]
Soon: semantics of the “update clauses
Long term goal
Design a standard language for querying property graphs: GQL.
Merging Cypher, PGQL, G-Core.Involvement of Neo Technology, Oracle and LDBC.
![Page 10: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/10.jpg)
Short term goal
Full denotational semantics for the language Cypher.
Industrial partnership Neo4j/University of EdinburghReverse engineering and formalisation from Neo4jDone semantics of the “core fragment’ [Francis et al’18]
Soon: semantics of the “update clauses
Long term goal
Design a standard language for querying property graphs: GQL.
Merging Cypher, PGQL, G-Core.Involvement of Neo Technology, Oracle and LDBC.
![Page 11: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/11.jpg)
Outline 5
1 Introduction
2 Property graphs
3 Regular Path Queries
4 Cypher by example
5 Principles of the semantics
6 Towards a standard language for querying property graphs
![Page 12: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/12.jpg)
Property graph 5
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Nodes : N1,N2, · · · ,N5
Relationships : r1,r2, · · · ,r7
Labels (de nœuds) :UserMessage
Types (of relationships) :followspostedanswers
Properties(i.e. Key/Value pairs) :
name:"Alice"id:22text:"Hello"
![Page 13: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/13.jpg)
Property graph 5
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Nodes : N1,N2, · · · ,N5
Relationships : r1,r2, · · · ,r7
Labels (de nœuds) :UserMessage
Types (of relationships) :followspostedanswers
Properties(i.e. Key/Value pairs) :
name:"Alice"id:22text:"Hello"
![Page 14: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/14.jpg)
Property graph 5
N1
UserUser
name:"Alice"
N2
UserUser
name:"Bob"
N3
UserUser , AdminAdmin
name:"Charlie"
N4
MessageMessage
id:22text:"Hello"
N5
MessageMessage
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Nodes : N1,N2, · · · ,N5
Relationships : r1,r2, · · · ,r7
LabelsLabels (de nœuds) :UserMessage
Types (of relationships) :followspostedanswers
Properties(i.e. Key/Value pairs) :
name:"Alice"id:22text:"Hello"
![Page 15: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/15.jpg)
Property graph 5
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
followsfollows
r2
r3r4
r5postedposted
on:"05-14"r6
postedposted
on:"05-15"
r7
answersanswers
r8
follows
followsfollows
Nodes : N1,N2, · · · ,N5
Relationships : r1,r2, · · · ,r7
Labels (de nœuds) :UserMessage
TypesTypes (of relationships) :followspostedanswers
Properties(i.e. Key/Value pairs) :
name:"Alice"id:22text:"Hello"
![Page 16: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/16.jpg)
Property graph 5
N1
User
name:"Alice"name:"Alice"
N2
User
name:"Bob"name:"Bob"
N3
User , Admin
name:"Charlie"name:"Charlie"
N4
Message
id:22id:22text:"Hello"text:"Hello"
N5
Message
id:25id:25text:"World"text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"on:"05-14"r6
posted
on:"05-15"on:"05-15"
r7
answers
r8
follows
follows
Nodes : N1,N2, · · · ,N5
Relationships : r1,r2, · · · ,r7
Labels (de nœuds) :UserMessage
Types (of relationships) :followspostedanswers
PropertiesProperties(i.e. Key/Value pairs) :
name:"Alice"id:22text:"Hello"
![Page 17: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/17.jpg)
Outline 6
1 Introduction
2 Property graphs
3 Regular Path Queries
4 Cypher by example
5 Principles of the semantics
6 Towards a standard language for querying property graphs
![Page 18: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/18.jpg)
Data model for theoretical query languages 6
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Graph database
Relation bear typesNode do not bear types
(could be simulated)Neither bears property
Finite number of relation types(and node types)
→ “Dataless graph”
![Page 19: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/19.jpg)
Data model for theoretical query languages 6
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Graph database
Relation bear typesNode do not bear types
(could be simulated)Neither bears property
Finite number of relation types(and node types)
→ “Dataless graph”
![Page 20: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/20.jpg)
Data model for theoretical query languages 6
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Graph database
Relation bear typesNode do not bear types
(could be simulated)Neither bears property
Finite number of relation types(and node types)
→ “Dataless graph”
![Page 21: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/21.jpg)
Regular Path Query (RPQ) – Definition 7
A: finite alphabet (of relation types)N: nodes in the graph
Definition (RPQ R):
R = (x,E, y){E : regular expr. over Ax, y : two variables
Example:
x y(a + b)∗
Definition (Answer to R):
Set of the functions
F : {x, y} → N , ∃u ∈ E, F(x)u−−→ F(y)
![Page 22: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/22.jpg)
Regular Path Query (RPQ) – Example 1 8
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
x yPOSTED.(ANSWERS)∗
Answers:
F1 : x 7→ N1 y 7→ N4
F2 : x 7→ N2 y 7→ N5
F3 : x 7→ N2 y 7→ N4
![Page 23: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/23.jpg)
Regular Path Query (RPQ) – Example 1 8
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
x yPOSTED.(ANSWERS)∗
Answers:
F1 : x 7→ N1 y 7→ N4
F2 : x 7→ N2 y 7→ N5
F3 : x 7→ N2 y 7→ N4
![Page 24: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/24.jpg)
Regular Path Query (RPQ) – Example 1 8
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
postedposted
on:"05-15"
r7
answers
r8
follows
follows
Query:
x yPOSTED.(ANSWERS)∗
Answers:
F1 : x 7→ N1 y 7→ N4
F2 : x 7→ N2 y 7→ N5
F3 : x 7→ N2 y 7→ N4
![Page 25: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/25.jpg)
Regular Path Query (RPQ) – Example 1 8
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
postedposted
on:"05-15"
r7
answersanswers
r8
follows
follows
Query:
x yPOSTED.(ANSWERS)∗
Answers:
F1 : x 7→ N1 y 7→ N4
F2 : x 7→ N2 y 7→ N5
F3 : x 7→ N2 y 7→ N4
![Page 26: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/26.jpg)
Regular Path Query (RPQ) – Example 1 8
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
x yPOSTED.(ANSWERS)∗
Answers:
F1 : x 7→ N1 y 7→ N4
F2 : x 7→ N2 y 7→ N5
F3 : x 7→ N2 y 7→ N4
![Page 27: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/27.jpg)
Regular Path Query (RPQ) – Example 2 9
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
x y(FOLLOWS)∗
Answers:
F1 : x 7→ N1 y 7→ N1
F2 : x 7→ N1 y 7→ N2
F3 : x 7→ N1 y 7→ N3...
......
F9 : x 7→ N3 y 7→ N3
→ ∞-many path realise F1
→ RPQ follows set-semantics
![Page 28: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/28.jpg)
Regular Path Query (RPQ) – Example 2 9
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
followsfollows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
followsfollows
Query:
x y(FOLLOWS)∗
Answers:
F1 : x 7→ N1 y 7→ N1
F2 : x 7→ N1 y 7→ N2
F3 : x 7→ N1 y 7→ N3...
......
F9 : x 7→ N3 y 7→ N3
→ ∞-many path realise F1
→ RPQ follows set-semantics
![Page 29: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/29.jpg)
Regular Path Query (RPQ) – Example 2 9
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
x y(FOLLOWS)∗
Answers:
F1 : x 7→ N1 y 7→ N1
F2 : x 7→ N1 y 7→ N2
F3 : x 7→ N1 y 7→ N3...
......
F9 : x 7→ N3 y 7→ N3
→ ∞-many path realise F1
→ RPQ follows set-semantics
![Page 30: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/30.jpg)
Regular Path Query (RPQ) – Example 2 9
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
x y(FOLLOWS)∗
Answers:
F1 : x 7→ N1 y 7→ N1
F2 : x 7→ N1 y 7→ N2
F3 : x 7→ N1 y 7→ N3...
......
F9 : x 7→ N3 y 7→ N3
→ ∞-many path realise F1
→ RPQ follows set-semantics
![Page 31: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/31.jpg)
Regular Path Query (RPQ) – Example 2 9
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
followsfollows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
followsfollows
Query:
x y(FOLLOWS)∗
Answers:
F1 : x 7→ N1 y 7→ N1
F2 : x 7→ N1 y 7→ N2
F3 : x 7→ N1 y 7→ N3...
......
F9 : x 7→ N3 y 7→ N3
→ ∞-many path realise F1
→ RPQ follows set-semantics
![Page 32: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/32.jpg)
Regular Path Query (RPQ) – Example 2 9
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
followsfollows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
followsfollows
Query:
x y(FOLLOWS)∗
Answers:
F1 : x 7→ N1 y 7→ N1
F2 : x 7→ N1 y 7→ N2
F3 : x 7→ N1 y 7→ N3...
......
F9 : x 7→ N3 y 7→ N3
→ ∞-many path realise F1
→ RPQ follows set-semantics
![Page 33: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/33.jpg)
Regular Path Query (RPQ) – Example 2 9
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
x y(FOLLOWS)∗
Answers:
F1 : x 7→ N1 y 7→ N1
F2 : x 7→ N1 y 7→ N2
F3 : x 7→ N1 y 7→ N3...
......
F9 : x 7→ N3 y 7→ N3
→ ∞-many path realise F1
→ RPQ follows set-semantics
![Page 34: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/34.jpg)
Conjunction of RPQs (CRPQ) – Definition 10
A: alphabet (of relation types)N: nodes in the graph
Definition (a CRPQ C):
C = (R1 ∧ R2 ∧ · · · ∧ Rn)
where R1, , . . . , Rn are RPQs
Example:
x
y
z
(a + b)∗ (ab)∗
c
Answer to C:
Set of the functions F : var(C) → N
such that ∀i, F|var(Ri ) is an answer to Ri
![Page 35: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/35.jpg)
Conjunction of RPQs (CRPQ) – Example 11
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
x y z
POSTED
(ANSWERS)∗
Answers:
x y z
7→ 7→ 7→
F1 : N1 N4 N4
F2 : N2 N5 N4
F3 : N2 N5 N5
![Page 36: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/36.jpg)
Union of CRPQs (UCRPQ) – Defintion 12
A: alphabet (of relation types)N: nodes in the graph
Definition (UCRPQ Q)
Q = (C1 ∪ C2 ∪ · · · ∪ Cn)
where C1, C2, . . . , Cn are CRPQs
Answer to Q:
Set of partial functions:(var(C1) ∪ · · · ∪ var(Cn)
)→ N
n⋃i=1
Fi ,
where,∀i, Fi is the answer to Ci.
![Page 37: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/37.jpg)
Outline 13
1 Introduction
2 Property graphs
3 Regular Path Queries
4 Cypher by example
5 Principles of the semantics
6 Towards a standard language for querying property graphs
![Page 38: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/38.jpg)
Evaluating a Cypher query 13
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Example of Cypher query:
MATCH (u1)-[p1:POSTED]->(m1)
WITH u1, p1, m1.text AS t1
WHERE t1 = "Hello"
A Cypher statementis a sequence of clauses
queries a graphreturns a table
![Page 39: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/39.jpg)
Evaluating a Cypher query 13
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Example of Cypher query:
MATCH (u1)-[p1:POSTED]->(m1)
WITH u1, p1, m1.text AS t1
WHERE t1 = "Hello"
A Cypher statementis a sequence of clausesqueries a graphreturns a table
![Page 40: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/40.jpg)
Matching nodes (1) 14
N1
UserUser
name:"Alice"
N2
UserUser
name:"Bob"
N3
UserUser , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (u1:User)
Result:
u1
N1
N2
N3
![Page 41: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/41.jpg)
Matching nodes (1) 14
N1
UserUser
name:"Alice"
N2
UserUser
name:"Bob"
N3
UserUser , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (u1:User)
Result:
u1
N1
N2
N3
![Page 42: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/42.jpg)
Matching nodes (2) 15
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
UserUser , AdminAdmin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (u1:User:Admin)
Result:
u1
N3
![Page 43: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/43.jpg)
Matching nodes (3) 16
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (u1{id:22})
Result:
u1
N4
![Page 44: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/44.jpg)
Matching relations (1) 17
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH ()-[p1]->()
Result:
p1
r1r2r3r4r5r6r7
![Page 45: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/45.jpg)
Matching relation (2) 18
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5postedposted
on:"05-14"r6
postedposted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (u1)-[p1:POSTED]->(m1)
Result:
u1 p1 m1
N1 r5 N4
N2 r6 N5
![Page 46: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/46.jpg)
Matching relationships (3) 19
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
followsfollows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
followsfollows
Query:
MATCH (u1)-[:FOLLOWS]->()
Result:
u1
N1
N2
N2
N3
Cypher has bag semantics:N2 has two outgoing followsrelations ⇒ two lines N2
![Page 47: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/47.jpg)
Matching paths (1) 20
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , AdminAdmin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
followsfollows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
followsfollows
Query:
MATCH (u1:Admin)
-[l1:FOLLOWS*]->(m1)
Result:
u1 l1 m1
N3 [r4] N1
N3 [r4,r1] N2
N3 [r4,r1,r2] N1
N3 [r4,r1,r3] N3
Cypher-MorphismEach rel. matched ≤ 1 time⇒ Finitely many results
![Page 48: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/48.jpg)
Matching paths (1) 20
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , AdminAdmin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
followsfollows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
followsfollows
Query:
MATCH (u1:Admin)
-[l1:FOLLOWS*]->(m1)
Result:
u1 l1 m1
N3 [r4] N1
N3 [r4,r1] N2
N3 [r4,r1,r2] N1
N3 [r4,r1,r3] N3
Cypher-MorphismEach rel. matched ≤ 1 time⇒ Finitely many results
![Page 49: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/49.jpg)
Matching paths (1) 20
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , AdminAdmin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
followsfollows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
followsfollows
Query:
MATCH (u1:Admin)
-[l1:FOLLOWS*]->(m1)
Result:
u1 l1 m1
N3 [r4] N1
N3 [r4,r1] N2
N3 [r4,r1,r2] N1
N3 [r4,r1,r3] N3
Cypher-MorphismEach rel. matched ≤ 1 time⇒ Finitely many results
![Page 50: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/50.jpg)
Matching paths (1) 20
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , AdminAdmin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
followsfollows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
followsfollows
Query:
MATCH (u1:Admin)
-[l1:FOLLOWS*]->(m1)
Result:
u1 l1 m1
N3 [r4] N1
N3 [r4,r1] N2
N3 [r4,r1,r2] N1
N3 [r4,r1,r3] N3
Cypher-MorphismEach rel. matched ≤ 1 time⇒ Finitely many results
![Page 51: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/51.jpg)
Matching paths (1) 20
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , AdminAdmin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
followsfollows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
followsfollows
Query:
MATCH (u1:Admin)
-[l1:FOLLOWS*]->(m1)
Result:
u1 l1 m1
N3 [r4] N1
N3 [r4,r1] N2
N3 [r4,r1,r2] N1
N3 [r4,r1,r3] N3
Cypher-MorphismEach rel. matched ≤ 1 time⇒ Finitely many results
![Page 52: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/52.jpg)
Matching paths (1) 20
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (u1:Admin)
-[l1:FOLLOWS*]->(m1)
Result:
u1 l1 m1
N3 [r4] N1
N3 [r4,r1] N2
N3 [r4,r1,r2] N1
N3 [r4,r1,r3] N3
Cypher-MorphismEach rel. matched ≤ 1 time⇒ Finitely many results
![Page 53: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/53.jpg)
Matching paths (2) 21
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (u1)-[:FOLLOWS]->()
-[:POSTED]->(m1)
Result:
u1 m1
N1 N5
N2 N4
N3 N5
![Page 54: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/54.jpg)
Matching paths (2) 21
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
followsfollows
r2
r3r4
r5posted
on:"05-14"r6
postedposted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (u1)-[:FOLLOWS]->()
-[:POSTED]->(m1)
Result:
u1 m1
N1 N5
N2 N4
N3 N5
![Page 55: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/55.jpg)
Chaining clauses 22
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (u1)-[:POSTED]->(m1)
MATCH (u2)<-[:FOLLOWS]-(u1)
-[:FOLLOWS]->(u3)
Table after first MATCH:
u1 m1
N1 N4
N2 N5
Table after second MATCH:
u1 m1 u2 u3
N2 N5 N1 N3
N2 N5 N3 N1
![Page 56: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/56.jpg)
Chaining clauses 22
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (u1)-[:POSTED]->(m1)
MATCH (u2)<-[:FOLLOWS]-(u1)
-[:FOLLOWS]->(u3)
Table after first MATCH:
u1 m1
N1 N4
N2 N5
Table after second MATCH:
u1 m1 u2 u3
N2 N5 N1 N3
N2 N5 N3 N1
![Page 57: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/57.jpg)
Chaining clauses 22
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (u1u1)-[:POSTED]->(m1)
MATCH (u2)<-[:FOLLOWS]-(u1u1)
-[:FOLLOWS]->(u3)
Table after first MATCH:
u1 m1
N1 N4
N2 N5
Table after second MATCH:
u1u1 m1 u2 u3
N1 N4 · ·
N2 N5 · ·
![Page 58: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/58.jpg)
Chaining clauses 22
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
followsfollows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (u1u1)-[:POSTED]->(m1)
MATCH (u2)<-[:FOLLOWS]-(u1u1)
-[:FOLLOWS]->(u3)
Table after first MATCH:
u1 m1
N1 N4
N2 N5
Table after second MATCH:
u1u1 m1 u2 u3
N1 N4 · ·
N2 N5 · ·
![Page 59: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/59.jpg)
Chaining clauses 22
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
followsfollows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (u1u1)-[:POSTED]->(m1)
MATCH (u2)<-[:FOLLOWS]-(u1u1)
-[:FOLLOWS]->(u3)
Table after first MATCH:
u1 m1
N1 N4
N2 N5
Table after second MATCH:
u1u1 m1 u2 u3
N1 N4 · ·
N2 N5 · ·
![Page 60: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/60.jpg)
Chaining clauses 22
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
followsfollows
Query:
MATCH (u1u1)-[:POSTED]->(m1)
MATCH (u2)<-[:FOLLOWS]-(u1u1)
-[:FOLLOWS]->(u3)
Table after first MATCH:
u1 m1
N1 N4
N2 N5
Table after second MATCH:
u1u1 m1 u2 u3
N1 N4 · ·
N2 N5 · ·
![Page 61: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/61.jpg)
Chaining clauses 22
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
followsfollows
Query:
MATCH (u1)-[:POSTED]->(m1)
MATCH (u2)<-[:FOLLOWS]-(u1)
-[:FOLLOWS]->(u3)
Table after first MATCH:
u1 m1
N1 N4
N2 N5
Table after second MATCH:
u1 m1 u2 u3
N2 N5 N1 N3
N2 N5 N3 N1
![Page 62: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/62.jpg)
Column manipulation (WITH clause) 23
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5postedposted
on:"05-14"r6
postedposted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (u1)-[p1:POSTED]->(m1)
WITH u1, p1, m1.text AS t1
After the MATCH clause
u1 p1 m1
N1 r5 N4
N2 r6 N5
Execution of the WITH clause
u1 p1 t1
N1 r5N2 r6
![Page 63: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/63.jpg)
Column manipulation (WITH clause) 23
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (u1)-[p1:POSTED]->(m1)
WITH u1u1, p1p1, m1.text AS t1t1
After the MATCH clause
u1u1 p1p1 m1
N1 r5 N4
N2 r6 N5
Execution of the WITH clause
u1u1 p1p1 t1t1
N1 r5N2 r6
![Page 64: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/64.jpg)
Column manipulation (WITH clause) 23
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (u1)-[p1:POSTED]->(m1)
WITH u1, p1, m1.textm1.text AS t1
After the MATCH clause
u1 p1 m1
N1 r5 N4
N2 r6 N5
Execution of the WITH clause
u1 p1 t1
N1 r5N2 r6
![Page 65: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/65.jpg)
Column manipulation (WITH clause) 23
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (u1)-[p1:POSTED]->(m1)
WITH u1, p1, m1.textm1.text AS t1
After the MATCH clause
u1 p1 m1
N1 r5 N4N4
N2 r6 N5
Execution of the WITH clause
u1 p1 t1
N1 r5 "Hello""Hello"
N2 r6
![Page 66: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/66.jpg)
Column manipulation (WITH clause) 23
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (u1)-[p1:POSTED]->(m1)
WITH u1, p1, m1.text AS t1
After the MATCH clause
u1 p1 m1
N1 r5 N4
N2 r6 N5N5
Execution of the WITH clause
u1 p1 t1
N1 r5 "Hello"
N2 r6 "World""World"
![Page 67: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/67.jpg)
Column manipulation (WITH clause) 23
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (u1)-[p1:POSTED]->(m1)
WITH u1, p1, m1.text AS t1
After the MATCH clause
u1 p1 m1
N1 r5 N4
N2 r6 N5
Final result
u1 p1 t1
N1 r5 "Hello"
N2 r6 "World"
![Page 68: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/68.jpg)
Line filtering (WHERE clause) 24
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (u1)-[p1:POSTED]->(m1)
WITH u1, p1, m1.text AS t1
WHERE t1 = "Hello"
After the WITH clause
u1 p1 t1
N1 r5 "Hello"
N2 r6 "World"
Execution of the WHERE clause
u1 p1 t1
N1 r5 "Hello"
N2 r6 "World"
![Page 69: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/69.jpg)
Line filtering (WHERE clause) 24
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (u1)-[p1:POSTED]->(m1)
WITH u1, p1, m1.text AS t1
WHERE t1 = "Hello"
After the WITH clause
u1 p1 t1
N1 r5 "Hello"
N2 r6 "World"
Execution of the WHERE clause
u1 p1 t1
N1 r5 "Hello"
N2 r6 "World"
![Page 70: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/70.jpg)
Line filtering (WHERE clause) 24
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (u1)-[p1:POSTED]->(m1)
WITH u1, p1, m1.text AS t1
WHERE t1 = "Hello"
After the WITH clause
u1 p1 t1
N1 r5 "Hello"
N2 r6 "World"
Final result
u1 p1 t1
N1 r5 "Hello"
![Page 71: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/71.jpg)
A last read-only example 25
N1
User
name:"Alice"
N2
User
name:"Bob"name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (a{name:"Bob"})
-[*]->(b{id:22})
<-[*]-(a)
QuestionWhat does this computes ?
AnswerThe # of pairs of disjoint pathsfrom N2 to N4.
⇒ Evaluation of one constantMATCH is NP-HARD
![Page 72: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/72.jpg)
A last read-only example 25
N1
User
name:"Alice"
N2
User
name:"Bob"name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (a{name:"Bob"})
-[*]->(b{id:22})
<-[*]-(a)
QuestionWhat does this computes ?
AnswerThe # of pairs of disjoint pathsfrom N2 to N4.
⇒ Evaluation of one constantMATCH is NP-HARD
![Page 73: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/73.jpg)
A last read-only example 25
N1
User
name:"Alice"
N2
User
name:"Bob"name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (a{name:"Bob"})
-[*]->(b{id:22})
<-[*]-(a)
QuestionWhat does this computes ?
AnswerThe # of pairs of disjoint pathsfrom N2 to N4.
⇒ Evaluation of one constantMATCH is NP-HARD
![Page 74: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/74.jpg)
Node and relation creation (CREATE) 26
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (a{name:"Charlie"})
CREATE (a)-[:FOLLOWS]->
(b:User)
Table after MATCH clause:
a
N3
Table after CREATE clause:
a b
N3 N6
![Page 75: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/75.jpg)
Node and relation creation (CREATE) 26
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
UserUser
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
followsfollows
follows
Query:
MATCH (a{name:"Charlie"})
CREATE (a)-[:FOLLOWS]->
(b:User)
Table after MATCH clause:
a
N3
Table after CREATE clause:
a b
N3 N6
![Page 76: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/76.jpg)
Node and relation creation (CREATE) 26
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (a{name:"Charlie"})
CREATE (a)-[:FOLLOWS]->
(b:User)
Table after MATCH clause:
a
N3
Table after CREATE clause:
a b
N3 N6
![Page 77: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/77.jpg)
The example graph stored as CREATE clauses 27
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
CREATE
(n1:User{name:"Alice"}),
(n2:User{name:"Bob"}),
(n3:User:Admin
{name:"Charlie"}),
(n4:Message {id:22,
text:"Hello"}),
(n5:Message {id:25,
text:"World"})
CREATE
(n1)-[:FOLLOWS]->(n2),
(n1)-[:POSTED
{on:"05-04"}]->(n4),
(n2)-[:FOLLOWS]->(n1),
(n2)-[:FOLLOWS]->(n3),
(n2)-[:POSTED
{on:"05-04"}]->(n5),
(n3)-[:FOLLOWS]->(n1),
(n5)-[:ANSWERS]->(n4),
![Page 78: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/78.jpg)
Node/Relation modification (SET clause) 28
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (a{name:"Charlie"})
CREATE (a)-[:FOLLOWS]->
(b:User)
SET b:Admin, b.name="Eve"
Table after CREATE clause:
a b
N3 N6
![Page 79: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/79.jpg)
Node/Relation modification (SET clause) 28
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User , AdminAdmin
name:"Eve"name:"Eve"
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (a{name:"Charlie"})
CREATE (a)-[:FOLLOWS]->
(b:User)
SET b:Admin, b.name="Eve"
Table after CREATE clause:
a b
N3 N6
![Page 80: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/80.jpg)
The MERGE clause : MATCH else CREATE 29
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Input table:
a n
N3 "Alice"
N3 "Eve"
Query:
MERGE (a)-[:FOLLOWS]->
(b:User {name:n})
Output table:
a n c
N3 "Alice"
N1
N3 "Eve"
N6
![Page 81: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/81.jpg)
The MERGE clause : MATCH else CREATE 29
N1
UserUser
name:"Alice"name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
followsfollows
Input table:
a n
N3 "Alice"
N3 "Eve"
Query:
MERGE (a)-[:FOLLOWS]->
(b:User {name:n})
Output table:
a n c
N3 "Alice" N1
N3 "Eve"
N6
![Page 82: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/82.jpg)
The MERGE clause : MATCH else CREATE 29
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
UserUser
name:"Eve"name:"Eve"
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
followsfollows
follows
Input table:
a n
N3 "Alice"
N3 "Eve"
Query:
MERGE (a)-[:FOLLOWS]->
(b:User {name:n})
Output table:
a n c
N3 "Alice" N1
N3 "Eve" N6
![Page 83: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/83.jpg)
The MERGE clause : MATCH else CREATE 29
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
name:"Eve"
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Input table:
a n
N3 "Alice"
N3 "Eve"
Query:
MERGE (a)-[:FOLLOWS]->
(b:User {name:n})
Output table:
a n c
N3 "Alice" N1
N3 "Eve" N6
![Page 84: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/84.jpg)
Other constructs 30
DELETE deletes node and relations.
Ex: MATCH (a{name:"Eve"}) DELETE a
REMOVE removes labels or properties.
Ex: MATCH (a{name:"Charlie"}) REMOVE a:Admin,a.name
WITH allows to perform aggregations.
Ex: MATCH (a)-[:FOLLOWS]->(b) WITH a, count(b) as c
ORDER BY limits size of table.
Ex: MATCH (a:User) ORDER BY a.name LIMIT 1
![Page 85: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/85.jpg)
Outline 31
1 Introduction
2 Property graphs
3 Regular Path Queries
4 Cypher by example
5 Principles of the semantics
6 Towards a standard language for querying property graphs
![Page 86: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/86.jpg)
Modelling Tables 31
Record (table row)
A record is a partial function from variables to values.
Example: (x 7→"Bob" ; y 7→1)
Table
A table is a multi-set (or bag) of records with the same domain.
Example:
x y
"Bob" 1"Alice" 999"Bob" 1
=
y x
999 "Alice"
1 "Bob"
1 "Bob"
![Page 87: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/87.jpg)
Modelling Tables 31
Record (table row)
A record is a partial function from variables to values.
Example: (x 7→"Bob" ; y 7→1)
Table
A table is a multi-set (or bag) of records with the same domain.
Example:
x y
"Bob" 1"Alice" 999"Bob" 1
=
y x
999 "Alice"
1 "Bob"
1 "Bob"
![Page 88: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/88.jpg)
Modelling Tables 31
Record (table row)
A record is a partial function from variables to values.
Example: (x 7→"Bob" ; y 7→1)
Table
A table is a multi-set (or bag) of records with the same domain.
Example:
x y
"Bob" 1"Alice" 999"Bob" 1
=
y x
999 "Alice"
1 "Bob"
1 "Bob"
![Page 89: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/89.jpg)
Semantics brackets – Read-Only 32
G: a graph
Semantics of expressions[[·
]]u,G
: expression 7−→ value (where u is a record)
Semantics of clauses[[·
]]G: clause 7−→ (function: Tables → Tables)
Semantics of queries[[·
]]G: query 7−→ (function: Tables → Tables)
output : (Graphs × Queries) 7−→ Tables
![Page 90: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/90.jpg)
Principle of Read-Only Semantics 33
G: a graphQ: a query
To compute the output of Q
Q is a sequence of clauses Q = C1 C2 · · · Cn
Compute[[C1
]]G,
[[C2
]]G, . . . ,
[[Cn
]]G
Let[[Q
]]G=
[[Cn
]]G◦ · · · ◦
[[C2
]]G◦
[[C1
]]G
output(G,Q) =[[Q
]]G
(Tunit
)where Tunit is the 1-line 0-column table.
![Page 91: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/91.jpg)
Principle of Read-Only Semantics 33
G: a graphQ: a query
To compute the output of Q
Q is a sequence of clauses Q = C1 C2 · · · Cn
Compute[[C1
]]G,
[[C2
]]G, . . . ,
[[Cn
]]G
Let[[Q
]]G=
[[Cn
]]G◦ · · · ◦
[[C2
]]G◦
[[C1
]]G
output(G,Q) =[[Q
]]G
(Tunit
)where Tunit is the 1-line 0-column table.
![Page 92: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/92.jpg)
Principle of Read-Only Semantics 33
G: a graphQ: a query
To compute the output of Q
Q is a sequence of clauses Q = C1 C2 · · · Cn
Compute[[C1
]]G,
[[C2
]]G, . . . ,
[[Cn
]]G
Let[[Q
]]G=
[[Cn
]]G◦ · · · ◦
[[C2
]]G◦
[[C1
]]G
output(G,Q) =[[Q
]]G
(Tunit
)where Tunit is the 1-line 0-column table.
![Page 93: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/93.jpg)
Principle of Read-Only Semantics 33
G: a graphQ: a query
To compute the output of Q
Q is a sequence of clauses Q = C1 C2 · · · Cn
Compute[[C1
]]G,
[[C2
]]G, . . . ,
[[Cn
]]G
Let[[Q
]]G=
[[Cn
]]G◦ · · · ◦
[[C2
]]G◦
[[C1
]]G
output(G,Q) =[[Q
]]G
(Tunit
)where Tunit is the 1-line 0-column table.
![Page 94: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/94.jpg)
Excerpt of Read-Only semantics (2) 34
[[WHERE e
]]G(T) =
{u ∈ T
���� [[e]]G,u= true
}
[[MATCH π
]]G(T) =
⊎u∈T
{u · u′ | u′ ∈ match(π,G,u)}
[[MATCH π WHERE e
]]G(T) =
[[WHERE e
]] ( [[MATCH π
]]G(T)
)[[OPTIONAL MATCH π WHERE e
]]G(T)
=⊎u∈T
{ [[MATCH π WHERE e
]]G({u}) if
[[MATCH π WHERE e
]]G({u}) , ∅
(u, (free(u, π) : null)) otherwise[[OPTIONAL MATCH π
]]G(T) =
[[OPTIONAL MATCH π WHERE true
]]G(T)
![Page 95: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/95.jpg)
Excerpt of Read-Only semantics (2) 35
[[WITH ∗
]]G(T) = T if T has at least one column[[
WITH ∗, e1 [AS a1], . . . , em [AS am]]]G(T) =[[
WITH b1 AS b1, . . . , bq AS bq, e1 [AS a1], . . . , em [AS am]]]G(T)[[
WITH e1 [AS a1], . . . , em [AS am]]]G(T) =⊎u∈T
{(a′1 :
[[e1
]]G,u
, . . . ,a′m :[[em
]]G,u)
}[[UNWIND e AS a
]]G(T) =
⊎u∈T
⊎v∈Eu
{(u,a : v)} ,
with Eu =
⊎0≤i<m {vi} if
[[e]]G,u= list(v0, . . . , vm−1)
{} if[[e]]G,u= list(){[[
e]]G,u
}otherwise
![Page 96: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/96.jpg)
Semantics brackets – Read-Write 36
Semantics of expressions: (Nothing changes)[[·
]]u,G
: expression 7−→ value (where u is a record)
Semantics of clauses:[[·
]]: clause 7−→ (function: (Graphs×Tables)→ (Graphs×Tables))
Semantics of queries:[[·
]]: query 7−→ (function: (Graphs×Tables)→ (Graphs×Tables))
output : (Graphs×Queries) 7−→ (Graphs×Tables)
(Computed just like RO → composition of clause semantics)
![Page 97: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/97.jpg)
Desirable properties of the semantics at Clause-level 37
Atomicity:Each clause is executed as a single unit
Consistency:
Each clause should on valid Graph/Table pair
General scheme of the semantics if a clause is:1 Ensure that the input Graph/Table is valid w.r.t. clause2 Compute output Table and all changes to graph3 Apply all changes to Graph4 Ensure validity of output Graph/Table
If any fails, semantics is undefined.
In Neo4j, Atomicity and Consistency are verified at query level only.
![Page 98: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/98.jpg)
Desirable properties of the semantics at Clause-level 37
Atomicity:Each clause is executed as a single unit
Consistency:
Each clause should on valid Graph/Table pair
General scheme of the semantics if a clause is:1 Ensure that the input Graph/Table is valid w.r.t. clause2 Compute output Table and all changes to graph3 Apply all changes to Graph4 Ensure validity of output Graph/Table
If any fails, semantics is undefined.
In Neo4j, Atomicity and Consistency are verified at query level only.
![Page 99: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/99.jpg)
In Neo4j, SET violate Atomicity 38
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22id:22text:"Hello"
N5
Message
id:25id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answersanswers
r8
follows
follows
Query:
MATCH (m1)-[:ANSWERS]->(m2)
SET m1.id = m2.id,
m2.id = m1.id
Table before SET clause:
m1 m2
N5 N4
Neo4j sets both id to 25.
Semantics exchange id values
![Page 100: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/100.jpg)
In Neo4j, SET violate Atomicity 38
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22id:22text:"Hello"
N5
Message
id:25id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answersanswers
r8
follows
follows
Query:
MATCH (m1)-[:ANSWERS]->(m2)
SET m1.id = m2.id,
m2.id = m1.id
Table before SET clause:
m1 m2
N5 N4
Neo4j sets both id to 25.
Semantics exchange id values
![Page 101: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/101.jpg)
In Neo4j, MERGE is highly non-deterministic 39
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Input Table:
a b c
N1 N2 N3
N2 N3 N1
N3 N1 N2
Query:
MERGE (a)-[:FOLLOWS]->(b)
-[:FOLLOWS]->(c)
Neo4j creates 4 edges
Semantics propose different se-mantics creating either 3 or 6.
![Page 102: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/102.jpg)
In Neo4j, MERGE is highly non-deterministic 39
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Input Table:
a b c
N1 N2 N3
N2 N3 N1
N3 N1 N2
Query:
MERGE (a)-[:FOLLOWS]->(b)
-[:FOLLOWS]->(c)
Neo4j creates 4 edges
Semantics propose different se-mantics creating either 3 or 6.
![Page 103: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/103.jpg)
In Neo4j, MERGE is highly non-deterministic 39
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Input Table:
a b c
N1 N2 N3
N2 N3 N1
N3 N1 N2
Query:
MERGE (a)-[:FOLLOWS]->(b)
-[:FOLLOWS]->(c)
Neo4j creates 4 edges
Semantics propose different se-mantics creating either 3 or 6.
![Page 104: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/104.jpg)
In Neo4j, DELETE violates clause-level consistency 40
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (a {name:"Alice"})
MATCH (a)-[r]-()
DELETE a
[...] // Arbitrary clauses
DELETE r
RETURN a.name AS n
Execution of arbitrary codeon invalid graphAccess to deleted-entity
Semanticsis undefined if it should pro-duce invalid graphsreplaces deleted entities bynull in the table
![Page 105: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/105.jpg)
In Neo4j, DELETE violates clause-level consistency 40
N1
User
name:"Alice"
N2
User
name:"Bob"
N3
User , Admin
name:"Charlie"
N4
Message
id:22text:"Hello"
N5
Message
id:25text:"World"
N6
User
r1
follows
r2
r3r4
r5posted
on:"05-14"r6
posted
on:"05-15"
r7
answers
r8
follows
follows
Query:
MATCH (a {name:"Alice"})
MATCH (a)-[r]-()
DELETE a
[...] // Arbitrary clauses
DELETE r
RETURN a.name AS n
Execution of arbitrary codeon invalid graphAccess to deleted-entity
Semanticsis undefined if it should pro-duce invalid graphsreplaces deleted entities bynull in the table
![Page 106: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/106.jpg)
Outline 41
1 Introduction
2 Property graphs
3 Regular Path Queries
4 Cypher by example
5 Principles of the semantics
6 Towards a standard language for querying property graphs
![Page 107: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/107.jpg)
Cypher vs RPQ 41
Cypher queries vs UCRPQs
Cypher has bag + cypher-morphism semantics(Set+ standard morphism semantics may be emulated...)Cypher has relationship/path variables(Data model is different)
RPQs not expressible in Cypher
(ab)∗ : no concatenation under star in Cypher(a∗)∗: no nested stars in Cypher(a + b−1)∗: some unions are not allowed under star in Cypher
(ab + cd)3: nested alternations of concatenations and unions re-quire multi-exponential blow-up of the query→ (ab)3 + (ab)2cd + ab(cd)2 + (cd)3
![Page 108: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/108.jpg)
PGQL (Property Graph Query Language) 42
Designed by Oracle Inc.
Support full UCRPQ
ASCII-art representation of patterns (similar to Cypher)
Syntax close to SQL
Example: (from http://pgql-lang.org/)
SELECT p1.name
FROM facebook_graph /* In the Facebook graph,.. */
MATCH (p1:Person) /* ..find persons such that.. */
WHERE NOT EXISTS ( /* ..there does not exist.. */
SELECT p2
FROM twitter_graph /* ..in the Twitter graph.. */
MATCH (p2:Person) /* ..a person.. */
WHERE p1.name = p2.name /* ..with the same name. */
)
![Page 109: Formal semantics of Cypherresearchers.lille.inria.fr/~fcapelli/gt-alga/slides/mar... · 2018. 10. 22. · Formal semantics of Cypher: towards a standard language for querying property](https://reader035.vdocuments.mx/reader035/viewer/2022071003/5fbff0cc2a2704644464f7a7/html5/thumbnails/109.jpg)
G-Core 43
Designed by LDBC
Experimental
Support full UCRPQ
ASCII-art representation of patterns (similar to Cypher)
Support Multiple graphs, graph views, and paths cost
Multiple semantics
Example:
CONSTRUCT (n)-[:To{distance:=c}]->(m)
MATCH (n) -/SHORTEST p<:KNOWS*> COST c/->(m)
ON facebook_graph
MATCH (n),(m) ON upem_graph