[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.m2m] Re: [ATL] UML stereotype problem

Aamir Mehmood 写道:
> Hi,
> 
> this simple helper also works well:
> 
> -- Checks if the given stereotype is applied or not.
> helper context UML2!Element def : isStereotypeApplied(name :
> String):Boolean =
> 
> 	not self.getAppliedStereotypes()->select(p | p.name = name).isEmpty();
> 
> 
> and call it like this:
> 
> rule ABC{
>     from 	
> 	s : UML2!Element (s.isStereotypeApplied('MyStereotype'))

Hi Aamir Mehmood,

Thanks for your help .I acted as you advised , I rewrite the code  as
following :

helper context UML!Class def : isStereotypeApplied(name :
String):Boolean =
	not self.getAppliedStereotypes()->select(p | p.name = name).isEmpty();

----------------------
rule toProcess{
	from
		u : UML!"uml::Activity",						c :
UML!"uml::Class"(u.oclIsTypeOf(UML!"uml::Activity") and
			if c.oclIsTypeOf(UML!"uml::Class") and 							c.name='onlinesale'
			then c.isStereotypeApplied('BPEL::Process')
			else false
			endif
			)
	to
		p :BPEL!"model::Process"(...)



but when I debug it ,the result is empty .It didn't test the class named
  "onlinesale" having stereotype "Process".
What's the problem??

best regards!