[QVTo] How models from QVT conforms to models from EMF ? [message #721644] |
Fri, 02 September 2011 12:17 |
|
Hi everybody
I would like to know how the "mapping" from EMF models to "QVT models" is done. I mean - I would like to know exactly how to make an EMF model for using it in QVT like something like this:
metamodel ABC {
class A {
b_elems : Sequence(B);
contains c_elemnt : Sequence(C);
}
class B {
str: String;
int: Integer;
bool : Boolean;
}
class C extends B {
a_set : Set(A);
}
}
(this is QVT-like metamodel description)
1. How to implement "sequence" in EMF ?
2. How to implement "set" in EMF ?
(exactly: could you show me an example of EMF metamodel that conforms to my example ?)
Edit:
I will have to use dynamic models and metamodels if it makes a difference (I mean: created from scratch in my Java code).
Thanks in advance
Greetings,
Piotr Zajączkowski
[Updated on: Fri, 02 September 2011 12:18] Report message to a moderator
|
|
|
(no subject) [message #722079 is a reply to message #721644] |
Sun, 04 September 2011 09:37 |
Ed Willink Messages: 7675 Registered: July 2009 |
Senior Member |
|
|
Hi Piotr
Understanding this is currently aggravated by an OCL/UML inconsistency,
that may be resolved in the next version.
UML: T[*]{ordered, unique} == OCL: OrderedSet(T)
UML cannot declare nested collections, OCL can; Sequence(Set(String)).
OCL cannot declare bounded collections, UML can; String[2..4] {ordered}.
Ecore and UML are similar (except that Ecore has EString rather than
String etc and in practice all collections are realised by EList<T>).
You can see the EMF types by creating a simple Ecore model, so for
Sequence, create
class X
{
property names : String[*] { ordered, !unique }
}
and then genmodeling to produce Java code.
You may find the OCLinEcore editor convenient for textual model definition.
Regards
Ed Willink
On 02/09/2011 13:17, Piotr aj?czkowski wrote:
> Hi everybody :)
>
> I would like to know how the "mapping" from EMF models to "QVT models"
> is done. I mean - I would like to know exactly how to make an EMF
> model for using it in QVT like something like this:
>
>
> metamodel ABC {
> class A {
> b_elems : Sequence(B);
> contains c_elemnt : Sequence(C);
> }
> class B {
> str: String;
> int: Integer;
> bool : Boolean;
> }
> class C extends B {
> a_set : Set(A);
> }
> }
>
> (this is QVT-like metamodel description)
>
> 1. How to implement "sequence" in EMF ?
> 2. How to implement "set" in EMF ?
> (exactly: could you show me an example of EMF metamodel that conforms
> to my example ?)
>
> Thanks in advance :)
>
> Greetings,
> Piotr Zajączkowski
|
|
|
Powered by
FUDForum. Page generated in 0.03389 seconds