Three Entity Constraint in Object Role Model in NORMA
I am trying to model the constraint depicted in the ORM diagram below using NORMA for Visual Studio 2010:
Merchant transacts in a Currency if and only if that Merchant uses a Processor that supports that Currency.
According to this link, what I am trying to model is a join subset constraint. Here is an example from the link above:
Which reads as a Person can only work on a Project if that Person works in a Department that Spansors that Project.
That seems identical to what I am trying to model.
I've tried several combinations if adding a subset constraint, clicking one role then another, but always end up with errors such as:
- Constraint 'SubsetConstraint1' in model 'ORMModel1' has role players in column '1' with incompatible types.
- Constraint 'SubsetConstraint1' in model 'ORMModel1' has role players in column '2' with incompatible types.
How can I go about modeling this constraint?
You're heading in the right direction. You need to define a superset role pair and a subset role pair. Each pair has one Merchant role and one Currency role, and the order of these roles in the pairs must match. You can check the matching my clicking on the constraint; the roles are then highlighted in blue with 1,1 1,2 2,1 2,2 which shows the role sequences.
The superset Merchant role is the role of Merchant in "Merchant uses Processor". The superset Currency role is the role of Currency in "Processor supports Currency".
The subset Merchant and Currency roles are the two roles of "Merchant transacts in Currency".
A similar example is the subset constraint on "DirectOrderMatch" in the Warehousing example here: ActiveFacts Example Models. Note the two arrow heads that point to PurchaseOrderItem and SalesOrderItem. In CQL, this constraint is expressed (in verbose form; that site shows the terse form):
some Purchase Order Item matches some Sales Order Item only if that Purchase Order Item is for some Product that is in that Sales Order Item;
So, by way of comparison, your example written in CQL would read:
some Merchant transacts in some Currency only if that Merchant uses some Processor that supports that Currency;