Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Can input model variables be referred to in rules?
[ATL] Can input model variables be referred to in rules? [message #105367] Wed, 20 May 2009 09:16 Go to next message
Maria Agustina Cibran is currently offline Maria Agustina CibranFriend
Messages: 13
Registered: July 2009
Junior Member
Hi,

I defined a module as follows:

module Test;
create OUT : UML from IN1 : UML, IN2: UML, PROFILE: UML;
...

Later in the implementation of a rule I would like to refer to the PROFILE
input model, as follows for instance:

rule Rule1 {
from e: UML!Class ((sys.oclIsTypeOf(UML!Class)) and
(sys.getModel().equals(thisModule.PROFILE))
...

This code has no compilation error, but at run time I get the following
output:

INFO: Execution terminated due to error (see launch configuration to allow
continuation after errors).
GRAVE: transformation module "Test" does not have an initialized field
named "PROFILE"
java.lang.RuntimeException: transformation module "Test" does not have an
initialized field named "PROFILE"

Any tip on how I can use the input model variable??

Thanks in advance
Agustina
Re: [ATL] Can input model variables be referred to in rules? [message #105396 is a reply to message #105367] Wed, 20 May 2009 10:21 Go to previous messageGo to next message
Skander TURKI is currently offline Skander TURKIFriend
Messages: 130
Registered: July 2009
Senior Member
Maybe like this:

rule Rule1 {
from e: UML!Class, p: PROFILE!Profile ((e.oclIsTypeOf(UML!Class)) and
(e.getModel().equals(p.name)) ...
Re: [ATL] Can input model variables be referred to in rules? [message #105438 is a reply to message #105396] Wed, 20 May 2009 13:49 Go to previous messageGo to next message
Maria Agustina Cibran is currently offline Maria Agustina CibranFriend
Messages: 13
Registered: July 2009
Junior Member
Hi,

the solution you proposed does not work.

What I need to do is to
Re: [ATL] Can input model variables be referred to in rules? [message #105447 is a reply to message #105438] Wed, 20 May 2009 13:56 Go to previous messageGo to next message
Maria Agustina Cibran is currently offline Maria Agustina CibranFriend
Messages: 13
Registered: July 2009
Junior Member
Hi again, sorry, I pressed 'Post' too quickly.

The solution that you propose does not work. PROFILE is not a metamodel
but a variable that refers to an input model that complies with the UML
metamodel.

What I actually need to do in my rule is to check that the class that is
matched in the variable e belongs to the input model PROFILE (PROFILE is a
input variable that refers to such a model)...

I am pasting here again what I would like to be able to write (without
copy/paste errors now):

rule Rule1 {
from e: UML!Class ((e.oclIsTypeOf(UML!Class)) and
(e.getModel().equals(thisModule.PROFILE)) ...

Thanks!
Agustina
Re: [ATL] Can input model variables be referred to in rules? [message #105460 is a reply to message #105447] Wed, 20 May 2009 15:36 Go to previous messageGo to next message
Skander TURKI is currently offline Skander TURKIFriend
Messages: 130
Registered: July 2009
Senior Member
try this :

module Test;
create OUT : UML from IN1 : UML, IN2;
...

helper def : profileName : String = 'yourProfileName'

....
rule Rule1 {
from e: UML!Class ((sys.oclIsTypeOf(UML!Class)) and (not
(sys.getAllAppliedProfiles()->select(p | p.name =
thisModule.profileName)->isEmpty())

skander
Re: [ATL] Can input model variables be referred to in rules? [message #105474 is a reply to message #105460] Wed, 20 May 2009 15:44 Go to previous message
Skander TURKI is currently offline Skander TURKIFriend
Messages: 130
Registered: July 2009
Senior Member
sorry, you have to get the model of the class first:

....
rule Rule1 {
from e: UML!Class ((sys.oclIsTypeOf(UML!Class)) and (not
(sys.getModel().getAllAppliedProfiles()->select(p | p.name =
thisModule.profileName)->isEmpty())
Previous Topic:inject km3 to ecore
Next Topic:[ATL] how to set up the association after transformatin by ATL
Goto Forum:
  


Current Time: Wed Apr 24 23:45:31 GMT 2024

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

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

Back to the top