Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » Nmodels2Nmodels transformation [qvto](in-place transformation with two input models)
Nmodels2Nmodels transformation [qvto] [message #834315] Sun, 01 April 2012 19:32 Go to next message
sohaib soso is currently offline sohaib sosoFriend
Messages: 33
Registered: March 2012
Member
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 Very Happy
Re: Nmodels2Nmodels transformation [qvto] [message #834752 is a reply to message #834315] Mon, 02 April 2012 10:55 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7680
Registered: July 2009
Senior Member
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 #834886 is a reply to message #834752] Mon, 02 April 2012 14:20 Go to previous messageGo to next message
sohaib soso is currently offline sohaib sosoFriend
Messages: 33
Registered: March 2012
Member
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 #834970 is a reply to message #834886] Mon, 02 April 2012 16:16 Go to previous messageGo to next message
Alan McMorran is currently offline Alan McMorranFriend
Messages: 55
Registered: July 2009
Member
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 Go to previous messageGo to next message
sohaib soso is currently offline sohaib sosoFriend
Messages: 33
Registered: March 2012
Member
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 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7680
Registered: July 2009
Senior Member
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 #835228 is a reply to message #835046] Tue, 03 April 2012 00:17 Go to previous messageGo to next message
sohaib soso is currently offline sohaib sosoFriend
Messages: 33
Registered: March 2012
Member
I found a way to do the copy in my case without using blackbox (qvto mappings), however, I dont know if it works for all similar situations or just for my two specific input models?
Re: Nmodels2Nmodels transformation [qvto] [message #838414 is a reply to message #834315] Sat, 07 April 2012 02:33 Go to previous messageGo to next message
sohaib soso is currently offline sohaib sosoFriend
Messages: 33
Registered: March 2012
Member
hello again,this time Im gonna ask a quick noob question Embarrassed 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 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7680
Registered: July 2009
Senior Member
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 Go to previous messageGo to next message
sohaib soso is currently offline sohaib sosoFriend
Messages: 33
Registered: March 2012
Member
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 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7680
Registered: July 2009
Senior Member
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 Go to previous messageGo to next message
Alan McMorran is currently offline Alan McMorranFriend
Messages: 55
Registered: July 2009
Member
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
Re: Nmodels2Nmodels transformation [qvto] [message #838707 is a reply to message #838655] Sat, 07 April 2012 13:58 Go to previous message
sohaib soso is currently offline sohaib sosoFriend
Messages: 33
Registered: March 2012
Member
Hi Alan,
I just wanna say: "you are a Very Happy hero"

Previous Topic:[QVTO] Run transformation via extension point "org.eclipse.m2m.qvt.oml.runtime.qvtTransformatio
Next Topic:[QVT] not keyword recognized as a keyword
Goto Forum:
  


Current Time: Mon Dec 09 03:36:18 GMT 2024

Powered by FUDForum. Page generated in 0.05267 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top