The ORM Foundation

Get the facts!

Value comparison constraints?

Last post Thu, Aug 22 2013 19:40 by Anonymous. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • Wed, Aug 21 2013 21:36

    Value comparison constraints?

    What's the plan for implementing value comparison constraints? As an example from my CinemaBookings model, a booking for N seats must not allocate more than N seats. Using NORMA Pro, I can derive the number of seat allocations for a booking, but I need to enforce that to be less then or equal to the number of seats booked.

    Also, I'd like to know how you plan to verbalise them. In CQL, they will look like this (this includes the allocated Count aggregate derivation):

    for each Booking (in which some Person booked some Number of seats for some Showing),
        count of Seat in (that Booking has some allocated Seat) <= that Number;
  • Thu, Aug 22 2013 5:13 In reply to

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

    Re: Value comparison constraints?

    Hi Clifford,

    Does "CinemaBookings model" refer to your diagram in this thread?

     Or to something else? (e.g. an orm file that you posted somewhere)


  • Thu, Aug 22 2013 5:33 In reply to

    Re: Value comparison constraints?

    Thanks Ken, yes, that's an earlier version of it. The uniqueness constraint on Showing should not span Film, and some other constraints are missing, but that's the basic idea.

    The constraints I've added ensure that:

    • Seats allocated to a Booking for a Showing must be in the Cinema where that Showing will occur
    • No booking allocates more seats than it's entitled to.

  • Thu, Aug 22 2013 18:34 In reply to

    Re: Value comparison constraints?

    Hi Clifford, we do plan to implement value comparison constraints, using the graphical notation shown in the "Big Brown Book", but do not yet have a definite date for that. The precise form of the verbalization for cases like yours is yet to be finalized.
  • Thu, Aug 22 2013 19:40 In reply to

    Re: Value comparison constraints?

    Thanks Terry. I wasn't sure whether NORMA Pro actually already had the ability to represent a value comparison constraint, but perhaps lacked the graphical representation and/or verbalisation.

    In this specific example, the graphical representation would have to rely on the derived FT "seat allocation count"; it's hard to see how else any graphical representation could work. Of course, in any join constraint, there are implicitly derived fact types, but it concerns me that there might be a significant difference in the meta-representation for such a fact type being explicitly declared versus implied. I'd like to avoid such representational divergence; I think it would reflect a weakness or fault in the metamodel.

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