If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Trivial Question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-26-04, 14:47
b737 b737 is offline
Registered User
 
Join Date: Mar 2004
Posts: 28
Question Trivial Question

Hello, a very good eveing to you all.
I have a question regarding er modelling that has been plaguing me for a few days now.
I will have to develop an eer from my er and the simple problem is as follows.
Suppose i have 2 entities University and School which are stated explicitly.
Now suppose a University provides a studentlibrary (entity) with attributes staff books etc...
And suppose School provides a publicLibrary (entity) with identical attributes as the above (i.e staff books etc..) and both have same primary key

whats the best way to represent this in an er model.I have just [university] (relationshiprovides) [studentlibrary] and also [school] (relationshiprovides) [publiclibrary].this seems a bit redundant though.Should i just have 1 entity called [ibrary]instead of the [studentlibrary], [publiclibrary] entities.if i do this how will it play in my eer model,
Please help,
thanking you all.
regards confused
Reply With Quote
  #2 (permalink)  
Old 10-26-04, 14:51
b737 b737 is offline
Registered User
 
Join Date: Mar 2004
Posts: 28
damn it, should be (relationshipprovides)) instead of those smily faces, sorry
Reply With Quote
  #3 (permalink)  
Old 10-26-04, 14:53
b737 b737 is offline
Registered User
 
Join Date: Mar 2004
Posts: 28
for gods sake, (realtionship "provides") there that should do it.not use to these smilies, ive disabled them now!
Reply With Quote
  #4 (permalink)  
Old 10-26-04, 15:26
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
use two entities, [studentlibrary] and also [publiclibrary]

trying to combine them will lead to headaches

when the time comes to implement them in a physical database, there are all kinds of tricks that you can use in order to implement only one library table (e.g. mutually exclusive optional foreign keys to two different parent tables), but for conceptual and logical modelling, you definitely want to keep them separate
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 10-26-04, 15:55
b737 b737 is offline
Registered User
 
Join Date: Mar 2004
Posts: 28
gotcha.makes sense!just to clarify even though they have the exact same attributes and primary key, ill keep them seperate.Will they still be seperate in the EER model too?
Finally for what reason would it cause headaches combining them (just curious)!
thanks a million for your help!
Reply With Quote
  #6 (permalink)  
Old 10-26-04, 16:08
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
what is EER? is that like ER?

headaches? well, just try having the same entity be the mutually exclusive child of two parents

i have no idea how you would draw that
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #7 (permalink)  
Old 10-27-04, 06:28
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
Quote:
Originally Posted by r937
headaches? well, just try having the same entity be the mutually exclusive child of two parents

i have no idea how you would draw that
This is how you would do it using the Barker ERD notation, which is popular with Oracle people like me:
Code:
+------------+              /  +----------+
| University |- - - - ------|-<| Library  |
+------------+              |  |          |
                            |  |          |
                            |  |          |
+------------+              |  |          |
|   School   |- - - - ------|-<|          |
+------------+              \  +----------+
(That's the best I could do graphically: my attemps to upload a bitmap always fail!)

The kind of bracket-thing joining the two relationships is called an "arc", and it means in this case: "a Library must be associated with EITHER a University OR a School (not both)".

However, an alternative would be to use subtypes:
Code:
                            +------------------------+
                            | Library                |
+------------+              | +--------------------+ |
| University |- - - - -------<| University Library | |
+------------+              | +--------------------+ |
                            |                        |
                            |                        |
+------------+              | +----------------+     |
|   School   |- - - - -------<| School Library |     |
+------------+              | +----------------+     |
                            +------------------------+
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
  #8 (permalink)  
Old 10-27-04, 12:42
b737 b737 is offline
Registered User
 
Join Date: Mar 2004
Posts: 28
Wink

hi thanks for both of your help.Just to briefly inform people reading this topic, EER modelling means "Enhanced Entity Relationship" Modelling and enhances an ER model to include generalization/specialization, inheritance, disjoint/non-disjoint relationships between sub and super classes and participation constraints etc...

In my eer model i now believe i will have a Library superclass that has entities (books, staff, members...) and it will have 2 subclasses universityLibrary and SchoolLibrary within a disjoint relationship, meaning that a library can be a university library "OR" a school library but never both because they are seperate in their own contexts even though they have the same entities.

One final question
within my "ER" diagram (as r937 commented) should i have something like:


|university|---------"provides"-------|studentlibrary|

"cardinality 1:1"



|school |---------"provides"--------|schoollibrary|

"cardinality 1:1"

and then have superclass (library) and subclasses (studentlibrary and universitylibrary entities) in my eer diagram as mentioned the part about my EER diagram and similar to what Mr. Andrews posted?
again many thanks for your informative help and contribution,
regards!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On