Problem with references and lazy rules [message #520459] |
Fri, 12 March 2010 08:34  |
Eclipse User |
|
|
|
Hi!
I need to write some transformations rules with ATL for one project in my university, and I have the problem at the moment which I can't solve. Could anyone help me?
Description of the problem:
I write the following rules:
rule lane2model {
from
cLane : xx!BLane
using {
xmiID : String = cLane.__xmiID__;
}
to
model : soaml!Model(
__xmiID__ <- xmiID,
packagedElement <- cLane.dataElements -> select(a | a.oclType() = xx!DataObject) -> collect (b | thisModule.DataObject2ClassObject(b)),
packagedElement <- cLane.dataElements -> select(a | a.oclType() = xx!Relationship) -> select(c | c.isAss())-> collect (b | thisModule.relationship2assoc(b))
--isAss() is a helper which works without problems
)
}
lazy rule DataObject2ClassObject {
from
artif : xx!DataObject
using {
xmiID : String = artif.__xmiID__;
}
to
ClassObject : soaml!Class(
name <- artif.dname,
__xmiID__ <- xmiID,
visibility <- artif.visibility,
generalization <- artif.getGen() -> collect(a | thisModule.relationship2gen(a))
--getGen() is a helper which works without problems
)
}
lazy rule relationship2gen {
from
gen : xx!Relationship
using {
xmiID : String = gen.__xmiID__;
}
to
sgener : soaml!Generalization(
__xmiID__ <- xmiID,
general <- gen.relationsTarget
--gen.relationsTarget has type xx!DataObject
--general has type soaml!Class
)
}
The problem is that the attribute "general" in the last rule should contain the reference to transformed by rule "ClassObject" gen.relationsTarget, what doesn't happen.
If I do it with rule(without "lazy"), it works, but I need that it works also with lazy rule. Is there a possibility to solve the problem and get the references with using lazy rules?
Thank you in advance,
Katja
|
|
|
|
Re: Problem with references and lazy rules [message #520615 is a reply to message #520572] |
Sat, 13 March 2010 05:16  |
Eclipse User |
|
|
|
Hi!
If it can help you to answer my questions, these are my helpers:
helper context xx!Relationship def : isAss() : Boolean =
if self.stype = #Association
then true
else
if self.stype <> #Generalization
then self.stype <> #Aggregation
else false
endif
endif
;
helper context xx!DataObject def : getGen() : Set(xx!Relationship) =
let s: Set(xx!Relationship)= self.rOutgoingDataObject-> select(c|c.isGen()) in s
;
But isAss() has no common with the problem, the problem is caused by last 2 rules.
|
|
|
Powered by
FUDForum. Page generated in 0.05296 seconds