0
votes

I have some problems to receive some Nodes and relationships and I hope someone here can actually help to find my mistake!

Broken down:

I have three nodes:

  1. a Node labelled :Person with the property firstname
  2. a Node labelled :Event
  3. a Node labelled :Question with the property id

Basically the Relationship are as following:

(p:Person)-[:CREATED_EVENT]->(e:Event)
and
(e:Event)-[:ANSWERED]->(q:Question)

I tried to query:

MATCH 
(p:Person)-[:CREATED_EVENT]->(e:Event)<-[:ANSWERED]-(q:question)
WHERE p.firstname = "foo" AND q.id=2
RETURN p, e, q;

But my query is not returning any Node at all.

I haven't created any Indexes yet. But if I read correctly you can only create Indexes on properties and it will only speed up your queries.

Can anybody spot a mistake?

Thank you for your help!

1

1 Answers

0
votes

Assuming your data is correct, then it looks like you've got the wrong direction specified on the ANSWERED relation:

MATCH 
(p:Person)-[:CREATED_EVENT]->(e:Event)-[:ANSWERED]->(q:question)
WHERE p.firstname = "foo" AND q.id=2
RETURN p, e, q;

If you still don't get results, would be good to create a sample graph demonstrating the problem at http://console.neo4j.org/?init=0