Subsetted Properties are widely used in UML specification diagrams.
A real-world example would be great
the following screenshot from UML specification 2.5(Beta)
As there are two constraints that might produce problems and they are somewhat related (and they've led me to this question ;-) ) let me describe both of them, i.e. subsets and redefines
To sum up - redefines changes (provides more precise) logic of model for the same relationship but in specialized class while subsets shows relationship between different relationships of the same classes (they might be inherited but don't have to) and shows that objects that are in one relationship create a subset of objects that are in other relationship.
redefines changes in some way a logic of the relationship for a specialization of a class linked to a relationship. E.g. while animal can have any number of limbs (octopus 8 and centipede - who knows...), humans have always 4. So we have a relationship from Human to Limb with target name limb but a changed multiplicity (to 4). Fig. 1 - Normal Limb - redefines
There might also be a further changes, like we might define a new class JointLimb which specialize Limb. As humans have only JointLimb our relationship will not only change the multiplicity but also allow only a specialized class on both ends of the relationship. Fig. 2 - Joint Limb - redefines
On the other hand subsets shows that the objects that are in a one relationship (with subsets constraint) are all at the same time also in some other relationship (the one pointed in subsets constraint) i.e. set of objects in a relationship one is a subset of objects in a relationship two. In our case we will have new classes Hand and Leg specializing class Limb (or JointLimb in the latter example). As each Hand (Leg respectively) is a Limb (JointLimb) the relationship from Human to Hand (Leg) will have multiplicity 2, target name hand (leg) and will be constrained with subsets limb. Fig. 3 - Normal limb - subsets Fig. 4 - JointLimb - subsets
While in the previous example we were having a subsetting somewhat related to the inheritance it doesn't necessarily have to be the case. Let's consider class Car and class Wheel. A Car is equipped with Wheels (which is a relationship equippedWheel), some of them (e.g. 4 for passenger car) are mountedWheel while some (1 for passenger car) are spareWheel. Both mountedWheel and spareWheel subset equippedWheel. Fig. 5 - Car - subsets
I'm sorry, I can't place pictures yet nor put more than 2 links so you have to follow this link to see the examples.
Hope that helps.
According to UML 2.4.1 specification, Subsetted Property references the properties of which this property is constrained to be a subset.
What do you mean by a real-world example ? UML specification is one of them I guess...
But you might find this kind of properties in all applicatioh where an Object is associatded to another and this association is redefined in the context of two of theirs subtypes.
For example, an Animal
class can be associated to a Limb
class. We can also define two classes Human
and Leg
extending respectively Animal
and Limb
. Finally we can associate Human
and Leg
which will be a redefinition of the preexisting association.
Hoping it helps, BR
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With