Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVTO] How to remove an element completely?
[QVTO] How to remove an element completely? [message #501323] Tue, 01 December 2009 20:52 Go to next message
Eclipse UserFriend
Originally posted by: vanbeerst.gmail.com

This is a multi-part message in MIME format.
--------------070701030907080000060406
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I was wondering if it is possible to remove an element completely. I
have tried the destroy() - method, but even though it does remove the
element from the root model element, the element is still there, but now
it has become a root element itself. How do I get rid of an element
completely?

In attachment I have added a simple transformation which adds a class
and then removes it again. When you run this with an empty model, you
can see, after running it, that a class is added as root element of the
input file.

Dear regards,
Tony.

--------------070701030907080000060406
Content-Type: text/plain;
name="test.qvto"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="test.qvto"

aW1wb3J0IFJvbGVMaWI7Cm1vZGVsdHlwZSBVTUwgInN0cmljdCIgdXNlcyB1 bWwoJ2h0dHA6
Ly93d3cuZWNsaXBzZS5vcmcvdW1sMi8zLjAuMC9VTUwnKTsKCnRyYW5zZm9y bWF0aW9uIHRl
c3QoaW5vdXQgbW9kZWwgOiBVTUwpCmFjY2VzcyBsaWJyYXJ5IFJvbGVMaWIo VU1MKTsKCm1h
aW4oKSB7Cgl2YXIgcm9vdCA6PSBtb2RlbC5yb290T2JqZWN0cygpW01vZGVs XS0+YW55KHRy
dWUpOwoJcm9vdC5tYXAgYWRkQ2xhc3MoKTsKCglyb290LnJlbW92ZUNsYXNz KCk7Cn0KCm1h
cHBpbmcgaW5vdXQgTW9kZWw6OmFkZENsYXNzKCkgOiBDbGFzcwp7Cglpbml0 Cgl7CgkJcmVz
dWx0IDo9IG9iamVjdCBDbGFzc3sgbmFtZSA6PSAibmV3Q2xhc3MiIH07Cgl9 CgkKCXNlbGYu
cGFja2FnZWRFbGVtZW50ICs9IHJlc3VsdDsKfQoKcXVlcnkgTW9kZWw6OnJl bW92ZUNsYXNz
KCkKewoJc2VsZi5wYWNrYWdlZEVsZW1lbnRbQ2xhc3NdLT5hbnkodHJ1ZSku ZGVzdHJveSgp
Owp9
--------------070701030907080000060406--
Re: [QVTO] How to remove an element completely? [message #501329 is a reply to message #501323] Tue, 01 December 2009 20:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vanbeerst.gmail.com

This is a multi-part message in MIME format.
--------------080205030807050806080709
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

woops, forgot to remove the import from the transformation in previous
attachment, in attachment to this message is another version without the
'RoleLib' import.

Dear regards,
Tony.

--------------080205030807050806080709
Content-Type: text/plain;
name="test.qvto"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="test.qvto"

bW9kZWx0eXBlIFVNTCAic3RyaWN0IiB1c2VzIHVtbCgnaHR0cDovL3d3dy5l Y2xpcHNlLm9y
Zy91bWwyLzMuMC4wL1VNTCcpOwoKdHJhbnNmb3JtYXRpb24gdGVzdChpbm91 dCBtb2RlbCA6
IFVNTCk7CgptYWluKCkgewoJdmFyIHJvb3QgOj0gbW9kZWwucm9vdE9iamVj dHMoKVtNb2Rl
bF0tPmFueSh0cnVlKTsKCXJvb3QubWFwIGFkZENsYXNzKCk7CgoJcm9vdC5y ZW1vdmVDbGFz
cygpOwp9CgptYXBwaW5nIGlub3V0IE1vZGVsOjphZGRDbGFzcygpIDogQ2xh c3MKewoJaW5p
dAoJewoJCXJlc3VsdCA6PSBvYmplY3QgQ2xhc3N7IG5hbWUgOj0gIm5ld0Ns YXNzIiB9OwoJ
fQoJCglzZWxmLnBhY2thZ2VkRWxlbWVudCArPSByZXN1bHQ7Cn0KCnF1ZXJ5 IE1vZGVsOjpy
ZW1vdmVDbGFzcygpCnsKCXNlbGYucGFja2FnZWRFbGVtZW50W0NsYXNzXS0+ YW55KHRydWUp
LmRlc3Ryb3koKTsKfQ==
--------------080205030807050806080709--
Re: [QVTO] How to remove an element completely? [message #501334 is a reply to message #501329] Tue, 01 December 2009 21:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dvorak.radek.gmail.com

Hi Tony,

Use model.removeElement(element) which is an operation defined on every
model (instance of modeltype) and is imported from the QVTO Standard
Library.

You actually call UML::Class::destroy() operation which is purely model
specific
and has nothing to do with QVTO.

Regards,
/Radek

On Tue, 01 Dec 2009 21:54:15 +0100, Tony Van Beers <vanbeerst@gmail.com>
wrote:

> woops, forgot to remove the import from the transformation in previous
> attachment, in attachment to this message is another version without the
> 'RoleLib' import.
>
> Dear regards,
> Tony.
Re: [QVTO] How to remove an element completely? [message #501347 is a reply to message #501334] Tue, 01 December 2009 21:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vanbeerst.gmail.com

Hi Radek,

Well, I still have a problem then, because I want to remove the element
in a query inside a library and in that library I do not have the model
and I've tried, but I am unable to pass the model as a parameter.

Regards,
Tony.

On 12/01/2009 10:30 PM, radek dvorak wrote:
> Hi Tony,
>
> Use model.removeElement(element) which is an operation defined on every
> model (instance of modeltype) and is imported from the QVTO Standard
> Library.
>
> You actually call UML::Class::destroy() operation which is purely model
> specific
> and has nothing to do with QVTO.
>
> Regards,
> /Radek
>
> On Tue, 01 Dec 2009 21:54:15 +0100, Tony Van Beers <vanbeerst@gmail.com>
> wrote:
>
>> woops, forgot to remove the import from the transformation in previous
>> attachment, in attachment to this message is another version without the
>> 'RoleLib' import.
>>
>> Dear regards,
>> Tony.
Re: [QVTO] How to remove an element completely? [message #501350 is a reply to message #501347] Tue, 01 December 2009 22:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dvorak.radek.gmail.com

Tony,

A query should be an operation without side effects and if you need
to modify a model, such a job should be done in a transformation.

To answer your issue, you may pass the model argument as the common
supertype
from the standard library:

helper foo(model : Model)

or

helper foo(model : Stdlib::Model)

The modeltype declaration is sort of private within the declaring module.
Checking for cross module conformance of modeltypes is based on the
referenced
metamodels, for instance when extending transformations.

What could be done in a library is a query that may select candidates for
deletion. The actually removal is better to do in a transformation.

Note, that you are still allowed by the compiler to do this, but better
to follow the rules. Once a stricter check is in place, you will have
easier situation.

Regards,
/Radek


On Tue, 01 Dec 2009 22:57:00 +0100, Tony Van Beers <vanbeerst@gmail.com>
wrote:

> Hi Radek,
>
> Well, I still have a problem then, because I want to remove the element
> in a query inside a library and in that library I do not have the model
> and I've tried, but I am unable to pass the model as a parameter.
>
> Regards,
> Tony.
>
> On 12/01/2009 10:30 PM, radek dvorak wrote:
>> Hi Tony,
>>
>> Use model.removeElement(element) which is an operation defined on every
>> model (instance of modeltype) and is imported from the QVTO Standard
>> Library.
>>
>> You actually call UML::Class::destroy() operation which is purely model
>> specific
>> and has nothing to do with QVTO.
>>
>> Regards,
>> /Radek
>>
>> On Tue, 01 Dec 2009 21:54:15 +0100, Tony Van Beers <vanbeerst@gmail.com>
>> wrote:
>>
>>> woops, forgot to remove the import from the transformation in previous
>>> attachment, in attachment to this message is another version without
>>> the
>>> 'RoleLib' import.
>>>
>>> Dear regards,
>>> Tony.
>
Re: [QVTO] How to remove an element completely? [message #511082 is a reply to message #501323] Fri, 29 January 2010 18:10 Go to previous messageGo to next message
mariam  is currently offline mariam Friend
Messages: 8
Registered: July 2009
Junior Member
Hi
I am trying to remove an element using qvto removeElement operation. It is working just fine.

However, I am having a problem that when ever I remove an element, the diagram that contained that element give me an error after executing the transformation.

Here is what the error says:
Could not open the editor: java.lang.Double incompatible with org.eclipse.draw2d.geometry.Rectangle

And when i delete the diagram and create a new one everything works fine. Is there a way to solve this problem. Meaning that when i remove an element say a state in UML state machine diagram, I want the diagram to be updated automatically.

Any help will be appreciated

Re: [QVTO] How to remove an element completely? [message #511300 is a reply to message #511082] Mon, 01 February 2010 08:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dvorak.radek.gmail.com

Hi Mariam,

It seems you run your transformation inside a GMF generated editor.
It's very likely that it's just a diagram editor problem which is hard
to answer from any QVTo point only.

Could you please try to execute a corresponding modification done by
plain Java code to isolate the issue?
To my knowledge, there is a specific way to perform domain model update
operations correctly in GMF.

Regards,
/Radek


On Fri, 29 Jan 2010 19:10:36 +0100, mariam <mariam_nouh@yahoo.com> wrote:

> Hi I am trying to remove an element using qvto removeElement operation.
> It is working just fine. However, I am having a problem that when ever I
> remove an element, the diagram that contained that element give me an
> error after executing the transformation.
>
> Here is what the error says:
> Could not open the editor: java.lang.Double incompatible with
> org.eclipse.draw2d.geometry.Rectangle
>
> And when i delete the diagram and create a new one everything works
> fine. Is there a way to solve this problem. Meaning that when i remove
> an element say a state in UML state machine diagram, I want the diagram
> to be updated automatically.
>
> Any help will be appreciated
>
>
Re: [QVTO] How to remove an element completely? [message #512634 is a reply to message #511300] Fri, 05 February 2010 17:21 Go to previous message
mariam  is currently offline mariam Friend
Messages: 8
Registered: July 2009
Junior Member
Thank you for your reply.
Yes you are right. I am using GMF editor.. Could you please point me to a link or simple tutorial about performing domain model update operations correctly in GMF. I tried to look for it but couldn't find any ..

Thanks

Previous Topic:[ATL] BPMN to BPEL, paternity problems for GatewayDataBasedExclusive/If
Next Topic:how o get eclipse plugi content and navigate its packages
Goto Forum:
  


Current Time: Tue Oct 22 22:38:29 GMT 2019

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

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

Back to the top