-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Types from the external model MUST NOT be used for composition relationships - Why? #67
Comments
Motivation for this was/is that a parent-child composition relation should be unique, in the sense that a child object type should know its parent object type when it is defined. It is defined in the context of the parent if it has one. |
The definition/explanation here is pretty good: https://www.uml-diagrams.org/composition.html I think @glemson is mainly describing bullets 1-2. I normally think of composition in terms of instance lifecycle, which is essentially bullets 3-4. To me this means that only some classes in a model are re-usable in a composition relationship in another model. In that sense, the "quoted" statement may be too strong and/or inadequate... I definitely think that a class in model A that is the child of a composition in A cannot be re-used by itself in another model, so there is some "less re-usable"-ness there. From basic concepts, a class from model A that is not a child in a composition could (in principle) be used in a composition by model B... I don't know what that means for model C (that also imports A) and also wants to do that. Maybe the intent of the statement is that allowing cross-model composition is going to be a mess so just never do that. If model A has a class X and model B imports it, can it extend X and then use that in a composition? The stated rule would be satisfied... is that rule just requiring a (potentially no-op/featureless) subclass to enable composition? Is that a good thing or a bad thing? |
There is of course the existing "Unique Composition" schematron rule that does warn about that situation - there is no similar rule that validates the VO-DML against the composition target coming from another model (which is surprising given the "MUST" NOT nature). Having said this I do not really agree that either being absolutely banned, but I think that they should only come with warnings that you need to be careful with exact lifecycles of individual instances of the classes in the composites - Using the example from the UML you could have a model where a University could have a Department as well as a Hospital - as @pdowler says you could do potentially no-op subclasses of Department to obey the rule, but I do not think that there is much value in actually forcing that.
.I think that conceptually this is correct, but again for a particular set of instances of the imported model if the instances are created in a context where the only the imported model is considered - as soon as the model is imported into another model then the model context for those entities not already explicitly the targets of some composition relationship become "contained" within |
In section 4.4.10 there is the statement in the model import section "Types from the external model MUST NOT be used for
composition relationships" - The rationale behind this restriction is not explained and does not seem to be necessary.
The text was updated successfully, but these errors were encountered: