• 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: Core Data: unidirectional relationships
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data: unidirectional relationships


  • Subject: Re: Core Data: unidirectional relationships
  • From: Quincey Morris <email@hidden>
  • Date: Wed, 13 Feb 2008 11:59:24 -0800


On Feb 13, 2008, at 02:59, Ruotger Skupin wrote:

consider the following example (that what I would like to model):

Entity: Department
Attributes: ...whatever...
Relationships:
headOfDepartment --> Employee
viceHeadOfDepartment --> Employee
pointyHairedBoss -->
dilbert -->
other Employees -->>


Entity: Employee Attributes: ...whatever... Relationships: department --> Department


Every Employee is only in one Department. The Department has (and needs) four special Employees (head, vice head, pointy haired boss, dilbert). Turns out that it is impossible to model this with bidirectional relationships if you don't want to model it like that:


Entity: Employee
Attributes: ...whatever...
Relationships:
departmentImHeadOf --> Department
departmentImViceHeadOf --> Department
departmentImPointyHairedBossOf --> Department
departmentImDilbertOf --> Department
departmentOtherEmployeeOf --> Department

What about:

Entity: Department
Attributes: ...whatever...
Relationships:
headOfDepartment --> Role
viceHeadOfDepartment --> Role
pointyHairedBoss --> Role
dilbert --> Role
other Employees -->> Employee

Entity: Role
Attributes: ...whatever...
Relationships:
department --> Department
employee --> Employee
(add role-type attribute or subclass Role if needed)

Entity: Employee
Attributes: ...whatever...
Relationships:
department --> Department
roles -->> Role

That's basically the same as your "ugly" version, just less ugly.


_______________________________________________

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


  • Follow-Ups:
    • Re: Core Data: unidirectional relationships
      • From: Quincey Morris <email@hidden>
References: 
 >Core Data: unidirectional relationships (From: Ruotger Skupin <email@hidden>)

  • Prev by Date: Re: ICal Alarm View
  • Next by Date: Re: ICal Alarm View
  • Previous by thread: Re: Core Data: unidirectional relationships
  • Next by thread: Re: Core Data: unidirectional relationships
  • Index(es):
    • Date
    • Thread