I am looking for some reference work or tutorial of a persistent objective-c tree? I am trying to build a family tree (genealogy records) app on iPhone / Mac OS. Thanks!
Your question is not very clear. You can define any type of data model that you want. If you want to build objects that can have a parent and children you just build it.
What have you tried that has not worked? How did it not work?
(key: -->
= to-one, -->>
= to-many)
Your basic tree-like entity map would look like this:
LinkedTreeNode{
//... whatever attributes you want a node to have
parent <--(optional,nullify)-->>LinkedTreeNode.children
children <<--(optional, cascade)-->LinkedTreeNode.parent
}
It has one entity that has relationships to itself. The parent relationship points to one other object above it in the tree (the parent) and to one or more child objects below it in the tree. Its logically exactly like a standard C tree. You simply replace pointers that serve as links with entity graph relationships.
For modeling genealogy relationships, you need to add a spouse because (hopefully) every person as a father and mother and any person may have more than one spouse.
Person{
spouses <<--(optional,nullify)-->>Person.spouses
parents <<--(optional,nullify,Max=2)-->>Person.children
children <<--(optional,cascade)-->>Person.parents
}