Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Run Etl
Run Etl [message #1790229] Thu, 07 June 2018 09:39 Go to next message
Marzieh ghorbani is currently offline Marzieh ghorbaniFriend
Messages: 33
Registered: September 2017
Member
Hi all

TransformationRule has transform(Object source, Collection<Object> targets, IEtlContext context).I have tried to use transform(...) method for transforming one element of source model in to target, but it didn't run. Can you tell me, is it possible?

Best regards
Marzieh
Re: Run Etl [message #1791044 is a reply to message #1790229] Fri, 22 June 2018 04:47 Go to previous messageGo to next message
Flavio Costa is currently offline Flavio CostaFriend
Messages: 23
Registered: February 2018
Junior Member
It would probably help to provide some minimal sample code and a more specific explanation of what you are trying to achieve with it...
Re: Run Etl [message #1791121 is a reply to message #1791044] Sun, 24 June 2018 06:47 Go to previous messageGo to next message
Marzieh ghorbani is currently offline Marzieh ghorbaniFriend
Messages: 33
Registered: September 2017
Member
Hi Flavio Costa
I want to transform one element of source model in to target. In other words I have one ETL file that has multi rules. I want to run only one of the rules on the one of model elements by java. When I use the minimal example to run contains EtlStandaloneExample.java file, the below error is appeared.
Exception in thread "main" Property 'name' not found in object LastName

The minimal example contains EtlStandaloneExample.java file. Please run it to see the errors.
I use Eclipse Mars1 with Epsilon 1.4.0.

Best
Marzieh
Re: Run Etl [message #1792294 is a reply to message #1791121] Sat, 14 July 2018 18:22 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Marzieh,

You are trying to execute a rule ("SingleValuedAttribute2Column") on a string ("LastName") instead of a model element of type Attribute that the transformation expects. Before you execute your transformation you'll also need to load your model (presumably NewEducational.model) and attach it to your module using module.getContext().getModelRepository().addModel(...).

Cheers,
Dimitris
Re: Run Etl [message #1792303 is a reply to message #1792294] Sun, 15 July 2018 19:02 Go to previous messageGo to next message
Marzieh ghorbani is currently offline Marzieh ghorbaniFriend
Messages: 33
Registered: September 2017
Member
Hi Dimitris Kolovos
I load the model and attach it to module and I use model element of type Attribute instead of "LastName". But when run show this error:
"Exception in thread "main" Property 'name' not found in object Sequence {c:DB!Column}" .

If it is possible, please explain how can solve this error?

best regards,
Marzieh
Re: Run Etl [message #1792304 is a reply to message #1792303] Sun, 15 July 2018 19:07 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Marzieh,

Could you please prepare an updated version of your minimal example I can use to reproduce this locally? Alternatively, to avoid sending across zipped copies of your code, you may want to put it in a public GitHub repo I can fetch it from.

Cheers,
Dimitris
Re: Run Etl [message #1792454 is a reply to message #1792304] Wed, 18 July 2018 08:50 Go to previous messageGo to next message
Marzieh ghorbani is currently offline Marzieh ghorbaniFriend
Messages: 33
Registered: September 2017
Member
Hello Dimitris Kolovos
The new version of minimal example is attached. It contains EtlStandaloneExample.java file. Please run it to see the errors.
"Exception in thread "main" Property 'name' not found in object Sequence {c:DB!Column}"
best regards,
Marzieh
Re: Run Etl [message #1792455 is a reply to message #1792454] Wed, 18 July 2018 09:01 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Marzieh,

"targets" should be a list of model elements but in the current version of your code, it is a list of org.eclipse.epsilon.eol.dom.Parameter objects.

Cheers,
Dimitris
Re: Run Etl [message #1792878 is a reply to message #1792455] Wed, 25 July 2018 10:39 Go to previous messageGo to next message
Marzieh ghorbani is currently offline Marzieh ghorbaniFriend
Messages: 33
Registered: September 2017
Member
Hello Dimitris Kolovos
Thanks also for the guide. Unfortunately I could not execute the MinimalExample. I debug the code and I think that problem is related to the operation toDBtype() is in "OO2DB.etl" file, this operation called on the "name" that have type of "String", while transform(...) call the operations that have type of "eObject".
The new version of minimal example is attached. It contains EtlStandaloneExample.java file. Please run it to see the errors. Please guide me.
best regards,
Marzieh

[Updated on: Wed, 25 July 2018 10:48]

Report message to a moderator

Re: Run Etl [message #1792999 is a reply to message #1792878] Fri, 27 July 2018 10:00 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Marzieh,

OO2DB.etl requires three models named "OO", "DB" and "OO2DB", but in your example it is is executed against only one model named "Right".

Cheers,
Dimitris

[Updated on: Fri, 27 July 2018 10:01]

Report message to a moderator

Re: Run Etl [message #1793231 is a reply to message #1792999] Wed, 01 August 2018 21:02 Go to previous messageGo to next message
Marzieh ghorbani is currently offline Marzieh ghorbaniFriend
Messages: 33
Registered: September 2017
Member
Hello Dimitris Kolovos,
I prepared an updated version of minimal example. Actually I loaded three models and attached them to module. But I still encounter an error message. Please run EtlStandaloneExample.java file to see the error. Please guide me.

Best Regards,
Marzieh

Re: Run Etl [message #1793234 is a reply to message #1793231] Wed, 01 August 2018 23:35 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Marzieh,

Loading the same model twice (e.g. newSource2.model) produces two different sets of in-memory model elements. Epsilon delegates property getting and setting to models and each model only recognises the model elements (in-memory objects) it owns. As such, instead of loading newSourceModel2.model again, you should replace:

etlmodule.getContext().getModelRepository().addModel(OO);


with:

newVersion.setName("OO");
etlmodule.getContext().getModelRepository().addModel(newVersion);


For similar reasons the ETL runtime fails to retrieve the "name" property of the new Column you create as the latter is never added to one of the models involved in the transformation. To add the new column to the DB model, you should add the following line after targets.add(eObject):

DB.getResource().getContents().add(eObject);


Cheers,
Dimitris
Re: Run Etl [message #1793315 is a reply to message #1793234] Fri, 03 August 2018 17:48 Go to previous messageGo to next message
Marzieh ghorbani is currently offline Marzieh ghorbaniFriend
Messages: 33
Registered: September 2017
Member
Hi Dimitris Kolovos,
Thank you for the answers.
I create a new MinimalExample and I want run transform(...) method for familly2Person example. I have a problem. The problem is related to the operation familyName(). This operation called on the "lastname" that have type of "String", while transform(...) call the operations that have type of "eObject".
The new Minimal Example is attached. It contains EtlStandaloneExample.java file. Please run it to see the errors. Please guide me.

Best Regards,
Marzieh
Re: Run Etl [message #1793318 is a reply to message #1793315] Fri, 03 August 2018 22:29 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Marzieh,

After

EtlModule module = new EtlModule();


you need to add the following line:

module.getContext().setModule(module);


Linking the context back to the module typically happens in execute() but since you're invoking rules directly, you have to do this in your code.

Cheers,
Dimitris
Re: Run Etl [message #1793331 is a reply to message #1793234] Sat, 04 August 2018 19:59 Go to previous messageGo to next message
Marzieh ghorbani is currently offline Marzieh ghorbaniFriend
Messages: 33
Registered: September 2017
Member
Hello Dimitris Kolovos
I have two questions:
1) When we want to run a transformation's rule, it's required to run a pre block at first. I want to know How to run a pre block before directly running the rule?

2) Each attribute of a class has a property "owner". For running a rule directly, it is required to detect "owner". How can we detect "owner"?
Best Regards,
Marzieh
Re: Run Etl [message #1793332 is a reply to message #1793331] Sat, 04 August 2018 20:37 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Marzieh,

1) See [1] (line 120) and [2] (lines 101-105).

2) I'm not sure I understand what you mean by "Each attribute of a class has a property "owner"". Could you please elaborate a bit more? (ideally with a concrete example)

Cheers,
Dimitris

[1] https://git.eclipse.org/c/epsilon/org.eclipse.epsilon.git/tree/plugins/org.eclipse.epsilon.etl.engine/src/org/eclipse/epsilon/etl/EtlModule.java
[2] https://git.eclipse.org/c/epsilon/org.eclipse.epsilon.git/tree/plugins/org.eclipse.epsilon.erl.engine/src/org/eclipse/epsilon/erl/ErlModule.java
Re: Run Etl [message #1793504 is a reply to message #1793332] Thu, 09 August 2018 09:39 Go to previous messageGo to next message
Marzieh ghorbani is currently offline Marzieh ghorbaniFriend
Messages: 33
Registered: September 2017
Member
Hello Dimitris Kolovos,

Thank you very much. I could running the rule directly.

Best Regards,
Marzieh
Re: Run Etl [message #1793623 is a reply to message #1793504] Sun, 12 August 2018 06:37 Go to previous messageGo to next message
Marzieh ghorbani is currently offline Marzieh ghorbaniFriend
Messages: 33
Registered: September 2017
Member
Hello Dimitris Kolovos,

I could running the rule "SingleValuedAttribute2Column" directly. But when run the "Class2Table" rule directly, following the error showed: "Exception in thread "main" Method 'primaryKeyName' not found for: org.eclipse.emf.ecore.impl.DynamicEObjectImpl@4550bb58 [eClass: org.eclipse.emf.ecore.impl.EClassImpl@3bb9a3ff [name: Table] [instanceClassName: null] [abstract: false, interface: false]]".
Although, I wrote the "etlmodule.getContext().setModule(etlmodule)".
Please guide me?

Best Regards,
Marzieh

[Updated on: Tue, 14 August 2018 18:41]

Report message to a moderator

Re: Run Etl [message #1793690 is a reply to message #1793623] Tue, 14 August 2018 08:03 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Marzieh,

Could you please prepare an updated version of your minimal example I can use to reproduce this locally?

Cheers,
Dimitris
Re: Run Etl [message #1793731 is a reply to message #1793690] Tue, 14 August 2018 18:39 Go to previous messageGo to next message
Marzieh ghorbani is currently offline Marzieh ghorbaniFriend
Messages: 33
Registered: September 2017
Member
Hello Dimitris Kolovos,

I prepared minimal example. It contains EtlStandaloneExample.java file. Please run it to see the errors.

Best Regards,
Marzieh
Re: Run Etl [message #1794354 is a reply to message #1793731] Wed, 29 August 2018 13:12 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Marzieh,

Apologies for the slow response. Please replace

EClass eClass = (EClass) metapackage.getEClassifier("Table");
EObject eObject = metapackage.getEFactoryInstance().create(eClass);

EClass eClass1 = (EClass) metapackage.getEClassifier("Column");
EObject eObject1 = metapackage.getEFactoryInstance().create(eClass1);
				
DB.setResource(resource);
targets.add(eObject);
targets.add(eObject1);
				
DB.getResource().getContents().add(eObject);
DB.getResource().getContents().add(eObject1);


with

EObject eObject = DB.createInstance("Table");
EObject eObject1 = DB.createInstance("Column");
targets.add(eObject);
targets.add(eObject1);


in your code and this will work as expected.

Cheers,
Dimitris
Re: Run Etl [message #1794885 is a reply to message #1794354] Mon, 10 September 2018 10:24 Go to previous messageGo to next message
Marzieh ghorbani is currently offline Marzieh ghorbaniFriend
Messages: 33
Registered: September 2017
Member
Hello Dimitris Kolovos,

Thank you very much for your guide. The code worked, but The created "column" in target model doesn't have Value. I tried to fix it, but it didn't solved. Please guide me?
I prepared a minimal example and an image that show the target model. The minimal example contains EtlStandaloneExample.java file. Please run it.

Best Regards,
Marzieh
Re: Run Etl [message #1795139 is a reply to message #1794885] Sun, 16 September 2018 17:48 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Marzieh,

The attached minimal example has a compilation error as EtlStandaloneExample is in the wrong package. When I fixed this, it threw a runtime exception as there's no models/Targets.model. Intuitively, I renamed Table-Targets.model to Targets.model and then it ran to completion printing "student" in the console. Looking at your code, I cannot find any comments that indicate where the problem is or what behaviour you would have expected. Could you please explain the problem you're encountering a bit more with references to specific lines of code?

Cheers,
Dimitris
Re: Run Etl [message #1795175 is a reply to message #1795139] Mon, 17 September 2018 19:04 Go to previous messageGo to next message
Marzieh ghorbani is currently offline Marzieh ghorbaniFriend
Messages: 33
Registered: September 2017
Member
Hello Dimitris Kolovos,

Excuse me for mistake occurred in attaching the minimal Example.
I want to run the "Class2Table" directly with use the Transform(..) method. When I run the codes exists in minimalExample, no error message was seen in console. In other words the rule "Class2Table" has been executed and target model ("Targets") has been generated, but the generated target model has a problem. It has an element of kind of table with name "TableStudent" and an element of kind of Column without any name. (please See figure,( "Targets.PNG"))
Now, problem is that the column hasn't any name. How can I solved it?

Best Regards,
Marzieh
Re: Run Etl [message #1795263 is a reply to message #1795175] Wed, 19 September 2018 11:59 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Marzieh,

Running EtlStandaloneExample.java produces the following exception in my setup:

Exception in thread "main" Property 'extends' not found in object org.eclipse.emf.ecore.impl.DynamicEObjectImpl@4d95d2a2 [eClass: org.eclipse.emf.ecore.impl.EClassImpl@53f65459 [name: Model] [instanceClassName: null] [abstract: false, interface: false]]
	at (unknown@0:0-0:0)
	at (/Users/dkolovos/Projects/Eclipse/eclipse-modeling-photon-r/runtime-New_configuration/MinimalExample/bin/etl/OO2DB.etl@49:1-67:2)
	at (/Users/dkolovos/Projects/Eclipse/eclipse-modeling-photon-r/runtime-New_configuration/MinimalExample/bin/etl/OO2DB.etl@49:5-49:28)
	at (/Users/dkolovos/Projects/Eclipse/eclipse-modeling-photon-r/runtime-New_configuration/MinimalExample/bin/etl/OO2DB.etl@49:5-49:16)


The reason is that in line 188, "Element" is an instance of Model as opposed to an instance of Class.

Cheers,
Dimitris
Re: Run Etl [message #1795447 is a reply to message #1795263] Sat, 22 September 2018 20:56 Go to previous messageGo to next message
Marzieh ghorbani is currently offline Marzieh ghorbaniFriend
Messages: 33
Registered: September 2017
Member
Hello Dimitris Kolovos,

Thank you for all help . I could running the rule directly.

Best Regards,
Marzieh
Re: Run Etl [message #1796151 is a reply to message #1795447] Sat, 06 October 2018 12:36 Go to previous messageGo to next message
Marzieh ghorbani is currently offline Marzieh ghorbaniFriend
Messages: 33
Registered: September 2017
Member
Hello Dimitris,
Consider the "oo2db.etl" transformation. I run the "SingleValuedAttribute" and "Class2Table" directly by using the Transform(..) method.
TargetMode's picture and source model were attached[1]. As the picture shows, column "LastName" has not been added to "Table Employee". I think the problem is that the command "c.table::=a.owner" in "oo2DB.etl" file does not run. I can't fix it. Could you please guide me?
Best Regards,
Marzieh

[Updated on: Fri, 12 October 2018 20:19]

Report message to a moderator

Re: Run Etl [message #1796334 is a reply to message #1796151] Thu, 11 October 2018 06:32 Go to previous messageGo to next message
Marzieh ghorbani is currently offline Marzieh ghorbaniFriend
Messages: 33
Registered: September 2017
Member
Hello Dimitris,

I know that problem is related to the running order of the rules. Is there a way to determine the running order of rules in general ?

Best Regards,
Marzieh
Re: Run Etl [message #1796399 is a reply to message #1796334] Fri, 12 October 2018 12:10 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Marzieh,

Apologies for the slow response; the last couple of weeks have been frantic. In ETL rules are executed in the order in which they are declared in the tranformation. I'll try to have a closer look at the example you submitted early next week.

Cheers,
Dimitris
Re: Run Etl [message #1797648 is a reply to message #1796399] Sat, 03 November 2018 20:06 Go to previous messageGo to next message
Marzieh ghorbani is currently offline Marzieh ghorbaniFriend
Messages: 33
Registered: September 2017
Member
Hello Dimitris,
Thank you for your answer. Yes that's right, also I know that the ETL engine maintains internal traceability links to compute equivalent[s]().but I want to run the "SingleValuedAttribute" directly with using the Transform(..) method. Due to command"c.table ::= a.owner", first I run the "Class2Table" directly with using the Transform(..) then I run "SingleValuedAttribute" directly with using the Transform(..) ,but the created Target Model is wrong [1]. Actually in the command "c.table ::= a.owner" , the equivalent of" a.owner" isn't detected and the Property "Table" for the Column "firstName" isn't set, Can you guide me to create the target model correctly?

The minimal example and SourceMode's picture are attached .

Best Regards
Marzieh

[Updated on: Wed, 07 November 2018 14:40]

Report message to a moderator

Re: Run Etl [message #1798161 is a reply to message #1797648] Tue, 13 November 2018 13:53 Go to previous messageGo to next message
Marzieh ghorbani is currently offline Marzieh ghorbaniFriend
Messages: 33
Registered: September 2017
Member
Hello all
Does any one know the answers of my questions?

Best Regards
Marzieh
Re: Run Etl [message #1798178 is a reply to message #1798161] Tue, 13 November 2018 16:26 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Marzieh,

After adding your models to the transformation's model repository you'll also need to change the transformation strategy as follows:

...
etlmodule.getContext().getModelRepository().addModel(DB);
etlmodule.getContext().getModelRepository().addModel(OO2DB);
etlmodule.getContext().setTransformationStrategy(new DefaultTransformationStrategy());
...


also, since you're creating target elements in your Java code, you need to register them with the transformation trace:

...
DB.getResource().getContents().add(eObject);
DB.getResource().getContents().add(eObject1);
etlmodule.getContext().getTransformationTrace().add(Element, targets, tr);
...


I hope this helps.

Cheers,
Dimitris

[Updated on: Tue, 13 November 2018 16:27]

Report message to a moderator

Re: Run Etl [message #1798354 is a reply to message #1798178] Fri, 16 November 2018 05:31 Go to previous message
Marzieh ghorbani is currently offline Marzieh ghorbaniFriend
Messages: 33
Registered: September 2017
Member
Hello Dimitris,

Thank you very much .

Best Regards
Marzieh
Previous Topic:Creating a Simulink Model From Epsylon
Next Topic:call java tool from epsilon
Goto Forum:
  


Current Time: Thu Mar 28 23:36:03 GMT 2024

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

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

Back to the top