Thanks Quincey for you quick reply! I still have some questions >> User can create files and folders (they don't have to be real folders/files). >> Folders can contain files or other folders >> Files have: >> title, >> summary and >> 8 children >> Each child also has a title and a summary and could have 8 children >> (optionally) >> This could be as many levels (recursive) as the user desires. >> I am not sure how to express this in CoreData. Could someone give a hand >> here? >> >> This is what I've done: http://yfrog.com/j2o1op >> >> "Child" entity with "title" and "summary" attributes and "children" >> (to-many) relationship pointing to "Child" entity >> "File" entity with "isDirectory" and "name" attributes and "files" >> (to-many) relationship pointing to "File" entity and "children" >> (to-many) relationship pointing to "Child" entity. >> >> Doing that gets me a warning: >> File.children -- to-many relationship does not have an inverse: this >> is an advanced setting (no object can be in multiple destinations for >> a specific relationship) >> Why is that? I've tried to set the inverse relationship but there are >> no options to choose from. > > According to this description, you're not missing one inverse, you're missing > 3 of them: File.parentFile, Child.parentChild and Child.parentFile. If that > sounds a bit weird that's because your design is a double tree structure with > 2 entities in it. > You are right, I was missing 3. but I also could add an inverse relationship to 2 of them. The third is kind of weird because there are no options to choose from in the pull-down menu (only "No Inverse relationships" is available, that is why I was getting the warning)
> So one approach is to add the 3 missing 1-1 relationships. (A Child object > has a parentChild or a parentFile but not both. Or maybe it can have both -- > your description doesn't exactly rule out that this might be your intention.) Sorry, the rule is a Child object has a parentChild or a parentFile. Not both. Could you be more specific in what do I need to add and/or correct? I am kind of new to structure modeling with CoreData and I am not sure is the following is correct: (attributes didn't change) "Child" entity has: one to many "children" relationship with itself. one to one "parentChild" relationship with itself. one to one "parentFile" relationship with "File" entity. "File" entity has one to many "children relationship with "Child" entity. one to many "files" relationship with itself. one to one "parentFile" relationship with itself. Then I added its inverse relationships:(Because I got 6 warnings) Child.children 's inverse is children Child.parentChild 's inverse is parentChild Child.parentFile 's inverse is children (Why?, only children option is available.) File.children 's inverse is parentFile (Why?, only parentFile option is available) File.files ' inverse is files File.parentFile 's inverse is parentFile I don't think I am understanding very well "inverse" concept. I hope I can get some help. Thanks in advance. Ignacio. _______________________________________________ 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