in

The ORM Foundation

Get the facts!

Value comparison constraint

Last post Wed, Feb 12 2014 2:58 by koneill. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • Tue, Feb 11 2014 4:33

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

    Value comparison constraint

    Hi,

     I 'think' I've found a bug. Or maybe my understanding of the value comparison contstraint is wrong. My understanding of the value comparison constraint is;

    - the roles being constrained are compatible (in this case, a date)

    - instances are compared, not sets.

    Keeping that in mind, i've modelled two situations which I've included in the screenshot. NORMA indicates that it "requires a join path" in the left diagram whereas it doesn't require it in the right diagram. I'm guessing that's because there's two identical object types that are used in both facttypes (as soon as I replace Job or Person in one of the fact types with another, the error dissapears).

     What i'm trying to model here is; "For each Person, Job; recruitment date > apply date"

    (Another way it could be modelled; objectify relation between Job and Person and adding two fact types with a relation to date).



  • Tue, Feb 11 2014 14:45 In reply to

    Re: Value comparison constraint

    Hi Karl,

    It isn't that the simpler case doesn't have a join path. NORMA just creates the join path automatically in the simple case. You'll see a join path for this constraint if you look at the .ORM file in an XML editor.

    The harder case actually has three possibilities. I'm assuming you want to join over both Person and Job, which verbalizes as:

    For each Person and Job,
      if that Person was recruited for that Job on some Date1
      and applied for that Job on some Date2

      then Date1 is greater than Date2.
     

    However, joining over just Person gives the following:

    For each Person,
      if that Person was recruited for some Job on some Date1
      and applied for some Job on some Date2

      then Date1 is greater than Date2.

    and joining over just Job gives:

    For each Job,
      if some Person was recruited for that Job on some Date1
      and some Person applied for that Job on some Date2

      then Date1 is greater than Date2.

    While the last two join paths don't work semantically for this case, they are both structurally valid join paths. The tool has no clue about the semantics, only the structure, so it does not generate an automatic join path in this case.

    Non-automatic join paths use the same editor as the fact type and subtype derivation rules, which is part of the NORMA Pro extensions. There are more details (and user-directed questions) on Pro status hidden away in http://www.ormfoundation.org/forums/p/1054/3321.aspx#3321.

    In this case, the model suggests that you objectify the Person/Job relationship and add recruited on/applied on binary relationships off of the objectification. You will then get an automatic join path for this case. At some point, though, you will likely want the ability to constraint the model as is without refactoring.

    -Matt

     

  • Wed, Feb 12 2014 2:58 In reply to

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

    Re: Value comparison constraint

     Hi Matt,

     Thanks for the reply. I'd definately be interested in a "pro" version  when it comes out.

     Regards,

    Karl

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