I try to write ocl to add constraint to child (animal), but the constraint must user parent class name (mamifere). I think the first version doesn't work, and I think there is a nicer solution that the second example. Help me please ?
image for example animal:
That looks strange. Your first constraint tells (provided it's linked to
animal
) that the type ofaninmal
must bemamifere
, butmamifere
inherits fromanimal
. That does not make sense.The second variant does not make sense either. Provided the constraint applies to anything on the diagram, each instance must be named
mamifere2
. So you can have only instances with name ==mamifere2
. Especially strange with avivipare2
instance.I don't see where you model any child relation at all. So I'm just guessing you mean this:
A child has two parents (well, for humans there now can be more). And there can be
*
children which must have the same type as the parents (so you can't model mules or the like).