in

The ORM Foundation

Get the facts!

Relational Mapping Algorithm - is it OK?

Last post Fri, Nov 2 2018 23:35 by Terry Halpin. 14 replies.
Page 1 of 1 (15 items)
Sort Posts: Previous Next
  • Fri, Oct 26 2018 12:21

    • Ken Evans
    • Top 10 Contributor
      Male
    • Joined on Sun, Nov 18 2007
    • Stickford, UK
    • Posts 783

    Relational Mapping Algorithm - is it OK?

     In this separate thread, Nicola said:
    "I am disappointed (but not surprised) by the ORM-to-Relational mapping performed by NORMA. This is a topic for a different thread, though."

    So the purpose of this thread is to discuss Nicola's concerns about relational mapping in ORM and its RMAP implementation in NORMA.

    RMAP is discussed in Chapter 11 of Halpin(2008):   Halpin, T. & Morgan, T. (2008). Information Modeling and Relational Databases, Morgan Kaufmann. 

    So Nicola, over to you, what is the cause of your "disappointment" with the ORM-to-Relational mapping in NORMA?

     

    Filed under:
  • Fri, Oct 26 2018 14:14 In reply to

    • nicola
    • Top 25 Contributor
    • Joined on Thu, Oct 11 2018
    • Posts 30

    Re: Relational Mapping Algorithm - is it OK?

     Simple example to start with:

     


  • Fri, Oct 26 2018 14:18 In reply to

    • nicola
    • Top 25 Contributor
    • Joined on Thu, Oct 11 2018
    • Posts 30

    Re: Relational Mapping Algorithm - is it OK?

    Generated Relational view attached. Do you see the problem? The external constraint on {Course, Student} is not enforced. This is simply a matter of setting the PK of StudentSubscribesToLabSession to {courseCode, studentId}.

    So, in general NORMA seems to ignore most external constraints. 


  • Fri, Oct 26 2018 14:27 In reply to

    • nicola
    • Top 25 Contributor
    • Joined on Thu, Oct 11 2018
    • Posts 30

    Re: Relational Mapping Algorithm - is it OK?

    The issue becomes more apparent as soon as the model becomes more complex. Example from previous thread: 


  • Fri, Oct 26 2018 14:37 In reply to

    • nicola
    • Top 25 Contributor
    • Joined on Thu, Oct 11 2018
    • Posts 30

    Re: Relational Mapping Algorithm - is it OK?

    Generated relational view attached. This model has so many problems that I don't know where to start with. It can be succintly summarised in two words as: “no integrity”. Again, AFAICS, this is because integrity constraints in the ORM model are not used by the translation algorithm. Note that it is possible to build a Relational model that enforces them all (declaratively), although not in 5NF.


  • Fri, Oct 26 2018 16:11 In reply to

    • Ken Evans
    • Top 10 Contributor
      Male
    • Joined on Sun, Nov 18 2007
    • Stickford, UK
    • Posts 783

    Re: Relational Mapping Algorithm - is it OK?

    Nicola,

    I really appreciate your helpful observations and comments.

    Some background: I have been using ORM since the early 1990's and have used each of the ORM tools. (InfoModeler, VisioModeler, VEA and NORMA.)  Work on NORMA started about 14 years ago. For many years, I have been aware that NORMA had bugs and deficiencies but until recently, the coding was always done by others. Furthermore, although I have written some small programs in years gone by, my professional life has not involved a requirement for me to write code in a professional capacity.

    However, about three years ago, I saw that work on NORMA was slowing down so I took it upon myself to start a JIRA project with a view to fixing the bugs in NORMA and to adding new features. (First, I had to learn JIRA!)  

    When I started the JIRA project, there were "43 known but unresolved bugs" in NORMA. Several hard working volunteers have helped to reduce the backlog to just 10 and in about two weeks I expect that we will be down to 9.

    Now I'm not claiming that the set of "known bugs" is the same as the set of "all bugs in NORMA" so I'm not surprised to hear that you may have identified additional bugs.

    So, if it is the case that you have identified one or more previously unknown bugs, what needs to be done is to properly document the bug(s) and add them to the JIRA project.

    I spend a lot of time on this because my experiences of IT and IT management over several decades have convinced me that ORM is poorly understood but extremely powerful method with huge potential. However, a first step in realising the potential is to fix NORMA! 

    Please let me know if you would like to participate the JIRA project.

    Thanks

    Ken 

  • Sat, Oct 27 2018 19:50 In reply to

    • nicola
    • Top 25 Contributor
    • Joined on Thu, Oct 11 2018
    • Posts 30

    Re: Relational Mapping Algorithm - is it OK?

    I am not sure that I have found new bugs. Rather, a missing feature. Anyway, I plan to experiment with NORMA a bit more and study the details of the mapping algorithm as described in ORM's books. Then I'll report back here or in the issue tracker, as deemed appropriate.
  • Sat, Oct 27 2018 22:12 In reply to

    • Ken Evans
    • Top 10 Contributor
      Male
    • Joined on Sun, Nov 18 2007
    • Stickford, UK
    • Posts 783

    Re: Relational Mapping Algorithm - is it OK?

     Nicola,
    Our JIRA system is the "appropriate" place for you to make comments on existing bugs, to report new bugs, to make feature requests or to report other findings. However, to do this, you will need a JIRA user account.

    JIRA is designed to help developers to "resolve issues" so JIRA treats everything as an "issue". Each issue is identified by a unique code in the format NOR-xxx where xxx is a number.

    It seems possible that your experiments may partially duplicate work that has already been done and documented in the JIRA system so you may find it helpful to see if your proposed experiments have aready been reported upon.

    Please let me know if you would like me to set up an account for you in our JIRA system.

    Ken

  • Sun, Oct 28 2018 2:50 In reply to

    Re: Relational Mapping Algorithm - is it OK?

     Hi Nicola

       I get a different relational mapping result when I use NORMA. Please see the attached pdf file for some discussion on this issue.

    Cheers

    Terry 

  • Mon, Oct 29 2018 15:51 In reply to

    • nicola
    • Top 25 Contributor
    • Joined on Thu, Oct 11 2018
    • Posts 30

    Re: Relational Mapping Algorithm - is it OK?

    Thanks for looking into this (btw, Nicola is a male Italian name).

    Please let me know if you would like me to set up an account for you in our JIRA system.

    Thanks, I can set up one through the Sign Up page if necessary.

    I get a different relational mapping result when I use NORMA.

    I am using the current test of NORMA for VS 2017. Perhaps, the translation of external constraints has not been fully ported from the previous release yet? 

     I would normally expect a UC on the role of CourseName 

     Sure, my fault. After adding it, it is correctly translated into an alternate key in the relational view.

     I’m a bit surprised to see the Student table.

    Student becoming an independent relation seems correct to me, given the lack of mandatory roles and its many-to-many relationship with LabSession.

  • Thu, Nov 1 2018 0:59 In reply to

    Re: Relational Mapping Algorithm - is it OK?

     Hi Nicola

    Please see the attached pdf file for further thoughts on your example and its relational mapping in NORMA. I think this shows a more realistic way to model the example that avoids the mapping issue that you raised.

    Cheers

    Terry

  • Fri, Nov 2 2018 11:30 In reply to

    • nicola
    • Top 25 Contributor
    • Joined on Thu, Oct 11 2018
    • Posts 30

    Re: Relational Mapping Algorithm - is it OK?

    Linking an Enrollment to a LabSessionNr doesn't seem correct to me (several lab sessions may have the same number). I would have linked it to LabSession.

    I have added an external inclusion constraint to your model, which, I believe, is equivalent to yours. The resulting RM does not enforce such external constraints. I attach the figures in this and the next reply (I can attach only one file per message, apparently). I guess your NORMA version does better, although it defines a primary key that is not minimal, i.e., it properly contains another key.

    Anyway, I am not interested in what NORMA does or does not in its current shape (it is a test release after all) as much as in understanding how the translation algorithm is supposed to work. Is your book from 2008 still the authoritative reference in that regard?


  • Fri, Nov 2 2018 11:30 In reply to

    • nicola
    • Top 25 Contributor
    • Joined on Thu, Oct 11 2018
    • Posts 30

    Re: Relational Mapping Algorithm - is it OK?

    This is the Relational View corresponding to the model in the previous message, produced by the test version of NORMA for VS 2017.
  • Fri, Nov 2 2018 13:20 In reply to

    • Ken Evans
    • Top 10 Contributor
      Male
    • Joined on Sun, Nov 18 2007
    • Stickford, UK
    • Posts 783

    Re: Relational Mapping Algorithm - is it OK?

     Hi Nicola,
    Thanks for your update.

    Here are some comments for clarification.
    1: Terry may take a while to reply because his time zone is currently 10 hours ahead of yours and 11 hours ahead of mine (I'm in the UK)

    2: When I want to post more than one image in a message, I use the "combine images" feature that was recently introduced to Snagit. (see below)

    3: It is usually more useful to post an .orm file because it enables a reader to see model features that are not visible in png or jpg diagram.(e.g. verbalizations)  

    4: Terry is using a private version of NORMA that only works with Visual Studio 2015. Whilst that version does have more "features", to the best of my knowledge, it also has many bugs that have been eliminated from the 2017 version of NORMA that you are using.

     


  • Fri, Nov 2 2018 23:35 In reply to

    Re: Relational Mapping Algorithm - is it OK?

     Thanks for your further response, Nicola.

      Linking Enrollment to LabSessionNr is correct, as Enrollment already contains the relevant Course. Of course, many lab sessions may have the same number, but this is not a problem.

      In modeling, one may often choose between using a derivation rule or subset constraint. 

      As far as I know, my 2008 book is still the best public reference on the Rmap algorithm, so it needs some updating.

    Cheers

    Terry 

Page 1 of 1 (15 items)
© 2008-2018 The ORM Foundation: A UK not-for-profit organisation -------------- Terms of Service