|
|
|
Re: Run Etl [message #1792294 is a reply to message #1791121] |
Sat, 14 July 2018 18:22 |
|
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 #1792304 is a reply to message #1792303] |
Sun, 15 July 2018 19:07 |
|
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 #1792455 is a reply to message #1792454] |
Wed, 18 July 2018 09:01 |
|
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 |
Marzieh ghorbani 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 #1793234 is a reply to message #1793231] |
Wed, 01 August 2018 23:35 |
|
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 #1793318 is a reply to message #1793315] |
Fri, 03 August 2018 22:29 |
|
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 #1793690 is a reply to message #1793623] |
Tue, 14 August 2018 08:03 |
|
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 #1794354 is a reply to message #1793731] |
Wed, 29 August 2018 13:12 |
|
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 #1795139 is a reply to message #1794885] |
Sun, 16 September 2018 17:48 |
|
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 #1795263 is a reply to message #1795175] |
Wed, 19 September 2018 11:59 |
|
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 #1796151 is a reply to message #1795447] |
Sat, 06 October 2018 12:36 |
Marzieh ghorbani 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 #1796399 is a reply to message #1796334] |
Fri, 12 October 2018 12:10 |
|
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 |
Marzieh ghorbani 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 #1798178 is a reply to message #1798161] |
Tue, 13 November 2018 16:26 |
|
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
|
|
|
|