Skip to content

Commit

Permalink
Do not use paths
Browse files Browse the repository at this point in the history
Path equality is currently ill-defined for paths that traverse a single self-relationship,
as it makes the exact same triple of node-rel-node unequal to itself when traversed in
the reverse direction.
  • Loading branch information
Mats-SX committed Feb 27, 2017
1 parent 1dac0be commit 08e43ba
Showing 1 changed file with 28 additions and 112 deletions.
140 changes: 28 additions & 112 deletions tck/features/SimplePatternSemantics.feature
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ Feature: SimplePatternSemantics
"""
When executing query:
"""
MATCH p = ()--()
RETURN p
MATCH (a)-[r]-(b)
RETURN a, r, b
"""
Then the result should be:
| p |
| <(:A)-[:LOOP]->(:A)> |
| <(:A)<-[:LOOP]-(:A)> |
| a | r | b |
| (:A) | [:LOOP] | (:A) |
And no side effects

Scenario: Undirected match in self-relationship graph, count
Expand All @@ -47,7 +46,7 @@ Feature: SimplePatternSemantics
"""
Then the result should be:
| count(*) |
| 2 |
| 1 |
And no side effects

Scenario: Undirected match of self-relationship in self-relationship graph
Expand All @@ -58,13 +57,12 @@ Feature: SimplePatternSemantics
"""
When executing query:
"""
MATCH p = (n)--(n)
RETURN p
MATCH (n)-[r]-(n)
RETURN n, r
"""
Then the result should be:
| p |
| <(:A)-[:LOOP]->(:A)> |
| <(:A)<-[:LOOP]-(:A)> |
| n | r |
| (:A) | [:LOOP] |
And no side effects

Scenario: Undirected match of self-relationship in self-relationship graph, count
Expand All @@ -80,7 +78,7 @@ Feature: SimplePatternSemantics
"""
Then the result should be:
| count(*) |
| 2 |
| 1 |
And no side effects

Scenario: Undirected match on simple relationship graph
Expand All @@ -91,13 +89,13 @@ Feature: SimplePatternSemantics
"""
When executing query:
"""
MATCH p = ()--()
RETURN p
MATCH (a)-[r]-(b)
RETURN a, r, b
"""
Then the result should be:
| p |
| <(:A)-[:LOOP]->(:B)> |
| <(:B)<-[:LOOP]-(:A)> |
| a | r | b |
| (:A) | [:LOOP] | (:B) |
| (:B) | [:LOOP] | (:A) |
And no side effects

Scenario: Undirected match on simple relationship graph, count
Expand All @@ -124,12 +122,12 @@ Feature: SimplePatternSemantics
"""
When executing query:
"""
MATCH p = ()-->()
RETURN p
MATCH (a)-[r]->(b)
RETURN a, r, b
"""
Then the result should be:
| p |
| <(:A)-[:LOOP]->(:A)> |
| a | r | b |
| (:A) | [:LOOP] | (:A) |
And no side effects

Scenario: Directed match on self-relationship graph, count
Expand All @@ -156,12 +154,12 @@ Feature: SimplePatternSemantics
"""
When executing query:
"""
MATCH p = (n)-->(n)
RETURN p
MATCH (n)-[r]->(n)
RETURN n, r
"""
Then the result should be:
| p |
| <(:A)-[:LOOP]->(:A)> |
| n | r |
| (:A) | [:LOOP] |
And no side effects

Scenario: Directed match of self-relationship on self-relationship graph, count
Expand Down Expand Up @@ -193,7 +191,7 @@ Feature: SimplePatternSemantics
"""
Then the result should be:
| count(r) |
| 2 |
| 1 |
And no side effects

Scenario: Counting distinct undirected self-relationships in self-relationship graph
Expand All @@ -220,12 +218,12 @@ Feature: SimplePatternSemantics
"""
When executing query:
"""
MATCH p = ()-->()
RETURN p
MATCH (a)-[r]->(b)
RETURN a, r, b
"""
Then the result should be:
| p |
| <(:A)-[:LOOP]->(:B)> |
| a | r | b |
| (:A) | [:LOOP] | (:B) |
And no side effects

Scenario: Directed match of a simple relationship, count
Expand All @@ -244,88 +242,6 @@ Feature: SimplePatternSemantics
| 1 |
And no side effects

Scenario: Direction of traversed relationship is significant for path equality, simple
Given an empty graph
And having executed:
"""
CREATE (n:A)-[:LOOP]->(n)
"""
When executing query:
"""
MATCH p1 = (:A)-->()
MATCH p2 = (:A)<--()
RETURN p1 = p2
"""
Then the result should be:
| p1 = p2 |
| false |
And no side effects

Scenario: Direction of traversed relationship is significant for path equality
Given an empty graph
And having executed:
"""
CREATE (:A)-[:T]->(l:Looper),
(l)-[:LOOP]->(l),
(l)-[:T]->(:B)
"""
When executing query:
"""
MATCH p = (:A)-->()--()
RETURN p
"""
Then the result should be:
| p |
| <(:A)-[:T]->(:Looper)-[:LOOP]->(:Looper)> |
| <(:A)-[:T]->(:Looper)<-[:LOOP]-(:Looper)> |
| <(:A)-[:T]->(:Looper)-[:T]->(:B)> |
And no side effects

Scenario: Direction of traversed relationship is significant for path equality, count
Given an empty graph
And having executed:
"""
CREATE (:A)-[:T]->(l:Looper),
(l)-[:LOOP]->(l),
(l)-[:T]->(:B)
"""
When executing query:
"""
MATCH (:A)-->()--()
RETURN count(*)
"""
Then the result should be:
| count(*) |
| 3 |
And no side effects

Scenario: Direction of traversed relationship is significant for path equality, undirected
Given an empty graph
And having executed:
"""
CREATE (:A)-[:T]->(l:Looper),
(l)-[:LOOP]->(l),
(l)-[:T]->(:B)
"""
When executing query:
"""
MATCH p = ()--()--()
RETURN p
"""
Then the result should be:
| p |
| <(:A)-[:T]->(:Looper)-[:LOOP]->(:Looper)> |
| <(:A)-[:T]->(:Looper)<-[:LOOP]-(:Looper)> |
| <(:A)-[:T]->(:Looper)-[:T]->(:B)> |
| <(:Looper)-[:LOOP]->(:Looper)<-[:T]-(:A)> |
| <(:Looper)-[:LOOP]->(:Looper)-[:T]->(:B)> |
| <(:Looper)<-[:LOOP]-(:Looper)<-[:T]-(:A)> |
| <(:Looper)<-[:LOOP]-(:Looper)-[:T]->(:B)> |
| <(:B)<-[:T]-(:Looper)-[:LOOP]->(:Looper)> |
| <(:B)<-[:T]-(:Looper)<-[:LOOP]-(:Looper)> |
| <(:B)<-[:T]-(:Looper)<-[:T]-(:A)> |
And no side effects

Scenario: Counting directed self-relationships
Given an empty graph
And having executed:
Expand Down

0 comments on commit 08e43ba

Please sign in to comment.