ORM and Not Exists

  • Jeff Winchell

    Jeff Winchell - 2006-08-16

    How would you model an entity/value constrained to not include a dynamic set of values?

    • Tyler

      Tyler - 2006-08-17

      Could you give an example to help visualize the problem?

    • Tyler

      Tyler - 2006-08-17

      I guess I should have clarified what I was wanting you to clarify.... What do you mean by a dynamic set of values? 

      Is it something like, "If A R1s B1, then A can R2 C1, C2 or C3, but if A R1s B2, then A can R2 C4 or C5"?  Or to use a hypothetical example, "If Bob drives a truck, Bob can go for repairs at the Ford or Chevy dealership.  However, if Bob drives a sports car, he can go for repairs at the Ferrari or the BMW dealership."

      In that scenario, I'd break off Vehicles into Trucks and Sports Cars.  Maybe make them subtypes of Vehicles.  This "solution" may not apply to your domain, though, so a better description of the problem would help.

    • David Parslow

      David Parslow - 2006-08-23

      Jeff, I think that you are referring to "enumerations" or ranged values (whether it be integer or string).  Most database platforms support constraints that limit the options for an entity field.  For example, a helpdesk ticket might have a limit of status that would only include Open, Closed, OnHold then you could set a constraint on the ticket entity's status field for each of the options. This would acheive the goal of constraining the values on the data side.  You would want the code gen to generate a enumeration for this entity instead of a class.  The code gen does not do this currently, but it is something that I am looking into.

    • Brian Nalewajek

      Brian Nalewajek - 2006-11-09

        Not sure I'm on track here, but if what you wanted was (by way of example), to keep employees from accessing a website that was blacklisted; If Website was an entity it could play the role of being accessable by Employee (Binary FactType), Website is blacklisted (Unary FactType), with an exclusion constraint connected to the appropriate roles.  So, a Website couldn't play the role of being accessable, if it also played the role of being blacklisted.  How you want to handle the flaging of Website as blackisted is up to you.  If what you're after is a kind of validation that a user would want to have performed while submitting a form, then something run at the server, that would compare the entry against a column in a database table, using the appropriate logical operators, should work.  When you say "dynamically" I'm hearing procedure, rather than structure.  Be mindful of not compromising the database structure (which, I assume is the reason you are creating the ORM Model), with something better handled by a procedure that only needs to access the data.
        If I missed understood, or if my suggestions seem flawed, please let me know.  BRN..


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks