You can nest SUBQUERY in a predicate. But it seems that one SUBQUERY is enough here (if ds is a one-to-one relation from C to D ), for example
[NSPredicate predicateWithFormat:@"SUBQUERY(bs, $x, ANY $x.cs.ds.name = %@) .@count > 0", name];
source share