in

The ORM Foundation

Get the facts!

Disjunctive Reference Schemes

Last post 03-28-2009 18:55 by Terry Halpin. 20 replies.
Page 1 of 2 (21 items) 1 2 Next >
Sort Posts: Previous Next
  • 01-25-2009 8:35

    • Andy Reiser
    • Top 50 Contributor
      Male
    • Joined on 01-24-2009
    • Sunshine Coast, Queensland, Australia
    • Posts 14

    Disjunctive Reference Schemes

    I have a question with regard to one of the solutions to an exercise from the previous edition of the text book "Information Modelling and Relational Databases" (2001). I have re-drawn the solution diagram using the current ORM2 notation (from Exercise 5.4 (4)):
    ORM

    The reference scheme is disjunctive in nature. This suggests that the resulting primary key will have null values in one or more of its component attributes (which, as we know, is a big no-no). Is this a situation where there is a mismatch between the conceptual level and the relational (implementation) level?

    The error message that I got seemed to agree with me. It stated:

    "Error    1    Entity type 'Member' in model 'ORMModel1' requires a local preferred reference scheme or supertype(s) that provide preferred identification.    ORMModel1.orm    0    0"

    I understand from the text that disjunctive reference schemes are a murky area. Is there any room for them at all?

    Cheers

  • 01-25-2009 11:18 In reply to

    Re: Disjunctive Reference Schemes

    Hi Andy,
    Thanks for the question.
    There are several points to make about your example.

    Entity Types (page 63 of  Terry's  2001 book and page 66 of the 2008 version)
    An ORM Object Type can be either an "Entity" or a "Value"
    In your diagram the ORM Object "Member" is an Entity type and not a Value type.
    This means that the Object Type "Member" is a name for the set of all possible instances of Member.
    Sets don't have duplicates so "Member" needs a reference.

    In my example I have chosen ".id" but you can chose others.
    I used the NORMA Fact Editor to type in Member(.id) has GivenName() 
    The empty parentheses after GivenName tell NORMA that this is a Value Type.

    Your "Member" object is coloured red because the fact does not conform to the ORM2 rules.
    This is what the error message is saying.

    Allowing for multiple given names
    Your example allows for up to three given names, two of which are optional.
    Since, as you say, it is wise to avoid nulls my example is coded in a way that (a) allows for as many given names as you want and (b) avoids creating nulls in the database.

    I suggest that you make liberal use of the Verbalizer window. This will help you to identify the exact meaning of any facts that you enter and to correct them as you add them to the model.

    Hope this helps
    Ken


    Filed under:
  • 01-25-2009 19:12 In reply to

    • Andy Reiser
    • Top 50 Contributor
      Male
    • Joined on 01-24-2009
    • Sunshine Coast, Queensland, Australia
    • Posts 14

    Re: Disjunctive Reference Schemes

     Thanks Ken. You have confirmed what I suspected. The solution given was incorrect. I never understand why textbooks contain incorrect solutions.

    The verbalisation of the facts makes sense:

    For each Surname, GivenName, GivenName, and GivenName,
    at most one Member has that Surname and
    has first that GivenName and
    has second that GivenName and
    has third that GivenName.

    I believe that it is not a reference scheme at all. It is just a uniqueness relationship which is apty notated using the external uniqueness constraint.

    But the disjuntive problem is not good for a primary reference scheme. And of course, the easy way out is to make up a sequential identifier - that solves the primary reference scheme problem every time.

    Cheers

     

     

     

  • 01-26-2009 4:49 In reply to

    Re: Disjunctive Reference Schemes

    Hi Andy,

    Andy Reiser:
    The solution given was incorrect.

    Well, before I agree with you on this, I would need to review the example you mention in order to see what it was trying to illustrate.
    I could not find the example from your reference.

    Please confirn that the book in which you found the example is "Information Modeling and Relational Databases" 2001 by Terry Halpin?
    If so, please will you give me the page number of the book.

    Thanks
    Ken

  • 01-26-2009 17:54 In reply to

    • Dave Rogers
    • Top 150 Contributor
      Male
    • Joined on 10-30-2008
    • Brisbane, Australia
    • Posts 2

    Re: Disjunctive Reference Schemes

     Hi Ken,

     It was not an example in the book. It was one of the solutions to an exercise from the book. The text book is "Information Modelling and Relational Databases" (2001). And the solution was to Exercise 5.4 (4).

    Another problem with the solution was that instead of using a P in a circle (as per ORM1 requirements to depict a primary reference scheme), it featured a U in a circle (external uniqueness). There was no reference mode. So, the only possible reference scheme was the names.

  • 01-26-2009 18:41 In reply to

    Re: Disjunctive Reference Schemes

    Hi Dave,
    Thanks for the clarification.
    I found the exercise on page 206 but I could not see any "solution".
    Where did you see the "solution"?

    Anyway, my "solution" to this exercise is shown below.
    The frequency constraints are explained in NORMA Tutorial 4.

    Ken


  • 01-26-2009 23:35 In reply to

    • Andy Reiser
    • Top 50 Contributor
      Male
    • Joined on 01-24-2009
    • Sunshine Coast, Queensland, Australia
    • Posts 14

    Re: Disjunctive Reference Schemes

    Thanks Dave and Ken.

    I got the solution in a tutorial at university a couple of years ago. Our tutor had the solutions to the even numbered questions, which he would put on the screen for us to copy down.

    I have a big question mark next to it in my notes and vaguely recall that the tutor was not able to provide a good explanation which explained away the messy situation that would arise with null values in the primary key.

    Maybe it was just an example to raise a discussion about disjunctive reference schemes.

    Thanks for your replies. I really do appreciate it.

  • 01-27-2009 5:47 In reply to

    Re: Disjunctive Reference Schemes

    Hi Andy,

    Thanks for the clarification.
    I recently joined the computer science faculty of the University of Lincoln (http://www.lincoln.ac.uk/home/) with a view to introducing ORM to the syllabus and to the university management system. So with my university hat on, I'd like to contact your former tutor with a view to collaborating on ORM education and training. So please will you let me know which university and the name of the tutor and I will follow it up from there.

    Thanks

    Ken  

  • 01-27-2009 19:33 In reply to

    • Dave Rogers
    • Top 150 Contributor
      Male
    • Joined on 10-30-2008
    • Brisbane, Australia
    • Posts 2

    Re: Disjunctive Reference Schemes

    Hi Ken,

    Last year, I lectured ORM content as a part-time (sessional) lecturer at Queensland University of Technology (QUT). It was based on the 2001 text (so, not ORM2), as the current textbook only just came out as the semester was underway.

    I'm not sure who is taking that unit this semester, but the member of academic staff who is responsible for it is Prakash Bhandari. I'm happy to PM you his details, if you like.

    Regards

    Dave
  • 01-27-2009 19:47 In reply to

    Re: Disjunctive Reference Schemes

    Hi Dave, 

    Dave Rogers:
    I'm happy to PM you his details, if you like.

    Yes please, that would be very helpful.
    One of my academic objectives is to use this website to collaborate with and to give support to all academics who teach ORM - wherever they are.
    So if you know of any other Universities or Colleges who are teaching ORM, please let me know.

    Ken 

    Filed under:
  • 01-29-2009 18:43 In reply to

    • Andy Reiser
    • Top 50 Contributor
      Male
    • Joined on 01-24-2009
    • Sunshine Coast, Queensland, Australia
    • Posts 14

    Re: Disjunctive Reference Schemes

    Hi Ken,

    I learnt ORM at QUT as well. My tutor no longer works there. I believe he is now working in the industry. Sorry I cannot help you out with a contact.

     

    Andy

  • 03-26-2009 7:30 In reply to

    • PeterC
    • Top 25 Contributor
      Male
    • Joined on 08-22-2008
    • Sydney, Australia
    • Posts 22

    Re: Disjunctive Reference Schemes

     An observation....

    While perusing this thread, I noticed that the solution proposed by Ken does not contain the same information as that in the opening post by Andy.  In Andy's, I know the full name of the member, but in Ken's I do not know in what order the given name's occur.  (Or does the frequency constraint add information (viz, sequence) to the solution?  [I'm still learning NORMA].)  I don't know what the original exercise was (not having access to the book), so I don't know whether name order was important. 

    As a side note to anybody modeling people's names, please be aware that some people (certainly in Australia) only have one name, such as  "Rainbow", "Serenity", etc.  So none of the posted models in this thread would support this situation!

    regards, Peter

  • 03-27-2009 5:40 In reply to

    Re: Disjunctive Reference Schemes

    Hi Peter,
    You are right that my model does not show the order in which names occur.
    My model allows a person to have one, two or three given names.
    This underlines that point that an object-role model says exactly what you want it to say - no more and no less.
    The best way to check the meaning of an object-role model is to use the verbalizer.
    The verbalizer makes it easy for people to say "No -that is not what I meant" - as you have done in this instance.

    Other modeling approaches such as UML and ER require people to learn the meaning of the UML or ER symbols before they can understand the exact meaning of the model diagram. This is one of the reasons why ORM is more cost-effective than other information modeling approaches.  

    The following example shows the elementary facts in my model together with their automatically generated verbalizations.
    Ken

    PS - if the diagram is a bit fuzzy on your screen, just click on the diagram and you should see a clearer image.  

     


  • 03-27-2009 12:12 In reply to

    • Reiner
    • Top 150 Contributor
      Male
    • Joined on 10-06-2008
    • La Habana, Cuba
    • Posts 2

    Re: Disjunctive Reference Schemes

    Hi all, Here another possible solution to the exercise. In my opinion this solves previous solutions mistakes: Ken’s solution – does not consider the order of givennamesAndy’s solution – does not consider that for having third name it’s required to have a second name.  solucion   According to Big Brown Book (Halpin’s book second edition), page 187, this is the case of disjunctive reference scheme. When you map this model to a relational model, you obtain a primary key composed by four fields, two of which may be null. Following is the SQL code generated by NORMA: START TRANSACTION ISOLATION LEVEL SERIALIZABLE, READ WRITE; CREATE SCHEMA ORMModel1 DEFAULT CHARACTER SET UTF8; SET SCHEMA 'ORMMODEL1'; CREATE TABLE ORMModel1."Member"(       hasFirstGivenName CHARACTER VARYING NOT NULL,       surname CHARACTER VARYING NOT NULL,       hasSecondGivenName CHARACTER VARYING,       hasThirdGivenName CHARACTER VARYING,       CONSTRAINT Member_PK PRIMARY KEY(surname, hasFirstGivenName, hasSecondGivenName, hasThirdGivenName)); COMMIT WORK; In the same topic of the book are explained several ways of avoiding this situation  Statement of exercise 5.4 (4): Members of a small social club are identified by the combination of their given names and surname. Each member has at least one and at most three given names. For example, one member is Eve Jones, another is Johann Sebastian Bach, and another is Eve Mary Elizabeth Jones. It is required that each component of their names be individually accessible. Draw aconceptual schema diagram for this situation.
  • 03-27-2009 23:34 In reply to

    • Andy Reiser
    • Top 50 Contributor
      Male
    • Joined on 01-24-2009
    • Sunshine Coast, Queensland, Australia
    • Posts 14

    Re: Disjunctive Reference Schemes

    Hi Reiner,

    That subset constraint is definitely an improvement. And you would probably need another one running up to the 'has first' fact type from the 'has second' fact type.

    Personally, I think disjunctive reference is a really bad idea. Primary Keys (even composite keys) should never be able to contain an attribute with a null value in it. This is an example of where the conceptual schema does not map well to the relational schema, in my opinion. But I'm sure the question was just there to get students thinking about these issues, rather than putting the solution forward as an ideal solution.

     

     

Page 1 of 2 (21 items) 1 2 Next >
© 2008-2014 The ORM Foundation: A UK not-for-profit organisation -------------- Terms of Service