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 15:52  |
Eclipse User |
|
|
|
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 #501347 is a reply to message #501334] |
Tue, 01 December 2009 16:57   |
Eclipse User |
|
|
|
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 17:20   |
Eclipse User |
|
|
|
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.
>
|
|
| | | |
Goto Forum:
Current Time: Wed Jul 23 13:51:42 EDT 2025
Powered by FUDForum. Page generated in 0.04376 seconds
|