dbTalk Databases Forums  

Modelling Books (with XDb2)

comp.databases.object comp.databases.object


Discuss Modelling Books (with XDb2) in the comp.databases.object forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Neo
 
Posts: n/a

Default Modelling Books (with XDb2) - 02-07-2005 , 11:59 AM






Following script for an experimental db models several books, each of
which can have various number of genres, authors, publishers, etc.
Sample query is shown near end. Downloadable db at
www.xdb2.com/example/ex110.asp

// Create items in directory to classify things.
(CREATE *book.item ~in = dir)
(CREATE *ISBN.item ~in = dir)
(CREATE *author.item ~in = dir)
(CREATE *publisher.item ~in = dir)

// Create genres known at design-time.
(CREATE *genre.item ~in = dir)
(CREATE *fiction.cls = genre)
(CREATE *non-fiction.cls = genre)
(CREATE *sci-fi.cls = genre)
(CREATE *mystery.cls = genre)
(CREATE *computer.cls = genre)
(CREATE *database.cls = genre)

// Create a book with 1 author, 1 publisher, 3 genres.
(CREATE *Intro to Database Systems.cls = book
& it.ISBN = +0-201-54229-X
& it.author = +C J Date
& it.publisher = +Addition-Wesley Publishing Co
& it.genre = non-fiction
& it.genre = computer
& it.genre = database)

// Create a book with 1 author, no ISBN and 1 publishers.
// Classify book in a new genre created on the fly.
(CREATE *Symbolic Logic.cls = book
& it.author = +Susanne Langer
& it.publisher = +Vintage Books
& it.publisher = +Dover Publications
& it.genre = non-fiction
& it.genre = (CREATE *logic.cls = genre))

// Create a book with 2 authors and 2 publishers.
// Classify book in 4 genres,
// 3 of which are created on the fly.
(CREATE *Godel Esher Bach.cls = book
& it.ISBN = +0-39-74502-7
& it.author = +Douglas Hofstadter
& it.author = +Albert Einstein
& it.publisher = +Vintage Books
& it.publisher = +IDG Books
& it.genre = non-fiction
& it.genre = (CREATE *math.cls = genre)
& it.genre = (CREATE *art.cls = genre)
& it.genre = (CREATE *music.cls = genre))

// Find books written by C J Date in database genre.
// Finds "Intro to Database Systems"
(SELECT *.cls=book & *.author=C J Date & *.genre=database)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.