Reputation: 173
I'm actually trying to do a request like that. I want :
My nodes :
My Relationships :
For now i have this query :
MATCH (a:Geo)-[b:GeoNS]-(c:NS)
OPTIONAL MATCH (c)-[d:MachNS]-(e:Machine)-[f:VLANMach]-(g:VLAN)
OPTIONAL MATCH (c)-[h:NSNS]-(i:NS)
OPTIONAL MATCH (c)-[p:NSNS]-(q:NS)
return a
But as you can see, the last optional match is based on NS which have a machine. Thanks for your help.
Upvotes: 0
Views: 76
Reputation: 66947
Your last OPTIONAL MATCH
can use a WHERE
clause to filter out q
nodes that have a MachNS
relationship:
OPTIONAL MATCH (c)-[p:NSNS]-(q:NS)
WHERE NOT (q)-[:MachNS]-()
By the way, your RETURN
clause is not valid, since the query does not define an s
variable. Also, the query should be returning the results of all your matches.
Upvotes: 1