Results 1 to 8 of 8
  1. #1
    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

  2. #2
    Join Date
    Mar 2004
    Posts
    28
    damn it, should be (relationshipprovides)) instead of those smily faces, sorry

  3. #3
    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!

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    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!

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  7. #7
    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 |     |
    +------------+              | +----------------+     |
                                +------------------------+

  8. #8
    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •