On Dec 18, 2008, at 11:04 AM, mmalc Crawford wrote:


On Dec 18, 2008, at 10:47 AM, Michael B Johnson wrote:
I have an entity (let's called it MyThing) that has an optional parentThing relationship. I'm interested in MyThings that either don't have their parent set, ("parentThing == NIL") or have their parent set to themselves ("parentThing == SELF"). Do those predicate forms sound right?

Yes, for more details see
<http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/Articles/pUsing.html > and <http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdFetching.html >


Great, thanks. I had skimmed that, but missed the specific example in "Using".



My other question is regarding the mundanity of doing a Core Data document based app version versus an old skool Cocoa one, especially one that used a file package for document storage. I'm realizing that I have a lot of state in my document that's specific to the document (i.e. not application settings). Normally, these would be instance variables of my NSDocument subclass that I would load/save as part of my document data. It seems more Core Dataish, though, to make an NSManagedEntity to hold these values, and then perhaps cache the values in a property of the NSManagedDocument subclass as I open up.

It would probably be more appropriate to store this as metadata -- see <http://developer.apple.com/documentation/Cocoa/Conceptual/NSPersistentDocumentTutorial/07_Metadata/chapter_8_section_2.html > for an example of how to set metadata (this is for Spotlight metadata, but the same principles apply). That would also cut the Gordian Granny Knot of your other concerns.

I guess that's my question, though. Why is that a bad thing, to have three relationships from on entity all pointing to another entity, which is only pointing to the other entity once?

Trying to gain some deeper understanding...

- wave





mmalc


_______________________________________________

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