I've got a rather large and sweeping set of models that I have to combine into a single coherent autogenerator. The issue I'm running across is that I need to determine if a class has no one inhereting from it or not as there's different generation steps that have to be done if a class has children.
Is there an easy way to do this with OCL in an ECore environment?
hallo david
normally a class does not know, something about its subclasses
i had a similiar problem. i wanted to get all childs from a class
an ocl-expression like this should work
self.getModel().allOwnedElements().oclIsTypeOf(Generalization)->select(e|e.general()=self).owner
then you should get all subclasses of an class
this only work if your rootElement is a model
mabe that helps you
When necessary allInstances() is useful for finding everything. So get
all classes then filter all superClasses thereof.
Regards
Ed Willink
On 12/07/2011 14:39, David Sauter wrote:
> I've got a rather large and sweeping set of models that I have to
> combine into a single coherent autogenerator. The issue I'm running
> across is that I need to determine if a class has no one inhereting
> from it or not as there's different generation steps that have to be
> done if a class has children.
>
> Is there an easy way to do this with OCL in an ECore environment?
>
> David Sauter