[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.mdt.ocl] Re: OCL query to find classes

Hi, pokojo,

Sorry, yes, I think our examples used a variable name "model" which probably doesn't exist.  In the context of your root model element you could do:

  self.allOwnedElements()->select(oclIsTypeOf(Class))

or, thanks to the getModel() operation defined by MDT UML2 (not specified by UML 2.x, I don't think), in the context of any element you can do:

  getModel().allOwnedElements()->select(oclIsTypeOf(Class))

Note that "ownedElement.allOwnedElements()" will miss any Classes that are directly owned by the context element (the _expression_'s "self") because it iterates only the elements owned by the elements owned by self.

Cheers,

Christian


On Mon, 2009-09-14 at 15:32 +0000, pkojo wrote:
Hello Chirstian & Timothy,

I tried to run queries as you mentioned in your previous replies but that 
query does not give me result, but it helps me to look into ownedElement, 
now I am able to find all classes in a UML models. Here is the query: 

ownedElement.allOwnedElements()->select(e|e.oclIsTypeOf(Class))

regards,
pokojo