0

I upgraded neo4j community edition from 3.0.3 to 3.1 and this query doesn't return graphical representation of all the relationships for this node anymore.

MATCH (:User {username: 'user6'})-[r]-()
RETURN r

Any reasons why it wouldn't work in 3.1?

jas
  • 1,539
  • 5
  • 17
  • 30
  • No reason that I can see. You're sure such a node exists, and that it has relationships? – InverseFalcon Feb 01 '17 at 04:05
  • Sorry, I should have said it doesn't return graphical representation anymore in browser – jas Feb 01 '17 at 04:16
  • I think you'll only see it if nodes are returned. You'll need to add a variable on at least one of the nodes and return that too. – InverseFalcon Feb 01 '17 at 04:39
  • What if you don't know all the nodes it is connected to. I guess that is the whole idea of the query to find out about all the relationships of node. Why it has stopped working in 3.1? – jas Feb 01 '17 at 04:50
  • You do know what it's connected to. It's right there in your match. Just put variables for the start and end nodes, and return those along with the relationship. I haven't tried a query like this in < 3.1, since nearly every query where I was interested in viewing the graphical view returned nodes. – InverseFalcon Feb 01 '17 at 05:01

2 Answers2

1

Looks like the browser requires you to return nodes in order to see the graphical view. Just add variables on your start and end nodes and return them.

MATCH (a:User {username: 'user6'})-[r]-(b)
RETURN r, a, b
InverseFalcon
  • 29,576
  • 4
  • 38
  • 51
  • Yeah that works. But still would have been nice to know why previous query worked fine 3.0 – jas Feb 01 '17 at 14:58
0

'r' refers to a relationship on its own. To return a graph you need the node(s) as well.

Try

MATCH graph = (a:User {username: 'user6'})-[r]-(b)
RETURN graph
wikitect
  • 437
  • 4
  • 12