Re: "OO" Equivalent of SQL Ad Hoc Program

From: Neo <neo55592_at_hotmail.com>
Date: 22 Dec 2006 13:13:30 -0800
Message-ID: <1166822010.826947.244090_at_79g2000cws.googlegroups.com>


A few question for Bob (or anyone else that can answer them):

Why not insert just book into catalog instead of a book's title and author?
What if the book has more than one author?

Why is the book.type = "book", this seems redundant. What other types are there?

What is the difference between congress_books and congress_titles? Is congress_books a sub set of congress_titles?

Why does congress_titles have the attribute language? Shouldn't language be an attribute of book?

What is brit_natnl_biblio? A group?

What does "SELECT 1 FROM catalog" do? Select the first record or first attribute?

What does the attribute serial mean?

Is there a distiction between author and co_author, or is co_author simply the second author?



Below is a network/OO-type db's initial script to do something similar to the SQL script (although I don't fully understand it yet).

(; Following adds book3 in catalog since

   its pub_date is between 19990705 and 20030105    and its author or co_author is a member of britNatBio    and it is an item of libraryOfCongress    and it is not on the blackList)
(set catalog

     item
     (!= (and (get book instance *)
              (get * pub_date (<= (>= (get date instance *)
                                                 19990705)
                                           20030105))
              (get * (or author co_author) (get britNatBio member *))
              (get libraryOfCongress item *)
         )
         (get blackList item *)
     )

)

The above expression to be executed after populating db with following script:

(new 'isbn)
(new 'language)

(new 'member)
(new 'author)
(new 'co_author)

(new 'pub_date)
(new '19990705 'date)
(new '20010607 'date)
(new '20030105 'date)

(new 'john 'person)
(new 'mary 'person)
(new 'bob 'person)
(new 'sue 'person)

(new 'book1 'book)
(set+ (it) isbn '23-67)
(set (it) pub_date 19990705)
(set+ (it) language 'en_US)
(set (it) author john)
(set (it) co_author mary)

(new 'book2 'book)
(set+ (it) isbn '56-97)
(set (it) pub_date 20010607)
(set+ (it) language 'en_US)
(set (it) author bob)
(set (it) co_author sue)
(set (it) co_author mary)

(new 'book3 'book)
(set+ (it) isbn '34-086)
(set (it) pub_date 20030105)
(set+ (it) language 'en_US)
(set (it) author john)
(set (it) co_author bob)

(new 'libraryOfCongress 'library)
(set (it) item book1)
(set (it) item book2)
(set (it) item book3)

(new 'blackList)
(set blackList item book2)
(set blackList item book3)

(new 'guild1 'guild)
(set guild1 member john)
(set guild1 member mary)

(new 'guild2 'guild)
(set guild2 member bob)
(set guild2 member sue)

(new 'britNatBio)
(set (it) member bob)

(new 'catalog)
Received on Fri Dec 22 2006 - 22:13:30 CET

Original text of this message