Hi Rich,
How about this? And I think it models the real world:
An Academic works for a Department
A Monitor works for a Department
Monitor is a subtype of Academic so it can have it's own roles
Declare a subset constraint on department between Academic/Department and
Monitor/Department
I think you meant exclusion constraint? In any case, this would compare the
department roles such that a particular department must/must not appear in
the department role of Academic works for Department if it appears in the
Monitor works for department role. For the exclusion constraint, this would
mean no Academic could work for a given department if any Monitor
(regardless of which Academic is being monitored) works for that Department.
However, I think this would work if it were a join exclusion constraint.
Given the facts:
F1: Academic works for Department
F2: Monitor works for Department
F3: Academic is monitored by Monitor
If you create an exclusion constraint between (the role sequence of) the
academic and monitor roles of F3 and the (role sequence of) the Academic
role of F1 and the Monitor role of F2, this should express the rule. Adding
this constraint is analogous to creating a join subset constraint described
(
http://objectrolemodeling.com/posts/234.aspx) and
(
http://objectrolemodeling.com/posts/236.aspx).
I think this is the first non-trivial example of a join-exclusion constraint
I have come across.
(The subtype and ring constraints would be as you suggested, good idea by
the way).
So, I guess I have to take back my earlier statement; it can be done in ORM.
I have mixed feelings: I'm glad ORM can do it but hate being wrong. ; )
This constraint (nor any join set comparison constraints) will not show up
on the diagram in VEA, however. Further, it will generate no DDL code to
enforce this rule, but at least you have it captured.
BTW, I always enjoy your articles.....
Thanks for the feedback, I appreciate it!
Hope that helps,
Scot.
................................................
Scot Becker
Orthogonal Software
www.orthogonalsoftware.com
ORM Blog:
www.objectrolemodeling.com
To e-mail me, please use my first name at the domain listed above. All mail
sent to the reply-to address gets routed to a junk e-mail folder where it
will likely be deleted without being read.