• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Why is it wrong to have relationships without an inverse in Core Data?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is it wrong to have relationships without an inverse in Core Data?


  • Subject: Re: Why is it wrong to have relationships without an inverse in Core Data?
  • From: Ian Joyner <email@hidden>
  • Date: Sun, 30 Jun 2013 12:30:30 +1000

Was there ever a satisfactory answer to this? I'm not sure what the CD modelling answer is, but this seems to be related to relational modelling referential integrity or in plainer language - no dangling pointers - in db language a foreign key must have a primary key in another relation.

For example if there is no inverse in the active child and the active child is deleted, the active_child foreign key will be left as such a dangling foreign key. (That is why your second solution clobbered original key.)  It needs to be set to nil (meaning value either not known or not applicable). This leads to Codd's 3- and 4-value logic, which is contentious in itself (Date does not like it and forbids null values). But you can answer that question 'Does the parent have to have an active child or not?'. That is an application-level integrity constraint.

The structure is not the only thing that needs to be considered, but what happens when changes are applied to that structure as well. (Reminds me of Steve Jobs quote of Design is not just how it looks, but how it works as well.)

On 22 Jun 2013, at 06:55, Rick Mann <email@hidden> wrote:

> I find myself frequently wanting to do something like this:
>
> Parent
>  children     to-many to Child
>  activeChild  to-one to Child
>
> Child
>  parent       to-one to Parent
>
> But Core Data complains that activeChild is misconfigured because it doesn't have an inverse. But I have no need for an inverse, why does Core Data?
>
> Thanks,
>
>
> --
> Rick
>
>
>
>
> _______________________________________________
>
> 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


_______________________________________________

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


References: 
 >Why is it wrong to have relationships without an inverse in Core Data? (From: Rick Mann <email@hidden>)

  • Prev by Date: Re: private redeclaration of an instance variable
  • Next by Date: Re: private redeclaration of an instance variable
  • Previous by thread: Re: Why is it wrong to have relationships without an inverse in Core Data?
  • Next by thread: NSTableView/NSOutlineView view-based group rows/items span the whole column?
  • Index(es):
    • Date
    • Thread