[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.m2m] References in ATL output

Hi,

We are trying to generate a KDM file with an STM input for the java language. The Transformation output looks good but we had problems setting the references inside of our output.
We use a function to create PrimitiveTypes :


rule CreatePrimitiveTypes()
{
	to
		B : kdm!BooleanType (
		name <- 'boolean'
		),
		C : kdm!CharType
		(
			name <- 'char'
		),
		F : kdm!FloatType
		(
		name <- 'float'	
		),
		Fd : kdm!FloatType
		(
		name <- 'double'	
		),
		I : kdm!IntegerType
		(
			name <- 'int'
		),
		Il : kdm!IntegerType
		(
			name <- 'long'
		),
		v : kdm!VoidType
		(
			name <- 'void'
		),
		Vn : kdm!VoidType
		(
			name <- 'null'
		),
		kdmLanguageUnit : kdm!LanguageUnit(
			name <- 'Primitive Java datatypes',
			codeElement <- B,
			codeElement <- C,
			codeElement <- F,
			codeElement <- Fd,
			codeElement <- I,
			codeElement <- Il,
			codeElement <- v,
			codeElement <- Vn
		)
		do
		{
		    kdmLanguageUnit;
		}
}


Now we would like to link our generated elements which are Primitve to the elements created by this rule.


For example :

We have a rule that create Methods parameters :

lazy rule CreateParameters {
from stmConcreteNode : STM!StConcreteNode (
stmConcreteNode.concreteId = 'FieldDeclaration'
)
to
kdmParameter:kdm!ParameterUnit (
name <- stmConcreteNode.getParameter('./StConcreteNode[2]/StToken[1]/@image')


type <- ???????? (Need to be linked to boolean)

			)
}


Right now our output looks like this :

 <codeElement xsi:type="code:MethodUnit" name="myMethod1">
         <codeElement xsi:type="code:Signature" name="myMethod1">
           <parameterUnit name="param"/>
           <parameterUnit name="index"/>
           <parameterUnit kind="return" type="????"/>
         </codeElement>
       </codeElement>



And we would like it to look like this :

<codeElement xsi:type="code:MethodUnit" name="myMethod1">
<codeElement xsi:type="code:Signature" name="myMethod1">
<parameterUnit name="param"/>
<parameterUnit name="index"/>
<parameterUnit kind="return" type="//@model.1/@codeElement.0/@codeElement.3"/>
</codeElement>
</codeElement>



Thanks in advance for your answers,