Begin relative new to EMF I can only give sketch of what I want to do. The end product is a eclipse plug-in that have access to at least two EMF models. The first model is created by using Xtext to defined DSL. The second EMF is created using xtend code based on a ecore model.
My questions:
How to create a ecore model that will be visible in the plug in?
How to create an EMF instance of the ecore model using java/xtend when the code is executed in the plug in. The code snippets I find look like
val resourceSet = new ResourceSetImpl
val resource = resourceSet.getResource(URI.createURI(file), true)
but have no idea what the value of file must be to reference the ecore model.
any suggestion of how to translate the one EMF model to the other EMF model.
If I understand correctly, what you want to have is a model in your plug-in that's deployed in your end product. In that case you probably want to look at "platform:/plugin/..." URIs which you can probably use to retrieve artefacts from the running platform.
See URI.createURI(String) although you may want to look at URI.createPlatformPluginURI in your case
Search for Model-to-Model transformations, which you can specify with a variety of technologies (including Java, Xtend, ATL, etc.)
Related
I want to build a model similar to sciSpacy, but for another domain. How should I go about this?
You'll have to first make sure you have enough training data about your new domain. If you want to have a Named Entity Recognizer, you need texts annotated with named entities. If you want to have a parser, you need texts with dependency annotations. If you want a POS tagger, you need texts annotated with POS tags, etc.
Then you can create a new blank model, add the component(s) to them you need, and start training those:
nlp = spacy.blank("fr")
ner = nlp.create_pipe("ner")
nlp.add_pipe(ner)
ner.add_label("MY_DOMAIN_LABEL")
nlp.begin_training()
nlp.update(texts, annotations, drop=0.2)
This code snippet is not complete, because it really depends on what exactly it is you want to do. You can find more complete snippets in the documentation: https://spacy.io/usage/training
You might also be interested in the command-line utility to train new models, cf https://spacy.io/api/cli#train
I am developing a plugin for Eclipse Mars.2. I want to know if it is possible to create Example EMF Model Creation Wizards file programmatically and add data to the generated model file. Is it possible ?
EDIT
I have defined an ecore model that I use to create an Example EMF Model Creation Wizards file but I would like to do that automatically. My problem is that when I generate a file with all the correct data in it, I can't use it and navigate through the data. I have to copy the text data into a file created with the Eclipse wizard to make it work. This file is then interpreted by a Sirius diagram/table definition to create a graphical view.
Not sure what the question actually is, so taking it literally I say you can use the EMF APIs to create models programmatically. This has nothing to do with the wizards though.
So.. I’m trying to work with both Modelio and Overture but both programs is really new to me.
I want to make a model in Modelio as a first, and then export it to Overture.
But is it supposed to work this way, or am I supposed to make it separately?
I suppose that you intend to use Modelio to create a Class Diagram with some classes and then export this diagram to EMF UML which can be imported in Overture. Overture will then create VDM classes matching the class defined in the class diagram.
To convert a UML class diagram model to a VDM++ model, you first need to export the UML
model from Modelio to the Eclipse XMI format, called UML using the EMF UML3.0.0 format.
At the moment, Modelio is the only UML tool supported. In particular, the exported UML models
have been tested using Modelio 3.3.1.
Exporting: Right-click a VDM++ or VDM-RT project to access a submenu for UML Transformation.
From here it is possible to Convert to UML. The resulting .uml file will be saved
to the generated folder of your project.
Importing: To perform a UML import you must have the .uml file in the relevant project folder.
You can either copy it manually or use the Eclipse Import - File System feature. Afterwards,
it is possible to right-click the .uml file and choose the submenu for UML Transformation
and then select Convert to VDM
See the Overture userguide for further information
I guess that you want to use both Modelio and Overture for vdmrt coding.
In this case the ideal way to work would be to make a model in Modelio and then export it as vdmrt classes and use them in Overture as Modelio works with Eclipse/Java. Unfortunatly Mdoelio doesn not provide any generation/reverse facilities for vdmrt...
But Modelio and Overture can work together for CPS modelling. This is INTO-CPS project aim. In this project, both Modelio and Overture provide FMI facilities which allow them to define CPS simulation. If you want more info please let me know.
Is it possible to generate XML file from Shape example in GEF,Same as its getting generated in GMF?
Like in GMF if we select GMF Design page and open it with XML file,it provides all external information about model figures,same like i want to generate with GEF.
There is really no connections between the GEF and the way of persistance of it's domain model.
Here is two possible solutions:
1. If you domain model are plain java objects (POJOs) try using JAXB, and annotate them with JAXB annotations.Then use JAXB to persist them.
2. Switch to using EMF (which will provide you XML serrialization out of the box) and probably to GMF.
For just Shapes Example - there is a EMF - driven Shapes Example which will serrialize model to XMI, but that can be easily changed to XML.
In GMF you get automatic XML serialization since GMF is build on top EMF and GMF, using EMF as the model and GEF as the MVC framework. Editors that use GEF only must take care of serialization however they like.
With EMF I can import an ecore file (metamodel), generate the code then debug the project as a new eclipse instance to play with my model instance. My purpose is to create my instance without loading a new eclipse instance, for example I would like to create a new Java project that use my generated code to create the instance assuming that I'll do some validation/OCL to have an instance that I can serialize to an XMI file.
I was thinking about export the generated code (Model, Edit, Editor) to a JAR file or as a plugin, but it didn't work perfectly. Do you have any suggestion or HowTo?
I am not sure what you mean by "without loading a new eclipse instance", but if you want to get rid of the EMF and Eclipse-dependencies you can achieve this by editing your genmodel. This recipe explains the steps in detail: http://wiki.eclipse.org/EMF/Recipes#Recipe:_Generating_Pure_API_With_No_Visible_EMF_Dependencies
Not everything EMF has to offer will work with this solution, but it might be sufficient for what you want.