Re: Modeling User/Accounts



From a relational perspective ...

Below is an alternate OO/network-type solution. It models two programs
named child service and health services. Each service has the same
admin named john. Child services has two contacts named mary and bob.
Health services has two contacts named mary and sue. Each person have
varied attributes some with multiple values. Example queries find mary
and sue.

(new 'title)
(new 'gender)
(new 'age)
(new 'race)
(new 'phone#)
(new 'cell#)
(new 'email)
(new 'user_name)
(new 'password)

(new 'address)
(new 'street)
(new 'city)
(new 'state)
(new 'zip)
(new 'country)

(new 'child_services 'program)
(new 'health_services 'program)

(new 'admin)
(new 'contact)

(new 'john 'person)
(set+ (it) email 'admin1&ibm.com)
(set+ (it) user_name 'superAdmin)
(set+ (it) password 'pwd1)

(new 'mary 'person)
(set+ (it) gender 'female)
(set+ (it) age '35)
(set+ (it) phone# '123-4567)
(set+ (it) phone# '323-8899)
(set+ (it) cell# '567-3434)
(set+ (it) email 'mary&gm.com)
(set+ (it) email 'mary&chysler.com)
(set+ (it) user_name 'mary)
(set+ (it) password 'pwd2)

(new 'bob 'person)
(set+ (it) gender 'male)
(set+ (it) race 'asian)
(set+ (it) phone# '323-8899)
(set+ (it) cell# '567-3434)
(set+ (it) cell# '230-5656)
(set+ (it) email 'bob&exxon.com)
(set+ (it) user_name 'bob123)
(set+ (it) password 'pwd3)

(new 'sue 'person)
(set+ (it) title 'mrs)
(set+ (it) age '22)
(set+ (it) race 'chinese)
(set+ (it) race 'japanese)
(set (it) address (block
(new)
(set address instance (it))
(set+ (it) street (set '123 'main 'st))
(set+ (it) city 'chicago)
(set+ (it) state 'illinois)
(set+ (it) zip '56234)
(set+ (it) country 'usa)
(it)))
(set+ (it) email 'sue&honda.com)
(set+ (it) user_name 'suzy)
(set+ (it) password 'pwd4)

(set child_services admin john)
(set child_services contact mary)
(set child_services contact bob)

(set health_services admin john)
(set health_services contact mary)
(set health_services contact sue)

(; Get person
who is a contact for both child and health services
and their phone number is 323-8899)
(; Gets mary)
(and (get person instance *)
(get child_services contact *)
(get health_services contact *)
(get * phone# 323-8899))

(; Get person
who is a contact for both child and health services
and their phone number is 323-8899)
(; Gets mary)
(and (get person instance *)
(get child_services contact *)
(get health_services contact *)
(get * phone# 323-8899))

(; Get person who is a contact for health services
and their address's zip is 56234)
(; Gets sue)
(and (get person instance *)
(get health_services contact *)
(get * address (get * zip 56234)))

.