3

I have an Xtext project and a couple of sample DSL files. I can open these files with "Sample Ecore Model Editor" and validate that it conforms to the metamodel generated by Xtext. However, I cannot create an "EMF Project" or an "EMF Generator Model" due to the fact that the DSL file is not recognized as Ecore.

My question is, how can I export an ecore from my example.dsl file?

P.S. I believe this is possible due to this fact

Pavlos
  • 73
  • 1
  • 7

1 Answers1

2

You have two ways to get your hands on ecore meta-model for your DSL

  • In standard wizard-generated Xtext-Project the ecore meta-model get derived from your grammar. The workflow generator saves generated meta-model into

    [Project]/src-gen/[your-package]/[grammar-name].ecore
    

    For example:

    org.xtext.example.mydsl/src-gen/org/xtext/example/mydsl/MyDsl.ecore
    
  • You can also write ecore meta-model yourself and use if with your grammar. This is not a simple process, but it provides more flexibility. For more information see: http://blog.efftinge.de/2009/11/xtext-using-existing-ecore-models.html

Boris Brodski
  • 8,425
  • 4
  • 40
  • 55
  • Thanks you for the fast reply. I know that *.ecore is generated in the path you specified. My problem is that I am willing to transform my model instance. Please see the helpful image below: http://imgur.com/mX4QjQW – Pavlos Mar 17 '13 at 12:22
  • 1
    Do you want to convert dsl to xmi? – Boris Brodski Mar 17 '13 at 12:35
  • 2
    Check this forum message: http://www.eclipse.org/forums/index.php/mv/msg/292631/801725/#msg_801725 Check the entire forum thread for more information – Boris Brodski Mar 17 '13 at 14:10
  • Thanks again. I will try the proposed solution. – Pavlos Mar 17 '13 at 17:42