eed3si9n
2009-06-06 21:56:39
views:
427answers:
5
A:
My intention is to help clarify the business domain. But to be effective at doing so shouldn't ORM allow me to state that a thing can only have a dob if it lives? If I were to validate the diagram from my question with a business user they would be unaware that my intentions are to only allow things with types that live to have a DOB.
Blake Taylor
2009-06-06 22:36:02
@eed3si9n: That's not a close analogy, since both roles are played by the same entity in your example, but not in his example.
John Saunders
2009-06-06 22:42:14
A:
In a database context, assuming that you have three separate tables, I would create a function that counts the number of rows in a join between the entity and its type. Use this function in the table holding the DOB to ensure that the DOB is null or the count is 1.
Pseudo-code:
function fn_count_living(id)
declare @count int
select @count = count(*)
from entities inner join types on entities.typeid = types.id
where entities.id = id and types.living = 1
return @count
end
Constraint
fn_count_living(entity_id) = 1 or dob is null
tvanfosson
2009-06-06 21:57:25
This is my fear, that the model is open to interpretation based on ones understanding of the words used to describe it rather than those words being defined based on the relationships within the model. If I were able to specify what I am asking the only way to interpret the model would be that only an instance of thing with type that lives could have a dob, implying the lives refers to the fact that thing lives not that it's currently alive. Of coarse if that was the case I would probably want it to be required based on the state of lives which creates a whole nother issue :( Thanks
Blake Taylor
2009-06-06 23:01:55
One thing about conceptual models is that they do better when working with real concepts. You seem to have abstracted a set of situations in order to get an answer that could apply to all of the situations. I recommend you work with one model that's more concrete, and come up with a solution for the more-concrete model. The tools of conceptual modeling will help you make that concrete model correct.
John Saunders
2009-06-06 23:12:48
I agree that less abstract types would be ideal, but in situations where they may be unobtainable I hope there is still a way to finish an applicable design. I thought about it a little and I propose that the only domains that can't be modeled conceptually are one that conflicts with themselves. In this case my goal no matter how lazy one has to be to want to achieve it should still be realistic.
Blake Taylor
2009-06-06 23:42:41
I guess I just haven't had experience doing conceptual models where the concepts could not be clarified or conflicted with each other. I would think it impossible to create a valid model if the model is not understood.
John Saunders
2009-06-06 23:48:15
It might also be interesting (if painful) to see the answer your question would receive at http://www.ormfoundation.org/forums/84.aspx or http://www.ormfoundation.org/forums/10.aspx.
John Saunders
2009-06-06 23:52:08
Impossible may very well be the answer even if only from a standpoint of practicality and if so you have done a fine job answering my question and I thank you and everyone else for sharing your knowledge with me.
Blake Taylor
2009-06-06 23:54:40
The answer may be "impossible", or it's possible that the readers of that forum have a lot of experience in modeling, and may recognize your situation. They may be able to tell you how they've solved this problem (lack of specificity) in the past. As I've said, I haven't had this problem before, so can't really help with it.
John Saunders
2009-06-07 00:17:15
I actually hadn't seen you message about the forum yet when I left my last comment. I will check over there for sure, thanks.
Blake Taylor
2009-06-07 00:31:28
I can't get NORMA to like either of your first two models. Could you edit the answer to include the verbalization of the subset and equality constraints? Also, more importantly, could you post how you got that to align so nicely? ;-)
John Saunders
2009-06-07 23:17:05
When you have any elements of an ORM model selected in NORMA a 'Format' menu item appears. The hot keys are also, useful, ALT+O+A+C to center elements vertically, ALT+O+A+M to center elements horizontally.I'll also edit my post to explain the join paths that I used in the first half.
rmoore
2009-06-08 01:21:41
Also, when dragging elements or roles, hold shift as it will force the elements to move along their current X/Y axis.
rmoore
2009-06-08 02:14:32
Ah ha, You nailed it! Kudos to you! I do have the book, working my way through it. One of my favs too. Thanks a million!
Blake Taylor
2009-06-09 02:59:44