Re: Normalization Question
Date: 30 Jan 2005 13:37:45 -0800
Message-ID: <1107121065.130944.289820_at_c13g2000cwb.googlegroups.com>
> 1 > Marshall]Lucas > 123 W. Somewhere > 73003 > H]C]I > 14112131234]2318923]011123123445 > LIST filename PHONE. LIST filename BY-EXP PHONETYPE="C" PHONE.
Following script models above with an experimental db that allows each thing to have variable number of classifications, variable number of attributes and those attributes can have a variable number of values, all of which are automatically normalized by the db. GUI allows user to navigate data without having to perform joins or create views.
// Create items in directory to classify things.
(CREATE *person.item ~in = dir)
(CREATE *firstName.item ~in = dir)
(CREATE *lastName.item ~in = dir)
(CREATE *address.item ~in = dir)
(CREATE *street.item ~in = dir)
(CREATE *zip.item ~in = dir)
(CREATE *phone#.item ~in = dir)
(CREATE *home#.item ~in = dir)
(CREATE *cell#.item ~in = dir)
(CREATE *international#.item ~in = dir)
// Create a person named Marshall Lucas with address and phone#s.
(CREATE *.cls = person
& it.firstName = +Marshall & it.lastName = +Lucas & it.address = (CREATE *.cls = address & it.street = +"123 W Somewhere" & it.zip = +73003) & it.phone# = (CREATE *14112131234.cls = phone# & it.cls = home#) & it.phone# = (CREATE *2318923.cls = phone# & it.cls = cell#) & it.phone# = (CREATE *011123123445.cls = phone# & it.cls = international#)
)
// This query finds persons that have a phone#
(SELECT %.cls=person & %.phone#)
// This query finds persons that have a cell#
(SELECT %.cls=person & %.phone#=(%.cls=cell#))
Now suppose, we want Marshall to have a second cell#. Below script shows how with experimental db. How does your schema handle different number of values for home#, cell#, etc. For example, first person might have one cell number, while the next person has two cell numbers. If your schema encodes "14112131234]2318923]011123123445" how does it know there is 1 home#, 1 cell# and 1 international# versus 0 home#s, 3 cell#s, 0 international#s?
// Add second cell# to Marshall Lucas
(CREATE (%.firstName=Marshall & %.lastName=Lucas).phone# =
(CREATE *1112222.cls = phone# & it.cls = cell#))
Now suppose, we want to add a work# that has an extention attribute and it is shared by two persons. Below script shows how Marshall and Mary can have the same work# which has the extention 123, without redundant data. Note, while the work# 5556666 appears several times in the script, it is stored only once in the db and Marshall and Mary have references to it.
// Add work#
(CREATE *work#.item ~in = dir)
(CREATE *ext#.item ~in = dir)
(CREATE *5556666.cls = phone#
& it.cls = work#
& it.ext# = +123)
// Add work# to Marshall
(CREATE (%.firstName=Marshall & %.lastName=Lucas).phone# = 5556666)
// Add Mary with same work#
(CREATE *.cls=person & it.firstName= +Mary & it.phone# = 5556666)
Received on Sun Jan 30 2005 - 22:37:45 CET
