Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » ETL
ETL [message #585151] Tue, 26 January 2010 08:39 Go to next message
c  is currently offline c Friend
Messages: 36
Registered: December 2009
Member
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 #585171 is a reply to message #585151] Tue, 26 January 2010 10:05 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi,

Please see comments below.

c wrote:
> 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.
>
>

I'm afraid I can't understand your question. Could you possibly rephrase
and/or attach some model files with the expected/actual results of the
transformation?

>
> 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();
> }

If you want to transform one Ecore model to another Ecore model, you
have to give distinct names to your models (e.g. Source and Target) and
make sure you use Ecore classes in your transformation (Ecore doesn't
define a Package or Model class). E.g.

rule EPackage2EPackage
transform s : Source!EPackage
to t : Target!EPackage {

t.name = s.name;
...

}

> Thanks!!!

Cheers,
Dimitris

--
Spread the word: http://www.eclipse.org/gmt/epsilon/spreadtheword
Follow Epsilon on Twitter: http://twitter.com/epsilonews
Re: ETL [message #585183 is a reply to message #585171] Tue, 26 January 2010 13:10 Go to previous messageGo to next message
c  is currently offline c Friend
Messages: 36
Registered: December 2009
Member
I have the following function:

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;
}
}


And in the model of entry I have the types

Primitive integer
Primitive date
Primitive STRING

The resultant model is
Primitive CHAR
Primitive CHAR
Primitive CHAR

It is to say that the type Primitive integer turns into Primitive CHAR

I do not understand because it happens
Thanks!!!
Re: ETL [message #585196 is a reply to message #585183] Tue, 26 January 2010 16:35 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi,

This happens because CHAR is the first literal in the BasicTypes
enumeration and is used by EMF as the default value in case you don't
explicitly specify one.

Cheers,
Dimitris

c wrote:
> I have the following function:
> 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;
> }
> }
>
>
> And in the model of entry I have the types
>
> Primitive integer
> Primitive date
> Primitive STRING
>
> The resultant model is
> Primitive CHAR
> Primitive CHAR
> Primitive CHAR
> It is to say that the type Primitive integer turns into Primitive CHAR
>
> I do not understand because it happens
> Thanks!!!


--
Spread the word: http://www.eclipse.org/gmt/epsilon/spreadtheword
Follow Epsilon on Twitter: http://twitter.com/epsilonews
Re: ETL [message #585376 is a reply to message #585151] Sun, 31 January 2010 16:36 Go to previous message
c  is currently offline c Friend
Messages: 36
Registered: December 2009
Member
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!!
Previous Topic:Problem with target.decoration annotation
Next Topic:Problem with target.decoration annotation
Goto Forum:
  


Current Time: Fri Apr 26 03:55:09 GMT 2024

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

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

Back to the top