Skip navigation.
 
mlRe: NSPredicateEditor
FROM : Peter Ammon
DATE : Fri Jul 04 01:30:31 2008

On Jun 26, 2008, at 6:48 PM, Chris wrote:

> On Fri, Jun 27, 2008 at 10:09 AM, Peter Ammon <<email_removed>> 
> wrote:
>

>>
>> On Jun 25, 2008, at 7:27 PM, Chris wrote:
>>

>>>
>>> The net effect is that NSPredicateEditor can't display a predicate 
>>> like
>>>
>>> NOT (foo = "bar")
>>>
>>>
>>> A bug in NSPredicateEditor system perhaps? But surely someone 
>>> would have
>>> seen it before.
>>>

>>
>> Hi Chris,
>>
>> NOT type compound predicates only support exactly one subpredicate, 
>> or at
>> least they did when NSPredicateEditor was written.  For this 
>> reason, the
>> default implementation of NOT expects the sole subpredicate to be 
>> an OR
>> type.  So set this:
>>
>> NOT(OR(foo="bar"))

>
>
> Ahh, this would explain why it hasn't been reported before.
>
> However the BNF description of predicates does not impose that 
> restriction:
>
> http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/Predicates.pdf
>
> And also, when you convert the predicate to a string, it doesn't 
> show the
> OR. The OR is apparently optimized away by the predicateFormat 
> routine.
> Since the only way to feasibly store a predicate is as a string, and 
> then
> parse it back in, its not really consistent.


The right way to store an NSPredicate is archival via NSCoding.  The 
string representation of a NSPredicate has always been lossy.

-Peter

Related mailsAuthorDate
mlNSPredicateEditor Chris Jun 25, 08:08
mlRe: NSPredicateEditor Jim Turner Jun 25, 15:57
mlRe: NSPredicateEditor Chris Jun 25, 16:19
mlRe: NSPredicateEditor Peter Ammon Jun 25, 22:12
mlNSPredicateEditor Chris Jun 26, 04:27
mlRe: NSPredicateEditor Kyle Sluder Jun 26, 14:53
mlRe: NSPredicateEditor Peter Ammon Jun 27, 02:09
mlRe: NSPredicateEditor Chris Jun 27, 03:48
mlRe: NSPredicateEditor Peter Ammon Jul 4, 01:30