|[EOL] Model objects manipulation (copying...) [message #1065765]
||Thu, 27 June 2013 12:31
| Gaëtan Pruvost
Registered: June 2013
I'm trying to make some operations upon models inside an EOL script and I need some guidance here. My problem should be common but I haven't seen anything in book/articles/forum about it.
A little background
I'm trying to copy a model IN to a model OUT. My eol script is run with both model described correctly in the eclipse run configuration.
I can't find a proper way of copying model instances. I tried the following Native tools:
EmfTool.getECoreUtil().copy(...my root in IN...);
I get a copy of instances but they still relate to the IN model (via owningModel()) and I can't change it.
var m = EmfTool.createModel2(...my root in IN..., "OUT", fileURI);
m.readOnLoad = false;
m.storedOnDisposal = true;
This one works to make the copy, the stored file is valid. However I can't navigate the model in the rest of the script. For instance, if I write OUT!A.all, I get zero instances even though my model has some.
Is my approach to the problem wrong, or have I missed a trivial solution to the problem?
- Could you give me pointers for java native tools? The article that introduces them doesn't give any doc of them and looking at the sources only lead me to uncertain guesses.
- I don't understand the behaviour of the OUT variable. How does the script engine resolve model names? It looks like it is dynamically resolved to an IModel instance based on the model repository. However, I checked in debug, my context seems to be ok.
Moreover, I don't get why the script crashes if I try to write m!A when m is an IModel variable and A a concept name.
Thanks a lot
[Updated on: Thu, 27 June 2013 12:35]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.03235 seconds