1
votes

I am working on the Neo4j tutorial Movies database. I would like to make a query that returns the people that directed a movie but did not produced it.

In order to accomplish this I have used the query:

match (m:Movie)<-[:DIRECTED]-(p:Person)-[r]->(m) where type(r) <> 'PRODUCED' return p 

Nevertheless, if I make it return * I still get these couples (person, movie) where the person not only directed and produced the film but also wrote it:

In the image there is one of the not admissible couples that are returned by my query

On the contrary, the query seems to successfully rule out all those couples that are with only the two relationships 'PRODUCED' and 'DIRECTED'.

Is there a way of writing this query so that I can rule out all these couples as well?

1

1 Answers

0
votes

You can use path pattern in WHERE:

match (m:Movie)<-[r:DIRECTED]-(p:Person) 
where not (p)-[:PRODUCED]->(m)
return m, p, r