Skip to main content



      Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Strange behavior when overriding called rule or lazy rule
[ATL] Strange behavior when overriding called rule or lazy rule [message #70351] Thu, 03 January 2008 10:39
Eclipse UserFriend
Originally posted by: arnaud.giuliani.c-s.fr

Hello all,

i'm trying to override two called rules "ShowPackElement" and call them in
the first rule "Package" in the packagedElement collection :

rule Package {
from s : UML2!"uml::Package"
to t : UML2!"uml::Package" mapsTo s (
name <- s.name,
visibility <- s.visibility,
eAnnotations <- s.eAnnotations,
ownedComment <- s.ownedComment,
clientDependency <- s.clientDependency,
nameExpression <- s.nameExpression,
elementImport <- s.elementImport,
packageImport <- s.packageImport,
ownedRule <- s.ownedRule,
templateParameter <- s.templateParameter,
templateBinding <- s.templateBinding,
ownedTemplateSignature <- s.ownedTemplateSignature,
packageMerge <- s.packageMerge,
packagedElement <- s.packagedElement->collect(c |
thisModule.ShowPackElement(c))
)
}

rule ShowPackElement(a : UML2!"uml::Association"){
to c2 : UML2!"uml::Class"(
name <- 'NEWASSOC_'+a.name
)
do{
'in assoc ...'.println();
c2;
}
}

rule ShowPackElement(c : UML2!"uml::Class"){
to c2 : UML2!"uml::Class"(
name <- 'NEWCLASS_'+c.name
)
do{
'in class ...'.println();
c2;
}
}

With a simple model (2 classes and an association), i've got classes
produced only from the last rule. I obtain this in my console, whereas I
have one association :
in class ...
in class ...
in class ...

If i switch the ShowPackElement rules, i get :
in assoc ...
in assoc ...
in assoc ...


I tried to do another treatment. I replaced my called rules with lazy
rules :

lazy rule ShowPackElement {
from a : UML2!"uml::Association"
to c2 : UML2!"uml::Class"(
name <- 'NEWASSOC_'+a.name
)
do{
'in assoc ...'.println();
}
}

lazy rule ShowPackElement {
from c : UML2!"uml::Class"
to c2 : UML2!"uml::Class"(
name <- 'NEWCLASS_'+c.name
)
do{
'in class ...'.println();
}
}

I get the same logs as above. The last operation is used even if the
object matched in the collection is not of the right type (association
taken as a class ...)

Is it possible to override helpers, called rules or lazy rules ? With this
kind of behaviour, is there a problem with my code or ATL ?
Previous Topic:[ATL] oclAsType
Next Topic:launch atl transformation from java
Goto Forum:
  


Current Time: Sun Jul 13 19:14:41 EDT 2025

Powered by FUDForum. Page generated in 0.03425 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top