Ooker
Ooker

Reputation: 3002

PatternExpressions are not allowed to introduce new variables

I have two types of relationship that can exist between two same nodes. I want to extract the nodes that only have type1 and not type2 relationship. My query is:

Match (n) where (n)-[:type1]-(m) and (not (n)-[:type2]-(m)) return n

This gives error:

PatternExpressions are not allowed to introduce new variables: 'm'. (line 1, column 32 (offset: 31))
"Match (n) where (n)-[:type1]-(m) and (not (n)-[:type2]-(m)) return n"
                               ^

Neither Googling around nor the documentation Patterns - Neo4j Cypher Manual give me any useful help. Do you know why is this?

Upvotes: 1

Views: 1468

Answers (1)

norihide.shimatani
norihide.shimatani

Reputation: 181

How about this.

match(n)-[:type1]-(m)
where not (n)-[:type2]-(m)
return n

Upvotes: 1

Related Questions