Skip to main content



      Home
Home » Modeling » ATL » ATL - two sources (with restrictions) in one rule
ATL - two sources (with restrictions) in one rule [message #1748470] Wed, 23 November 2016 07:41 Go to next message
Eclipse UserFriend
Good morning,
I want to use two sources (with restrictions) in one rule but show it's wrong, when I put the two sources without restrictions the eclipse does not show errors.

rule MethodDeclarationToMethodUnit
{
from
source: KDM!MethodUnit (source.kind = #constructor)
,parametros: KDM!ParameterUnit

[Updated on: Wed, 23 November 2016 07:43] by Moderator

Re: ATL - two sources (with restrictions) in one rule [message #1748474 is a reply to message #1748470] Wed, 23 November 2016 08:12 Go to previous messageGo to next message
Eclipse UserFriend
The filter must be at the end of all the "sources".
By the way, be careful that - as such - this rule will be activated for every possible couple of (MethodUnit,ParameterUnit) in your model, I don't think that is what you want to achieve here (so you probably have to add another condition that specify the precise link that should exist between those two elements for the rule to be activated).
Re: ATL - two sources (with restrictions) in one rule [message #1748475 is a reply to message #1748474] Wed, 23 November 2016 08:23 Go to previous message
Eclipse UserFriend
thanks a lot!
I try to complete all the parameter the each method, You have another idea of how to do this?
PD: I'm working in transformation Model to Model (KDM model to Java Model), for now only with method constructor.

rule MethodDeclarationToMethodUnit
{
from
parametros: KDM!ParameterUnit,
source: KDM!MethodUnit (source.kind = #constructor)

to
target:JAVA!ConstructorDeclaration
(
name <- source.name
,modifier <- variavelModifier
,body <- variavelBody
,parameters <- variavelParameters
)
,variavelModifier:JAVA!Modifier(
visibility <- source.attribute -> collect(f | f.value)
)
,variavelBody:JAVA!Block(

)
,variavelParameters:JAVA!SingleVariableDeclaration(

)

}

[Updated on: Wed, 23 November 2016 08:28] by Moderator

Previous Topic:OclExpression decomposition in ATL HOT
Next Topic:Simple Transformation Question
Goto Forum:
  


Current Time: Fri Jul 25 21:07:31 EDT 2025

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

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

Back to the top