multplicity constraints

Christina
2007-06-18
2013-05-28
  • Christina
    Christina
    2007-06-18

    hi,
    how can i add arbitrary multiplicity constraints in a role?

    thanks,
    bxris

     
    • Hi Christina,

      If by arbitrary multiplicity constraint, you mean a constraint that limits how many times an object can play a role (as in Employee(ID) claims PersonalDay(Date) - and you want a limit to keep employees from claiming more than five personal days), you'll use a Frequency Constraint.

      First, create the FactType as you would normally.  If the FactType is binary, you'll likely have an Internal Uniqueness Constraint spanning both roles (but the important thing is that the role to which you'll add the FC does not have a single IUC over it).  It can be mandatory, but be sure that the minimum frequency value you assign to the frequency constraint doesn't conflict with that.

      Second, drag a Frequency Constraint from the toolbox to a point near the FactType in question.

      Third, once the FC is in place, double click it and a line from the FC will appear which you can direct to the role or role sequence you choose.  It assumes a role sequence, so click on the role you want, then double click it to show that it's the last role to which you wish to assign this FC.

      Forth, the FC will now be shown in the properties window, and you can assign a min & max to the frequency for this constraint.  In the example I stated, that would be min=0, max=5 (I think - can't recall if it's zero or one floored).  You'll notice that the FC icon on the model has changed to indicate the min&max assigned.  Off hand, I don't recall what designation is used to show an unlimited max value.  It could be just a very large number or -1, (NULL - left blank produces an error msg).  Either might work, and in that case, it's the modelers choice as to which best fits the situation.  Try a test with sample population to make sure.

      As you can tell, it's important that the FC values not conflict with UC assignments in the FactType.  You wouldn't want Person(ID) has {at most one} FirstName(), and then add a FC with a max of 5!

      Hope it helps.  BRN..