Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » Problem with references and lazy rules
Problem with references and lazy rules [message #520459] Fri, 12 March 2010 13:34 Go to next message
katja  is currently offline katja Friend
Messages: 18
Registered: March 2010
Junior Member
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 #520572 is a reply to message #520459] Fri, 12 March 2010 20:59 Go to previous messageGo to next message
farah Mising name is currently offline farah Mising nameFriend
Messages: 58
Registered: July 2009
Member
hello,
show me the code of isAss()


Farah
Re: Problem with references and lazy rules [message #520615 is a reply to message #520572] Sat, 13 March 2010 10:16 Go to previous message
katja  is currently offline katja Friend
Messages: 18
Registered: March 2010
Junior Member
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.
Previous Topic:[ATL] Problem trying to transform uml programmatically
Next Topic:[ATL] Changing UML Property Datatype
Goto Forum:
  


Current Time: Fri Apr 19 05:14:12 GMT 2024

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

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

Back to the top