Re: Heirarchical Data Structures. MS Access. Together?
Date: Wed, 16 Jul 2003 01:03:59 -0700
Message-ID: <en1ahv0thvpvk6uv92mb1du85c546q44md_at_4ax.com>
"Jace Harker" <jharker_at_marlboro.edu> wrote:
>1. Health Care Worker
> A. # of Patients per week
> B. Doctor?
> C. Nurse?
> D. Assistant?
>2. NASA Employee
> A. Astronaut?
> B. Engineer?
> C. PR Expert?
> D. Amount of time spent in space
>3. Boy Scouts
> A. Cub Scout?
> B. Boy Scout?
> C. Eagle?
> D. Den Mother?
> E. Age you started
>These might apply to a person. So the person could be either #1 or #2, but
>not both at once, but the person could be #3 or not, regardless. If the
>person is #1 then she is able to select one of B,C, or D, and put a value in
>for A. And so on. Of course the person would also possess a number of
>top-level fields like Name, Address, Phone, etc., but those by themselves
>would not be a problem.
>There are different KINDS of entity: People, and Companies. They can have
>relationships with each other (for example, Dr. John Smith, MD, is
>affiliated with Springfield General Hospital). Different kinds of entity
>get different options (Companies would not get the Health Care Worker option
>;-).
>Entity relationships unlock data options: "Dr. John Smith" is related to
>"Springfield General". Because Springfield General has been selected as
>type "Hospital", Dr. Smith's record _now_ allows us to choose his specific
>hospital staff title and watch hours from a list. But those options
>_would_not_ appear if he did not have a relationship with that particular
>type of company.
>That's the basic idea. I apologize for not knowing the proper terminology,
>but I'm fairly new to database programming and this is my first experience
>with this particular problem.
However, that list at top, which could have more nested levels - that is a tree, a nodeset, a hierarchy; except for the scalar values (time spent, etc) which could go with separate tables whose rows are laid out, essentially, as type structures, in some field in a row for that individual. It's a pick'em label list, basically. The bottom 'leaf' would have a unique id. And that would be stored in some field of the row for the individual. I think that list, above, would be best presented in a treeview. I would use adjacency lists to store the hierarchy. There is the 'flat index'/'materialized path' method, mentioned in the first paragraph, as an alternative. And I'm sure there are various methods for storing a self-referential, hierarchical tables, such as Celko's 'nested sets', which articles he has frequently posted to Usenet and assorted web boards. Received on Wed Jul 16 2003 - 10:03:59 CEST