I'm not sure that's actually a solution. The problem is that if I can specify a relationship and its inverse in the Core Data model editor, then Core Data handles setting the opposite end of the relationship for me. Since this is a generic feature, it can't do what I want, because adding a Segment to a Node has an ambiguous inverse.
I think the solution is to mark the relationships as not having inverses in the model, and then manage the inverse relationship myself in code (that is, always require that a Node be set on a Segment, and that operation will then add the Segment to the Node). Can anyone confirm that this is indeed how to solve this problem? Thanks! On Dec 12, 2009, at 16:43:02, Charlie Dickman wrote: > Rick, > > This can be done in a straightforward manner using C structures that contain > pointers to the C structures. > > For example, you can define structures > > typedef node _node { > segment *someSegment; > } > > typedef struct _segment { > node node1; > node node2; > } > > set node.segment to nil in the last segment and chain them together. Remember > to malloc each instance and free them when they are no longer needed. > > This model can easily be transmogrified into Objective C objects. > > On Dec 12, 2009, at 7:30 PM, Rick Mann wrote: > >> Hi. I'm trying to set up a model for a Node and a Segment. A Segment exists >> between Nodes. Each Segment has a node1 and node2 attribute, and each Node >> can have multiple Segments. I don't seem to be able to model this >> relationship; I can have either node1 with an inverse of segments, or node >> 2, but not both. >> >> It's important for me to distinguish which end of a segment a particular >> Node is associated with (imagine drawing a directed arrow). I feel like this >> should be straightforward, but I'm stuck. >> >> Any suggestions? >> >> TIA, >> Rick >> >> _______________________________________________ >> >> 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/3tothe4th%40comcast.net >> >> This email sent to 3tothe...@comcast.net > > Charlie Dickman > 3tothe...@comcast.net > > > _______________________________________________ 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