I’m trying to figure out how to model a situation with following properties:
- there is a set of entity types Ei...Ej and a set of relationship types between those entity types Ri...Rj in the domain;
- one can distinguish at least two different versions of those entity and relationship types that are significant to different parts of the system at the same time.
In the simplest case, those different versions might be “real time data” version and “last approved snapshot” version. In this case, being significant to different parts of the system might translate into following:
- there are less privileged actors and use cases, that can only work with “last approved snapshot” version;
- at the same time there are more privileged actors with the same or different set of use cases, that can work with “real time data ” version;
- there are entity types Ex...Ey that either form relationships with entities ei...ej from “last approved snapshot” version or whose constraints reference values of attributes of entities ei...ej from “last approved snapshot” version;
- at the same time there are different entity types Ea...Eb that either form relationships with entities ei...ej from “real time data” version or whose constraints reference values of attributes of entities ei...ej from “real time data” version.
If I want to show all entity types Ei...Ej, Ex...Ey and Ea...Eb from aforementioned example along with their constraints and relationships between them on the same diagram, how would I do that?
I was thinking about using two different classes for the same entity type: one class would represent “last approved snapshot” version of that entity type and another class would represent “real time data ” version of that type.
But I don’t like this approach very much as
- it seems redundant;
- I’m not actually sure what kind of relationship there is between two classes representing two different versions of the same entity type a how to represent that relationship in diagrams (maybe «derive» stereotype from standard profile would be appropriate here, but I'm not sure).
EDIT
Unfortunately, I can’t use examples from my work, so I’ve come up with this completely fictional one, but one that is also partially modeled after the problem I was trying to solve recently. I’ll be using popular “WorksInUsing” association to pay proper respects. This will make the question more concrete.
Also, to be clear, I’m trying to create conceptual model and not so much OOP/relational design/implementation model.
Let’s assume an entity type Employee.
Let’s assume an actor called “SkillAdministrator” managing following entity and relationship types:
- entity type Skill
- entity type Department
- relationship type KnownSkill between entity types Employee and Skill
- relationship type WorkInDepatment between entity types Employee and Department
Let’s assume, that changes in all those aforementioned entity and relationship types happen rarely but when they do they happen in very large batches and our skill administrator needs quite a time to process each such change.
After he’s finished processing the change, he runs PublishChange use case which creates a snapshot of entity and relationship types Skill and KnownSkill and makes that snapshot available to other users of the system.
Let’s now assume an actor called Manager managing following entity and relationship types:
- entity type Project
- relationship type WorksInUsing between entity types Employee, Skill and Project.
Only those Skills that existed at the last run of PublishChange use case can play role in WorksInUsing association. Also the pairs KnownSkill are precondition to triplets WorksInUsing, but again only those KnownSkill pairs, that existed at the last run of PublishChange use case.
At the same time Manager is managing WorksInUsing associations, SkillAdministrator can start working on processing the next big change in entity and relationship types that he manages. Manager doesn't see those changes, not until PublishChange use case is run again.
(Depending on the domain, there are multitude of different ways to handle deletion of particular skill or knownskill association by system administrator and then applying those changes - in the simplest case, both types could be assumed as permament, so new instances can be added but existing instances cannot be deleted, for examples laws work this way)