Match specific relationship types in path

Hi n4j folks,

I have a question regarding cypher syntax: I want to match a path and exclude a certain relationship path.

I tried it with:

match p=(:WProcedure) - [*1..50] -> (:WTask)
where all(rel in relationships(p) WHERE type(rel) <> "CONSISTS_OF")
return p

As you can see, I want to exclude the rel type "CONSISTS_OF" but it does not work..
The statement excludes the only "CONSISTS_OF" relationships but if there are several relationships without the type "CONSISTS_OF", I receive the other types AND the ones with "CONSISTS_OF".

I hope you can help me on that one!

Your n4j ninja,


If you're referring to what you see in the browser, you may want to turn off the "Connect Result Nodes" checkbox from the browser preferences, as the browser attempts to autocomplete any relationships between returned nodes (which is issued as a separate query under the hood).

Otherwise, your approach looks correct, the query should ensure that no :CONSISTS_OF relationships will be allowed in any path. Perhaps more details here can help show the issue.