[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.epsilon] Re: Help on the steps to follow for a model composition.

Hi Juan-Pedro,

ECL is used in order to establish a match trace (i.e. the correspondences on which EML can then merge the models). Since you already have an intermediate model, you can use ECL to "transform" it to a match trace.

So if your metamodels are:

-- A.emf --

class A {
  attr String name;
}

-- B.emf --

class B {
  ref A a;
  attr String annotation;
}

-- C.emf --

class C {
  attr String name;
}

your ECL comparison will look something like this:

rule AB
  match a : AModel!A
  with b : BModel!B {

  compare {
    return b.a = a;
  }
}

and your EML merging will look like this:

rule AB2C
  merge a : AModel!A
  with b : BModel!B
  into c : CModel!C {

  c.name = a.name + '_' b.annotation;
}

Hope this helps. If not, please let me know.

Cheers,
Dimitris

Juan Pedro Silva wrote:
Hi everybody.
I'm taking my first steps with Epsilon (EML mostly), and I'm trying to compose Model A (from Metamodel A) and Model B (from Metamodel B) into Model C (from Metamodel C). Two inputs, one output, three different metamodels.
I have already defined the metamodels, the emfatic file with the relationships between the input metamodels, and generated the correspondent ecore model. I also created a ".modelink" indicating the elements I want to combine (merge).
Now I'm wondering how to continue.


To launch a model merge I need the ".eml" that tells epsilon the source (base), the aspect, and the target.
I guess I can add the ".modelink" (actually, the model with the relationships resulting from it) as input, and according to the relationships modeled in it make the ".eml" merge elements from A with elements from B into C. Am I right?.


However, I'm not sure on what to do with the ".ecl" matching.
Do I have to make rules for matching elements in Model A with elements in Model B?, or for matching elements in Model A with elements in Model C, and then rules for matching elements in Model B with elements in Model C?.


Which is the correct strategy to make such a composition?.
Thanks in advance.
Regards,
            Juan Pedro