I'm preparing a Core Data mapping model using the GUI in Xcode.  In the old 
model, I had, say, an Animal entity.  In the new model, I am replacing Animal 
with two new entities, Bird and Fish.

I can distinguish Birds from Fish because birds have a beak but fish do not.  
The old Animal entity had a relationship to Beak, 'beak', used for Birds only.  
Aha!

I can't find any examples, but I've guessed that the "Source Fetch" is what I 
need.  I created two Entity Mappings, AnimalToBird and AnimalToFish.  After 
trying various incantations from the Core Data Migration Guide and Predicate 
Programming Guide, I found that Xcode accepted my input if I set "Source Fetch" 
to Default and entered one of these as "Filter Predicate":

    ($source.beak != nil)      // Bird
    ($source.beak == nil)      // Fish

Because I'm working on a huge mapping model, I want to reduce uncertainties.  
The document "Xcode Mapping Tool for Core Data" gives only a trivial example, 
and NSEntityMigrationPolicy doesn't mention filters or predicates; this feature 
seems to be an "Xcode exclusive bonus".

So I'd appreciate if someone could indicate whether or not I've done this 
correctly.

Jerry Krinock

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to