ETL - Reuse trace model from one phase as source model in another phase [message #1773205] |
Sat, 23 September 2017 21:56  |
Eclipse User |
|
|
|
Hello,
I am using ETL to transform a SysML model into another ecore model generating with it a trace model similar to the example:
https://eclipse.org/epsilon/examples/index.php?example=org.eclipse.epsilon.examples.oo2db
In a later step, I want to use the generated trace model and the ecore model from the previous transformation along with the same SysML model as source models, so that, when encountering an element in the SysML model, I can get its equivalent in the ecore model by matching the element with as a source in the trace model and get its targets.
My problem is: ETL and EOL engines do not see the elements from SysML model as equal to the elements in the trace model, even though, the in the trace model file composed of the matches the values in the SysML model.
Appreciate your assistance.
Thank you.
|
|
|
|
Re: ETL - Reuse trace model from one phase as source model in another phase [message #1775510 is a reply to message #1773473] |
Tue, 31 October 2017 04:13  |
Eclipse User |
|
|
|
Hi,
A simple "equals" (i.e. sysmlElement == traceElement.sysmlref) will not see them as equal as each is loaded into a separate memory space and core (emf) equals implementation just calls the equals() method on java.lang.Object and that compares memory addresses. If the elements in the SysML model have a unique id (i.e. an attribute that is marked as isId) then you can use that value to find matching elements in the trace model. Something in the lines of:
var sysmlElement = sysml!Block.all.select(b | b.name == "myBlock");
var traceElement = trace!TraceElement.all.selectOne(te | te.sysmlref.id == sysmlElement.id);
var ecoreElement = traceElement.ecoreref;
Cheers,
|
|
|
Powered by
FUDForum. Page generated in 0.04490 seconds