in

The ORM Foundation

Get the facts!

Requiring a join path when modelling as objectified facttype

Last post Sun, Oct 11 2015 3:45 by koneill. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • Thu, Oct 8 2015 7:08

    • koneill
    • Top 25 Contributor
      Male
    • Joined on Fri, Feb 17 2012
    • The Netherlands
    • Posts 37

    Requiring a join path when modelling as objectified facttype

    Hi there,

     I'm modeling the following situation;

    - there are offices that own rates and share rates

    - an office can be a headquarters OR a subsidiary of a headquarters (I've modeled these both as subtypes of office)

    - an office that owns a rate cannot be the sharee of that same rate or vice versa

    - an office cannot share a rate with another office if it is the headquarters / subsidiary of that other office

    Now if I model the office as an entitytype I can place an exclusion constraint between the "office shares rate, office owns rate" role combination and the "subsidiary office is subsidiary of headquartes" roles.  But if i model the office as an objectified facttype I get the error that the exclusion constraint requires a join path. Now I do remember that join paths were going to be part of a paid version of NORMA but i was just wondering if this case shouldn't already work as the non objectified version works just fine.

     Regards,

    Karl 

  • Thu, Oct 8 2015 22:42 In reply to

    Re: Requiring a join path when modelling as objectified facttype

     Hi Karl

     Using an objectified fact type for Office and using the asserted fact types "Office owns Rate", "Office shares Rate with Office" and "Office is the headquarters of / is a subsidiary of Office", I added the exclusion constraint that I think you are after with no error. The constraint verbalizes as follows:

    For each Office1 and Office2, at most one of the following holds:
      that Office1 shares some Rate with that Office2;
      that Office1 is the headquarters of that Office2.
     
     I did not use subtypes for Headquarters and SubsidiaryOffice, but these can be added as derived subtypes if desired.
     
    I have forgotten how to post ORM schema diagrams in the forum, but will send my schema diagram to Ken so he can post it.
     
    Cheers
    Terry 
     

  • Thu, Oct 8 2015 23:42 In reply to

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

    Re: Requiring a join path when modelling as objectified facttype

     Hi Terry,

    I added your diagram.
    The procedure is to use the "Options" tab and the "File attachment add/.update".

    Cheers

    Ken

     

  • Fri, Oct 9 2015 6:48 In reply to

    • koneill
    • Top 25 Contributor
      Male
    • Joined on Fri, Feb 17 2012
    • The Netherlands
    • Posts 37

    Re: Requiring a join path when modelling as objectified facttype

     Hi Terry,

    In my UoD a rate is shared with at most one office; if you replace the ternary fact type with a binary one "rate is shared with office" the model will be the same as mine. If I then place an exclusion constraint on the "rate is shared by office", "office owns rate" and "office is a subsidiary of office" I get no error. and it reads as follows;

     For each Office1 and Office2, at most one of the following holds: 

    some Rate is shared with that Office1

    where that Office2 owns that Rate; 

    that Office1 is a subsidiary of that Office2.

    However there is one other detail I forgot to mention and I apologize for this; the rate has to be of a certain subtype in order to be shared. So the "rate is shared by office" is actually "Intercompany rate is shared by office". And when i replace rate in "rate is shared by office" with inter company rate (the subtype of rate) I get the error;

     For each Office1 and Office2, at most one of the following holds: 

    some IntercompanyRate is shared with that Office1; 

    that Office2 owns some Rate; 

    that Office1 is a subsidiary of that Office2.

    Model Error: Sequence '1' of constraint 'ExclusionConstraint1' in model 'ORMModel1' requires a join path.

     

  • Fri, Oct 9 2015 15:08 In reply to

    Re: Requiring a join path when modelling as objectified facttype

     Hi Karl

     You say that "A rate is shared with at most one office". Given that you previously said "An office cannot share a rate with another office if it is the headquarters of that other office", it seems to me that a rate may be shared between two offices. In that case, it would seem to be incorrect to use the binary fact type "Rate is shared with Office" and apply a uniqueness constraint to the role hosted by Rate (which would then verbalize as "Each Rate is shared with at most one Office"). 

     


  • Fri, Oct 9 2015 15:18 In reply to

    Re: Requiring a join path when modelling as objectified facttype

     Hi Karl

     You say that "A rate is shared with at most one office". Given that you previously said "An office cannot share a rate with another office if it is the headquarters of that other office", it seems to me that a rate may be shared between two offices. In that case, it would seem to be incorrect to use the binary fact type "Rate is shared with Office" and apply a uniqueness constraint to the role hosted by Rate (which would then verbalize as "Each Rate is shared with at most one Office"). 

     I have now modified my model to change the UC on the ternary to span just 2 roles, so ist verbalization is:

    For each Office1 and Rate,
    that Office1 shares that Rate with at most one Office2.

    To cater for your newly provided semantics I also added the unary fact type "Rate is an intercompany rate." and added a subset constraint from Rate's role in the ternary to the unary.

    This new model has no syntax errors. 

    Perhaps you actually mean something else. Maybe you could provide your model diagram so I can properly understand what you intend. 

    Cheers

    Terry 


  • Fri, Oct 9 2015 15:33 In reply to

    Re: Requiring a join path when modelling as objectified facttype

    Here's another try to display the model properly.

     


  • Sat, Oct 10 2015 7:15 In reply to

    • koneill
    • Top 25 Contributor
      Male
    • Joined on Fri, Feb 17 2012
    • The Netherlands
    • Posts 37

    Re: Requiring a join path when modelling as objectified facttype

     I hope this works; i'll attach a screenshot of my model. The error dissapears when i attach the rate entity type with the "is shared with" binary facttype.


  • Sat, Oct 10 2015 17:08 In reply to

    Re: Requiring a join path when modelling as objectified facttype

     Hi Karl

    Thanks for showing your schema diagram. That clarifies the semantics you intended. I misunderstood your intent, as I assumed that if a Rate was owned by a company it couldn't be shared. 

    It is now clear why you get a syntax error for that exclusion constraint. I have modified my model to be sufficiently similar to yours to expose the problem (see diagram). If you select the exclusion constraint and open the verbalization Browser, here is what you get:

    For each Office1 and Office2, at most one of the following holds:
    that Office1 is the headquarters of that Office2;
    some Rate is owned by that Office1;
    some IntercompanyRate is shared with that Office2.

    Model Error: Sequence '2' of constraint 'ExclusionConstraint3' in model 'ORMModel1' requires a join path. 

    Notice that the constraint verbalization does not include the identity relationship between the intercompany rate and rate. In principle there could be many paths between IntercompanyRate and Rate (e.g. additional fact types other than the subtyping connection), and currently NORMA does not perform an exhaustive analysis to determine that no such other paths exist. This is why NORMA asks you to do the work and choose the join path (even though in this case there is only one such path). 

    If you instead attach the "is shared with" predicate to Rate, NORMA knows without further analysis that that there is only one possible join path, so you don't get a syntax error. You can still use a subset constraint to the unary fact type "Rate is an intercompany rate" to ensure that only intercompany rates are shared (as in my previous model). The exclusion constraint then verbalizes as follows:

     For each Office1 and Office2, at most one of the following holds:

    that Office1 is the headquarters of that Office2;
    some Rate is owned by that Office1
    and is shared with that Office2.
     

  • Sun, Oct 11 2015 3:45 In reply to

    • koneill
    • Top 25 Contributor
      Male
    • Joined on Fri, Feb 17 2012
    • The Netherlands
    • Posts 37

    Re: Requiring a join path when modelling as objectified facttype

     Hi Terry,

     Thanks for your explanation. To work around this I've decided on adding a derived binary facttype "office shares intercompany rate with another office" and i've added a subset constraint to the "office owns rate" facttype. I can then create the exclusion constraint which now reads;

    For each Office1 and Office2, at most one of the following holds: 

    that Office1 is a subsidiary of that Office2; 

    that Office1 shares some IntercompanyRate with another office

    where that IntercompanyRate is shared with that Office2.


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