The ORM Foundation

Get the facts!

Unique FK+Field

Last post Thu, Jun 19 2008 4:50 by Brian Nalewajek. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • Wed, Jun 18 2008 8:56

    Unique FK+Field

    How can I identify a field and a foreign key reference to be a unique constraint combination?




  • Wed, Jun 18 2008 16:03 In reply to

    Re: Unique FK+Field

    It's OK - I sussed it by reverse engineering a simple DB.


  • Wed, Jun 18 2008 19:46 In reply to

    Re: Unique FK+Field

     Hi Mike,


    Sounds like you found your own answer - always good.  It also sounds like you are testing out the nORMa tool from the logical, rather than conceptual, perspective.  That's fine; but the power of the tool and the theory behind it works best starting from the conceptual view.  The tool should be able to provide the logical view for you to check over and adjust for physical implementation.

    In the ORM designer window, you can add an external uniquenes constraint EUC (from toolbox), between role sequences in multiple Fact Types.  If, for example, you want the first and last names of an Employee to be unique, you'd connect the roles for FirstName and LastName value Object Types to the EUC.  Here, you'd prohibit hiring a new employee with the same full name,  If you want that constraint to be the prefered identifier for Employee, change the property for that EUC.

    The idea for doing this at the conceptual level, is that it's easier to see in regular UofD terms; and the tool keeps track of the PKs, FKs for you. 

    I'd also offer a caveat on looking at RE'ed BDs for examples of how an ORM diagram should look.  If you do a few using ORM up front, then RE those, you'll see what I mean.  RE has its place, but it has its limitations too. 


  • Thu, Jun 19 2008 2:21 In reply to

    Re: Unique FK+Field

    Hi Brian

    And thank you.

    I started with a simple but real world example at a conceptual level until I was happy. i then generated the schema but ended up with and extra table where the constraints were enforced. I'm still working through The Big Brown Book so a little thin on knowledge as yet.

    At that point I reverse engineered and discovered how to create the UNIQUE construct I wanted with the EUC and changed my diagram accordingly. I wouldn't RE unless I had to.

    There are two major attractions using ORM and nORMa from my POV.

    The first is one where I have effectively used Rational Rose for in the past, and that is to create a forum for various domain experts (customer and SE for example) where a meeting of minds can be facilitated. i.e all parties become occupants the same UofD. :) This looks to be better than UML for that because there is less clutter and simpler terminology in one diagram type. Also, I have noted that there is an article on process mapping with nORMa on the site which I must read.

    The second is at a logical level to control and document databases.

    ORM and nORMa seems to hit the mark on both points, but, early days yet, and I am still learning.

    Thanks again for the help - I'll check out the preferred identifier.




  • Thu, Jun 19 2008 4:50 In reply to

    Re: Unique FK+Field


     Hi Mike,

    Your reply gives me (us), a better idea of where you are in using ORM and nORMa - off to a good start.  I wish I was as well grounded in ULM as you seem to be.  You can find a number of articles by Dr. Halpin comparing UML and ORM, through his site  If you haven't yet, grab the nORMa tutorials from the Library section (use the "Most recent" view to find the updated versions.

    The logical mapping features have come along well over the past year.  I've started testing more ORM conceptual models by working through to the physical implementation of DBs.  I take it you have found the Extensions Manager in the tool, that allows you to get a Relattional View and a Barker ER view of your ORM model.  Be aware that both are evolving; and that Barker was just added this month - with some issues.

    There's no better book for ORM or nORMa than what you're reading; but don't expect complete and correct expression of everything in the book, in the tool - at least not yet.

    Do keep posting your comments and questions.  I for one learn new things about ORM and the tool from considering these.



Page 1 of 1 (5 items)
© 2008-2024 ------- Terms of Service