in

The ORM Foundation

Get the facts!

Constraints on Constraints?

Last post Thu, Dec 21 2017 15:09 by Ken Evans. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • Wed, Dec 20 2017 10:46

    • Ruahisha
    • Top 150 Contributor
    • Joined on Tue, Nov 21 2017
    • Posts 4

    Constraints on Constraints?

    I am having trouble in NORMA because I would like to add an inclusive or between two subset constraints. That is, I want to model the idea that if I have a couple of entities that are present in a given relationship, that same couple must be present in at least one of two other relationships but not necessarily both. Is there a way in ORM to model what I just described, that is, an inclusive or on two subset constraints?

  • Wed, Dec 20 2017 11:17 In reply to

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

    Re: Constraints on Constraints?

    There are several forum threads that discuss the inclusive and exclusive OR constraints. 
    For example: http://www.ormfoundation.org/forums/p/1202/3830.aspx#3830

    You can use the search feature to find more. 

     

    It will help us to help you if you can give an example of what you are trying to model.

    Thanks

    Ken 

     

     

  • Wed, Dec 20 2017 12:00 In reply to

    Re: Constraints on Constraints?

     To meet your objective in ORM, you could derive a relationship that is the union of the two other relationships, then subset from the given relationship to the derived one. For example, consider the binary relationships with predicates R, S and T from A to B. Now create a derived predicate U from A to B. so that forall x, y [xUy if (xRy v xSy)]. Now add a subset constraint from T to U.

    Cheers

    Terry 

  • Wed, Dec 20 2017 14:34 In reply to

    • Ruahisha
    • Top 150 Contributor
    • Joined on Tue, Nov 21 2017
    • Posts 4

    Re: Constraints on Constraints?

    You're right; I should have explained my problem a little more. Let's say I have three fact types:

    Fact Type 1. [A, B

    Fact Type 2.  [A, B]            

    Fact Type 3.  [A, A, B]

    I want to express that the couple in bold, [A, B], present in Fact Type 1, must be at least in Fact Type 2 or Fact Type 3, but is not required to be in both. Furthermore, if the couple [A, B] is in Fact Type 3, it must be present in the second and third roles.

  • Wed, Dec 20 2017 17:14 In reply to

    • Ruahisha
    • Top 150 Contributor
    • Joined on Tue, Nov 21 2017
    • Posts 4

    Re: Constraints on Constraints?

    Thank you for your reply. I'm not sure what you're talking about would look like in ORM. Could you enlighten me? The only way I can think of is to objectify the two relationships and then connect them in inclusive or with a subtype to a third that represents the union. The problem is that if not all relationships involved have the same number of roles, I don't see how I can subtype them. My situation is I have three relationships:

    Fact Type 1. [A, B

    Fact Type 2.  [A, B]            

    Fact Type 3.  [A, A, B]

    Ideally I would add a constraint on the couple, A, B, in Fact Type 1 that is subset of A, B of Fact Type 2 or is a subset of the second A and B from Fact Type 3. I don't see how I can create a union of Fact Type 2 and Fact Type 3.

     Thank you for your patience and help. 

  • Wed, Dec 20 2017 18:10 In reply to

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

    Re: Constraints on Constraints?

    ORM Fact Types are made by adding Object Types into "holes" in a predicate.
    For example here is a binary Fact Type:

    Predicate: --- writes ---     
    Object Types: Student(.nr), Dissertation(.nr)
    Fact type:   Student(.nr) writes Dissertation(.nr)

    A related ternary Fact Type might look like this:

    Predicate: --- writes --- on ----   
    Object Types: Student(.nr), Dissertation(.nr), Date()
    Fact type:   Student(.nr) writes Dissertation(.nr) on Date()

    It would help me to help you(and our readers) if you could express your problem using meaningful fact types such as the two I have used in this example or fact types from any well known domain that you choose. 

     

  • Thu, Dec 21 2017 7:22 In reply to

    • Ruahisha
    • Top 150 Contributor
    • Joined on Tue, Nov 21 2017
    • Posts 4

    Re: Constraints on Constraints?

    If that helps, I am happy to provide an example of what I’m trying to do. 


    Fact Type 1: Person(.id) can ensure Outcome(.id)

    Fact Type 2: Person(.id) has Plan(.id) to realize Outcome(.id)

    Fact Type 3: Person(.id) has contracted Person(.id) to realize Outcome(.id)


    I want to express two subset constraints in inclusive or so as to say: some Person can ensure some Outcome only if that Person has some Plan to realize that Outcome or only if that Person has contracted some Person to realize that Outcome. 


    Once again thank you for your patience and help.  

  • Thu, Dec 21 2017 10:48 In reply to

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

    Re: Constraints on Constraints?

    Thanks for the clarification. I'll make a more comprehensive reply later today but two points stand out.

    My first point is that when defining an object-role model you must bear in mind that language is not a neutral window through which we view "reality". In particular, Not all propositions are equal

    For example: 
    The proposition "The Moon is in orbit around The Earth" can be tested by experiment. Its truth value is independent of personal opinion.
    But propositions such as  "I now pronounce you man and wife" are what is called "performative speech acts" - because the act of speaking creates a truth. 

    So your first fact type is almost like a performative speech act. 
    I asked myself,  How can a person "ensure" a future outcome? 
    It seems to me that since the future is uncertain, the concept of "ensure" is more like making a promise.

    My second point is about the use of the reference mode "id" within NORMA.
    I never use it because it generates an auto-number and sometimes generates invalid DDL.
    Thus, I prefer to use (.nr) rather than (.id).

    More later.

    Ken 

     

      

  • Thu, Dec 21 2017 15:09 In reply to

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

    Re: Constraints on Constraints?

    Here is my first attempt to partially model your situation. 
    I'm still looking into the most effective way to specify your required dependencies: 

    Some Person can promise some Outcome
    if that Person has some Plan to realize that Outcome 
    OR 
    if that Person has contracted some Person torealize that Outcome

    You can download the model from here

    I suggest that you use the NORMA verbaliser to browse the model.

    I added a Date to the promise fact type because that aligns the concept of "Promise" with the concept of "Objective." (There does not seem to be much point in making a promise without stating the date by when the promise will be realised.)


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