Skip to content

Conversation

@Mats-SX
Copy link
Member

@Mats-SX Mats-SX commented Feb 27, 2017

Undirected matching on self-relationships (aka loops) is tricky. #162 makes an effort to try and make explicit the intended semantics. This leaves paths in an ill-defined state, however. Consider the graph with one node and one relationship (to itself), and the following query:

MATCH p = ()--()
RETURN p

#162 states that only one row is to be returned (there's only one combination of node-rel-node available in the data graph). However, if paths are supposed to capture the direction in which they traverse relationships, then which path should be returned by this query: the one that traverses the relationship outgoing, or the one that does it incoming? It seems ill-defined.

In no other circumstance other than a self-relationship will the traversed direction matter.

Same idea as in #160

The direction in which a relationship is traversed is
not significant for a path. The mention of this in the CIP
was caused by a misunderstanding.
"""
Then the result should be:
| p1 = p2 |
| true |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels wrong to me.

@thobe
Copy link

thobe commented Feb 28, 2017

I think there are more scenarios that should be considered, for completeness:

Given an empty graph
And having executed:
  """
  CREATE (a)-[:X]->(a)
  """
When executing query:
  """
  MATCH p=()-->()
  MATCH q=()--()
  RETURN p = q
  """
Then the result should be:
  | p = q |
  |  ???  |

Where the result could be either:

  | p = q |
  | true  |

or:

  | p = q |
  | true  |
  | false |

(without order)

and

Given an empty graph
And having executed:
  """
  CREATE (a)-[:X]->(a)
  """
When executing query:
  """
  MATCH p=()<--()
  MATCH q=()--()
  RETURN p = q
  """
Then the result should be:
  | p = q |
  |  ???  |

With the same possible results as above.

@boggle boggle added the settled label Mar 27, 2017
@boggle boggle merged commit 491803b into opencypher:master Mar 30, 2017
@boggle boggle deleted the path-equality-scenarios branch March 30, 2017 12:03
@boggle boggle restored the path-equality-scenarios branch March 30, 2017 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants