Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [qvto]how to transform undefined attributes
icon5.gif  [qvto]how to transform undefined attributes [message #800142] Thu, 16 February 2012 18:53 Go to next message
Allen Zhang is currently offline Allen ZhangFriend
Messages: 14
Registered: February 2012
Junior Member
If the meta model does not explicitly define the attribute of a node. e.g.:
M1: <A a1="a1" a2="a2" />

a1 is defined in the meta model, but a2 is not.

If I want to transform M1 to M2 (M1 and M2's meta model is the same),
M2: <A a1="a1" a2="a2" />

for a1:
a1 := self.a1

but how should I treat a2?

[Updated on: Thu, 16 February 2012 18:54]

Report message to a moderator

Re: [qvto]how to transform undefined attributes [message #800509 is a reply to message #800142] Fri, 17 February 2012 06:49 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4153
Registered: July 2009
Senior Member
Hi

Your question starts from a false premise. Meta-models always define
everything. This is the difference from XSD that can be woolly and
extensible.

If you need to transform something indeterminate then you must escalate
to something that is determinate, so you might use the XML meta-model so
that you can process what you find.

Regards

Ed Willink

On 16/02/2012 18:53, Allen Zhang wrote:
> If the mete model does not explicitly define the attribute of a node.
> e.g.:
> M1: <A a1="a1" a2="a2" />
>
> a1 is defined in the mete model, but a2 is not.
>
> If I want to transform M1 to M2 (M1 and M2's mete model is the same),
> M2: <A a1="a1" a2="a2" />
>
> for a1:
> a1 := self.a1
>
> but how should I treat a2?
>
Re: [qvto]how to transform undefined attributes [message #803957 is a reply to message #800509] Wed, 22 February 2012 02:38 Go to previous messageGo to next message
Allen Zhang is currently offline Allen ZhangFriend
Messages: 14
Registered: February 2012
Junior Member
Hi, thank you for the help.
The real problem is: when I transform from BPEL to BPEL, here is something like:
<bpel:process
...
xmlns:ns0="namespace1"
...>
...
<bpel:variable messageType="ns0:response" name="response"/>

when I do the transformation, I didn't take care of "ns0", but the namespace is generated automatically with a new name, which may be different from the original one.

<bpel:process
...
xmlns:ns1="namespace1" //new name is ns1
...>
...
<bpel:variable messageType="ns1:response" name="response"/>

Everything is ok by then, but next here is:
<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns0:p1]></bpel:query>

In the query, it is the original "ns0", not changed to "ns1".

Thank you again.
Re: [qvto]how to transform undefined attributes [message #804203 is a reply to message #803957] Wed, 22 February 2012 10:07 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4153
Registered: July 2009
Senior Member
Hi

What you obseerve is very reasonable. The text in a CDATA statement is
text, not a model reference, so when model definitions change it may
change. Just the same as people who reference Section 3.1.2 in a word
document without using Cross References.

If you use references they must be references.

If you really need the CDATA then you need to write a custom conversion
that provides the non-standard reference recognition in CDATA, and
ideally eliminates CDATA altogether..

Regards

Ed Willink

On 22/02/2012 02:38, Allen Zhang wrote:
> Hi, thank you for the help.
> The real problem is: when I transform from BPEL to BPEL, here is
> something like:
> <bpel:process ...
> xmlns:ns0="namespace1"
> ...>
> ...
> <bpel:variable messageType="ns0:response" name="response"/>
>
> when I do the transformation, I didn't take care of "ns0", but the
> namespace is generated automatically with a new name, which may be
> different from the original one.
>
> <bpel:process ...
> xmlns:ns1="namespace1" //new name is ns1
> ...>
> ...
> <bpel:variable messageType="ns1:response" name="response"/>
>
> Everything is ok by then, but next here is:
> <bpel:query
> queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns0:p1]></bpel:query>
>
> In the query, it is the original "ns0", not changed to "ns1".
>
> Thank you again.
>
Re: [qvto]how to transform undefined attributes [message #804788 is a reply to message #804203] Thu, 23 February 2012 02:00 Go to previous messageGo to next message
Allen Zhang is currently offline Allen ZhangFriend
Messages: 14
Registered: February 2012
Junior Member
Hi, besides the method you mentioned, is there any way I can control the transformation of these extended attributes like "ns0", I mean whether the new names of these attributes can be determined by myself using QVTo, but not automatically generated.
Re: [qvto]how to transform undefined attributes [message #804905 is a reply to message #804788] Thu, 23 February 2012 05:54 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4153
Registered: July 2009
Senior Member
Hi

"It's only software"; of course it's possible, but it's not something
that I would try to do so I can only point you in a plausible direction.

EMF has many options to control XML name generation; one of these is
probably helpful once you know the problem to solve.

Something somewhere chose "ns1" rather than "ns0"; this seems an odd
choice, since I would expect a unique namespace generator to move from
"ns0" to "ns01" or "ns0_1" if it decided "ns0" was already in use. I
would certainly start by discovering why "ns1" was chosen; then this
choice can perhaps be controlled or it's failure to re-use "ns0" rectified.

The code to look at is XMLSave... and XMLHelper...

Regards

Ed Willink

On 23/02/2012 02:00, Allen Zhang wrote:
> Hi, besides the method you mentioned, is there any way I can control
> the transformation of these extended attributes like "ns0", I mean
> whether the new names of these attributes can be determined by myself
> using QVTo, but not automatically generated.
Previous Topic:[ATL] Compiling ATL files to ASM in build system
Next Topic:[ATL] How to know type of a model element in condition of matched rule
Goto Forum:
  


Current Time: Tue Nov 25 23:31:46 GMT 2014

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

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