| ETL [message #585151] |
Tue, 26 January 2010 03:39  |
Eclipse User |
|
|
|
Hello again. I have the following problem: when there is executed the following rule of transformation of primitive types the problem that I have is that when a type does not expire with the rule, in this case that is of type "DATED" does not expire with the rule String2Varchar there is generated a primitive type that for fault is of type CHAR.
rule String2Varchar
transform pr:UML!PrimitiveType
to v:modeloOR!PrimitiveType{
if((pr.name='String') or(pr.name='STRING') or (pr.name='string')){
'String2Varchar'.println();
v.Name:=modeloOR!BasicTypes#CHAR;
}
}
But I believe that the correct functioning is that if a type for example to type "DATE" it does not expire with the "if", it does not have to generate a TypePrimitive on not having expired with the judgment IF.
Dimitros, your tell me that was creating a file '.model ' but ¿ I can it execute the rules ETL from a file '.ecore ' of entry and another file '.ecore ' of exit?
If the file of entry was '.ecore ', the rules ETL serian like that?
rule Package2Model
transform t : ecore!Package
to n : ecore!Model {
n.Name:= t.Name;
'Package2Model '.println();
}
Thanks!!!
|
|
|
|
|
|
| Re: ETL [message #585376 is a reply to message #585151] |
Sun, 31 January 2010 11:36  |
Eclipse User |
|
|
|
I have some doubts:
The first one of the doubts that tense is:
I have the code:
operation method_seq(c:UML!Class):modeloOR!Method{
var m: new modeloOR!Method;
for (op in c.ownedOperation) {
m.Name:=op.name;
}
return m;
}
operation asignartt(c:UML!Class):modeloOR!TypedTable{
'asignartt'.println();
var sx: new modeloOR!TypedTable;
sx.Name:=c.name+'s<<persistent>>';
return sx;
}
rule Class2UDT
transform c:UML!Class
to s:modeloOR!StructuredType{
'Class2UDT'.println();
s.Name:=c.name+ "<<udt>>";
s.Name.println();
s.typed:=asignartt(c);
s.method:= method_seq(c);
}
And for the assignment of s.typed: = asignartt (c); and s.method: = method_seq (c); me the mistake appears " Invalid assignment to property 'typed' " and " Invalid assignment to property 'method' " and I do not understand because this happens.
The second doubt:
When I transform a type CHAR the method creates
Primitive CHAR
Primitive CHAR
Primitive CHAR
and I want that the result is
Primitive integer
Primitive date
Primitive STRING
You were recommending to your me that ' you don't explicitly specify one.
But I do not want to create anything type for default. I want that alone when the condificion 'if' is true it create the type PrimitiveType CHAR.
To obtain it I have thought of putting a precondicion in front of this method of the following form:
pre{
var pr: new UML!PrimitiveType;
(pr.name='String') or(pr.name='STRING') or (pr.name='string')
}
rule String2Varchar
transform pr:UML!PrimitiveType
............
...........
But this does not work. Since I can do it?
The third doubt is, which is the equivalence of the method resolveTemp" of ATL in ETL.
The defincion of this function in ATL is:
This specific operation makes it possible to point, from an ATL rule, to any of the target model elements (including non-default ones) that will be generated from a given source model element by an ATL matched rule.
The operation resolveTemp has the following declaration: resolveTemp(var, target_pattern_name). The parameter var corresponds to an ATL variable that contains the source model element from which the searched target model element is produced. The parameter target_pattern_name is a string value that encodes the name of the target pattern element (see Section 4.5.2) that maps the provided source model element (contained by var) into the searched target model element.
I have this code:
typed <-thisModule.resolveTemp(p->refImmediateComposite(),'tt')
I have thought that the transformation would be in ETL:
operation resolveTemp(d:UML!Property):modeloOR!TypedTable{
'resolveTemp'.println();
var t: new modeloOR!TypedTable;
d.eContainer():='tt';
return t;
}
rule.xxxx
transform :d:UML!Property
to .....
{
st.typed:=resolveTemp(d);
}
but, it is not correct....And I also have tried this:
typed:=(p.eContainer().type::='tt');
Thanks!!
|
|
|
Powered by
FUDForum. Page generated in 0.05290 seconds