Re: IS-A relationships in core data
Re: IS-A relationships in core data
- Subject: Re: IS-A relationships in core data
- From: Charles Steinman <email@hidden>
- Date: Fri, 16 Nov 2007 11:25:51 -0800 (PST)
Like subclasses, subentities inherent their parent entity's properties. If Word has a "spelling" attribute, its subentities have that as well, so you can't (and don't need to) give them another identical attribute.
Cheers,
Chuck
----- Original Message ----
From: Daniel Child <email@hidden>
To: mmalc crawford <email@hidden>
Cc: cocoa-dev cocoa-dev <email@hidden>
Sent: Friday, November 16, 2007 11:06:22 AM
Subject: Re: IS-A relationships in core data
OK, let me rename the tables:
Words (a "master list")
OldEnglishWords (one of the contributing lists)
ModernEnglishWords (another contributing list)
FrenchOriginWords (another contributing list)
All three subsidiary lists are special types of Words, with their own
separate fields (attributes). Unfortunately, the article you cite
doesn't help much. Yes, of course you set the parent entity. But I'm
asking about approaches to normalizing or denormalizing the data. Let
me expand the example.
Every Word has an orthographic realization ("spelling") and a
pronunciation.
WORD (spelling, pronunciation)
Every FrenchOriginWord will have a frenchSpelling, which may be
different from its English spelling. Thus,
FRENCHORIGINWORD (spelling, pronunciation, frenchSpelling)
Assuming that spelling can serve as the key field in both tables,
then normally you simply copy the super-entity's key field into the
sub-entity attributes lists and make it the key as well. (Apparently,
you could do the reverse, but the DB design books recommends the
former approach.)
When I name the two fields the same thing, XCode says they conflict.
Does that mean I have to rename the spelling key in FRENCHORIGINWORD?
That is rather weird.
Is Core Data using surrogate keys in the background? Does it give you
an option to set surrogate keys?
On Nov 16, 2007, at 11:01 AM, mmalc crawford wrote:
>> how do you handle IS-A relationships in Core Data.
>> [...]
>> Lets say I have a MasterList created from three separate lists,
>> ListA, ListB, and ListC. Let's say that the MasterList has certain
>> properties (last name, first name) in common that will also be
>> found in data from the individual lists. However, the structure of
>> the three individual lists may otherwise be different.
>>
> It's not clear what you mean. You seem to be describing a has-a
> relationship.
> If you want to define an inheritance hierarchy, use inheritance:
>
> <http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/
> Articles/cdMOM.html>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden
____________________________________________________________________________________
Be a better pen pal.
Text or chat with friends inside Yahoo! Mail. See how. http://overview.mail.yahoo.com/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden