Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
08-06-2019 04:46 AM
Hi,
I have to lists, say A and B. I want to check if all elements of B are contained in A, i.e if B is a subset of A..
More specifically I have a list of labels and I want to find nodes having all those labels, and they can possibly have more labels.
I have tried various of collect, all and so on and cant find a good way. Any suggestions?
Thanks
08-06-2019 08:20 AM
You can use a list predicate to ensure a condition exists for all elements of a list:
WITH listA, listB
WHERE all(element in listB WHERE element in listA)
If you're starting from nodes and want to check this for node labels, then something like:
WITH nodeA, nodeB
WHERE all(label in labels(nodeB) WHERE label in labels(nodeA))
All the sessions of the conference are now available online