core data subentities
core data subentities
- Subject: core data subentities
- From: Daniel Child <email@hidden>
- Date: Fri, 11 Jan 2008 15:29:55 -0500
Hi all,
I have a basic question regarding the way subentities work in Core
Data. My model has SuperEntity, SubOne, and SubTwo as the three
entities, with SubOne and SubTwo having child relationships to
SuperEntity. I was trying to test this "quick and dirty" prototype
and found two problems.
The first is the layout. Dragging the models to Interface Builder, I
get an NSArrayController for the table view of SuperEntity, and
NSObjectControllers for the two "one-object" displays of subentities.
But they are not linked, and I'm not sure how the bindings should be
linked.
The second is conceptual. If I am going to be importing data
corresponding to type SubOne, and then supplementing that with data
from SubTwo, how exactly does that work. Is a SubOne object a
SuperEntity with an additional attribute? The problem I especially
envisage is if there is overlap. For instance, say they are
dictionary words from different dictionaries.
(SubOne data entry)
lexeme: pen (superentity field)
IPA: (the IPA spelling) (superentity field)
definition: a writing implement (SubOne field)
(SubTwo data entry)
lexeme: pen (superentity field)
IPA: (the IPA spelling) (superentity field)
definition: a tool used for writing (SubTwo field)
etymology: xxxxx (another SubTwo field)
If I had imported the first data from a SubOne file, and then were
importing data from a SubTwo file, I would not want to create a new
record, but rather simply place the new information (definition and
etymology) in the SubTwo portion. But in the real application
(assuming I decide to use Core Data) I would in fact have many
different types of word data, of which only a few fields (attributes
like "lexeme") are common to all word data.
I know the above example is not that interesting, but it is the same
concept as what I would be doing. I haven't seen any indication of
how to handle subentities, or for that matter, an explanation of
whether the attributes in SuperEntity and those in the SubEntities
are considered part of one managed object or of separate managed
objects. So even using KVC it is unclear to me how you would be
referencing superentity and subentity attributes.
I've tried to read documentation but haven't seen any examples of
this kind of structure. If anyone could give me a heads up or a super
basic example of a similar thing, I'd really appreciate it.
Thanks.
Daniel
_______________________________________________
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