1
votes

I'm looking to make a cypher query which finds all outgoing relationships from node, excluding a couple. Here's an example:

START node=node(5), excludeRels=rel(7,8,9)
MATCH node-[rels]->x
RETURN rels

But I would like to exclude the rels in excludeRels from the returned rels. So if node(5) has outgoing relationships 6,7,8,9 and 10, I would like 6 and 10 to be returned.

Is this possible?

2
What is the rel(7,8,9) doing? I couldn't find any infos about rel() except for the use case rel(path) where it returns a collection of the relationships of path.gogo_gorilla

2 Answers

3
votes

Incase anyone else is wondering, I found the answer to the above problem to be:

START node=node(5), excludeRels=rel(7,8,9)
WITH node, collect(excludeRels) as erels
MATCH node-[rel]->()
WHERE NOT rel IN erels
RETURN rel
0
votes

This should also work

START node=node(5), excludeRels=rel(7,8,9)
MATCH node-[rel]->()
WHERE rel <> excludeRels
RETURN rel