Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
V <-->> O <<--> P
我正在尝试编写正确的谓词,以便我可以获得V至少具有一个或多个O与某个实体匹配的实体的所有P实体。
V
O
P
我试过这样的事情:
NSPredicate * predicate = [NSPredicate predicateWithFormat:@"SUBQUERY(O, $b, ANY $bs.P == %@).@count > 0", P];
不工作。显然,到目前为止,我并没有正确地考虑这个问题。知道如何正确完成此查询吗?
假设 V 到 Oos的关系称为 ,O 到 P 的关系称为p。子查询的语法如下:
os
p
NSPredicate *predicate = [NSPredicate predicateWithFormat: @"SUBQUERY(os, $o, $o.p == %@).@count != 0", pToMatch];