Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Non-EMF model as source for model-to-model transformation?
Non-EMF model as source for model-to-model transformation? [message #1705154] Wed, 12 August 2015 13:25 Go to next message
Florian Haupt is currently offline Florian HauptFriend
Messages: 5
Registered: February 2015
Junior Member
Hi all,

what is be the best approach if the source of a model-to-model transformation is not available as EMF model? As far as I understand, I cannot use ETL with non-EMF models.

Let me shortly describe my application scenario:

The input of the transformation is a JSON file (a JSON schema is also available) that is parsed into Java objects. The parser as well as the Java data model (POJOs) already exist. After reading data from JSON into Java, I would like to transform it using ETL. The target model for the transformation has been modeled using Eugenia, i.e. it is available as EMF model.

Any suggestions?

Thanks in advance,
Florian
Re: Non-EMF model as source for model-to-model transformation? [message #1705159 is a reply to message #1705154] Wed, 12 August 2015 13:43 Go to previous message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

You can use ETL (or any Epsilon tool) with non-EMF models. Epsilon uses a compatibility layer (the Epsilon Model Connectivity layer, IIRC) for supporting various modeling technologies, including EMF. Beyond EMF, other EMC drivers include pure XML files, spreadsheets, CSV files, GraphML diagrams, BibTeX files and so on.

For your particular case, I'd say there would be two options:


  • If you want to run ETL with a JSON input from the "Run Configurations..." dialog, you'll need to write your own JSON EMC driver. It's not too complicated, though. You can have a look at the source code for our org.eclipse.epsilon.emc.csv or org.eclipse.epsilon.emc.bibtex plugins.

  • If you're OK with running ETL from Java code, you can parse your JSON normally and then add the JSON objects and their classes to the model repository of the ETL module with the JavaModel EMC driver included in the org.eclipse.epsilon.eol.engine plugin. JavaModel is designed to work with collections of POJOs, I think.


For the second case, the code would look something like this:
List<Object> jsonObjects;
List<Class<?>> jsonClasses;
// ... populate jsonObjects with your own JSON parser, and list all the different possible classes in jsonClasses ...

EtlModule etlModule = new EtlModule();
etlModule.getContext().getModelRepository().addModel(new JavaModel("ModelName", jsonObjects, jsonClasses)));
// ... populate the rest of the model repository with the target models ...
etlModule.parse("path/to/your/etl");
etlModule.execute();


(Edit for rewording.)

[Updated on: Wed, 12 August 2015 13:52]

Report message to a moderator

Previous Topic:EGL editor warning
Next Topic:Best Eclipse(mar/Luna) for Epsilon
Goto Forum:
  


Current Time: Thu Mar 28 15:34:25 GMT 2024

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

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

Back to the top