Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-07-2021 02:41 PM
Suppose I want actors who were in "The Matrix" but not "The Matrix Revolutions"
I want to do something like:
MATCH(p:Person) -[:ACTED_IN]-> (:Movie {name:"The Matrix"})
NOT MATCH(p) -[:ACTED_IN]-> (:Movie {name:"The Matrix Revolutions"})
RETURN p
which is not legal. I'm not sure how to do this.... Google didn't return anything useful but maybe I didn't ask in the best way.
Thanks in advance.
(If there was a DIFFERENCE operator in addition to UNION or INTERSECTION would be useful too.)
[Added] I made a separate request for DIFFERENCE feature post here: WANT DIFFERENCE operator. I didn't intend to make it a duplicate.
01-09-2021 10:41 AM
Two times in the same post
Please consider your own post before posting the same thing.
It's even worst then not searching before posting.
01-09-2021 01:11 PM
@tard.gabriel - if you look at my post, a link to the original post included., just like yours.
01-09-2021 01:33 PM
Sorry for the confusion dominicvivek06
My last answer was intended to clem.
He created two post for exactly the same subject, probably trying to get a better answer knowing that answered post are more unlikely to be answer again, or just a mistake.
For my taste your answer works. I gave him exactly what he wanted but not sure if the WHERE EXISTS subclause is optimal in this case. I'm try to get better in the underlying neo4j query tunning.
01-10-2021 08:56 AM
[added] This is somewhat of a duplicate of my other post, but I thought it be a good request to ask for a set operator (DIFFERENCE) to be added to the existing UNION operator. With a DIFFERENCE operator, I think the query would be conceptually cleaner, which is why I am suggesting it.
01-10-2021 12:28 PM
The WHERE [NOT] EXISTS { } subclause is definitively more sexy on the eyes and easier to use but if you are in a production environment the dominicvivek06 solution might be quicker I don't know.
I would be curious to compare both
All the sessions of the conference are now available online