Nmodels2Nmodels transformation [qvto] [message #834315] |
Sun, 01 April 2012 19:32  |
Eclipse User |
|
|
|
Hello everybody,
I want to perform an in-place qvto transformation on two input models where the transformation copy some elements from one model to the other. what is the best way to do that, tnx a million
|
|
|
Re: Nmodels2Nmodels transformation [qvto] [message #834752 is a reply to message #834315] |
Mon, 02 April 2012 10:55   |
Eclipse User |
|
|
|
Hi
QVTo has the ability to define inout models, so I guess that you could
define two inout models.
I've never understood the basic semantics of even one inout, so I cannot
advise on how best to do two.
Regards
Ed Willink
On 01/04/2012 20:32, sohaib soso wrote:
> Hello everybody,
>
> I want to perform an in-place qvto transformation on two input models
> where the transformation copy some elements from one model to the
> other. what is the best way to do that, tnx a million :d
|
|
|
|
Re: Nmodels2Nmodels transformation [qvto] [message #834970 is a reply to message #834886] |
Mon, 02 April 2012 16:16   |
Eclipse User |
|
|
|
In this situation I suspect a blackbox operation may be quicker or even
some pre-processing in EMF using the EcoreUtil.Copier. Otherwise
you'll need to implement a mapping for each class you want to copy with
the input/output as the same type, e.g.:
mapping A::a() : A{
attr1 := self.attr1;
attr2 := self.attr2;
ref1 := self.ref1.map B();
}
mapping B::b() : B{
// etc. etc.
}
If you just want a copy of some or all of the input elements it may be
simpler to build a set and pass it to a blackbox and let it make the
copies then pass them back. Alternatively if you know in advance build
the copies in Java code and pass them as an additional inout.
You need to make it inout if you're going to add any elements, when a
parameter is 'in' it will throw an exception if you try and add an
object to it.
Alan
On 2012-04-02 14:20:48 +0000, sohaib soso said:
> hi,
>
> I tried several in-place transformations but the challange here is "how
> to copy a set of input model elements to the other input model".Tnx
> anyway Edward.
|
|
|
Re: Nmodels2Nmodels transformation [qvto] [message #835046 is a reply to message #834970] |
Mon, 02 April 2012 18:24   |
Eclipse User |
|
|
|
hi Alan,
I will try the blackbox operation, by the way, beside the "Meta Object Facility (MOF) 2.0 Query/View/Transformation Specification" of OMG and the "QVT - Operational Mappings : Modellierung mit der Query Views Transformation" ebook, is there any qvt tutorial or books that you advice?.
|
|
|
Re: Nmodels2Nmodels transformation [qvto] [message #835063 is a reply to message #835046] |
Mon, 02 April 2012 18:46   |
Eclipse User |
|
|
|
On 02/04/2012 19:24, sohaib soso wrote:
> hi Alan,
> I will try the blackbox operation, by the way, beside the "Meta Object
> Facility (MOF) 2.0 Query/View/Transformation Specification" of OMG and
> the "QVT - Operational Mappings : Modellierung mit der Query Views
> Transformation" ebook, is there any qvt tutorial or books that you
> advice?.
Hi
I find the QVTo Simple UML to RDB example helpful.
[The lack of an ability to define a mapping as a potentially modified
copy is a limitation in all three QVT languages and a number of other
transformation langues as well.]
Regards
Ed Willink
|
|
|
|
Re: Nmodels2Nmodels transformation [qvto] [message #838414 is a reply to message #834315] |
Sat, 07 April 2012 02:33   |
Eclipse User |
|
|
|
hello again,this time Im gonna ask a quick noob question about ocl. If one has two elements A and B when A.oclistypeof(type) and type is the same ocltype of B, but obviously A<>B. how to compare A and B according to their type such that A=B is true (e.g. A.type=B.type)?
|
|
|
Re: Nmodels2Nmodels transformation [qvto] [message #838500 is a reply to message #838414] |
Sat, 07 April 2012 06:00   |
Eclipse User |
|
|
|
Hi
The OCL newsgroup is for OCL questions.
In principle it's
a,oclType() = b.oclType()
which is supported by the new -pivot-based OCL.
Earlier OCL's may support eClass() rather than oclType().
Regards
Ed Willink
On 07/04/2012 03:33, sohaib soso wrote:
> hello again,this time Im gonna ask a quick noob question :blush:
> about ocl. If one has two elements A and B when A.oclistypeof(type)
> and type is the same ocltype of B, but obviously A<>B. how to compare
> A and B according to their type such that A=B is true (e.g.
> A.type=B.type)?
|
|
|
Re: Nmodels2Nmodels transformation [qvto] [message #838613 is a reply to message #838500] |
Sat, 07 April 2012 10:27   |
Eclipse User |
|
|
|
Hi,
> The OCL newsgroup is for OCL questions.
yes you're right
> In principle it's
> a,oclType() = b.oclType()
I tried this but it's not suported and that's why I came here.I'm using eclipse indigo and ocl 3.1.0.
> which is supported by the new -pivot-based OCL.
> Earlier OCL's may support eClass() rather than oclType().
even eClass() didn't work.
tnx ED
Regards
Sohaib
|
|
|
Re: Nmodels2Nmodels transformation [qvto] [message #838627 is a reply to message #838613] |
Sat, 07 April 2012 10:53   |
Eclipse User |
|
|
|
Hi
eClass() used to work in Helios, but an EMF change, arguably a bug fix,
made EObject methods invisible.
See
http://wiki.eclipse.org/MDT/OCL/FAQ#How_do_I_invoke_methods_such_as_eContainer.28.29.2C_eContents.28.29.2C_eGet.28.29.3F
If your environment allows you to write Java you can set the
implicitRootClass option. Otherwise you can write a Java bloack box to
do eClass() for you.
Regards
Ed Willink
On 07/04/2012 11:27, sohaib soso wrote:
> Hi,
>
>> The OCL newsgroup is for OCL questions.
>
> yes you're right
>
>> In principle it's
>
>> a,oclType() = b.oclType()
>
> I tried this but it's not suported and that's why I came here.I'm
> using eclipse indigo and ocl 3.1.0.
>
>> which is supported by the new -pivot-based OCL.
>> Earlier OCL's may support eClass() rather than oclType().
>
> even eClass() didn't work.
> tnx ED
>
> Regards
>
> Sohaib
|
|
|
Re: Nmodels2Nmodels transformation [qvto] [message #838655 is a reply to message #838627] |
Sat, 07 April 2012 11:51   |
Eclipse User |
|
|
|
Another "hack" is to cast the object itself to be an EObject.
First make sure you've imported the Ecore metamodel:
modeltype ECORE "strict" uses 'http://www.eclipse.org/emf/2002/Ecore';
Then you could add a helper:
helper OclAny::equalsType(other : OclAny) : Boolean{
return self.oclAsType(ECORE::EObject).eClass() =
other.oclAsType(ECORE::EObject).eClass()
}
And this can be thus be called on your A and B objects as:
A.equalsType(B)
This is a bit of a hack but seems to work and doesn't require a
blackbox (and I use something similar for checking isSet on EAttributes
of primitive types)
Alan
On 2012-04-07 10:53:46 +0000, Ed Willink said:
> Hi
>
> eClass() used to work in Helios, but an EMF change, arguably a bug fix,
> made EObject methods invisible.
>
> See
> http://wiki.eclipse.org/MDT/OCL/FAQ#How_do_I_invoke_methods_such_as_eContainer.28.29.2C_eContents.28.29.2C_eGet.28.29.3F
>
>
> If your environment allows you to write Java you can set the
> implicitRootClass option. Otherwise you can write a Java bloack box to
> do eClass() for you.
>
> Regards
>
> Ed Willink
>
> On 07/04/2012 11:27, sohaib soso wrote:
>> Hi,
>>
>>> The OCL newsgroup is for OCL questions.
>>
>> yes you're right
>>
>>> In principle it's
>>
>>> a,oclType() = b.oclType()
>>
>> I tried this but it's not suported and that's why I came here.I'm using
>> eclipse indigo and ocl 3.1.0.
>>
>>> which is supported by the new -pivot-based OCL.
>>> Earlier OCL's may support eClass() rather than oclType().
>>
>> even eClass() didn't work.
>> tnx ED
>>
>> Regards
>>
>> Sohaib
|
|
|
|
Powered by
FUDForum. Page generated in 0.04135 seconds