Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVTo] Generate XMI with multiple namespaces
[QVTo] Generate XMI with multiple namespaces [message #739527] Mon, 17 October 2011 15:19 Go to next message
Daniel Engelhardt is currently offline Daniel EngelhardtFriend
Messages: 11
Registered: November 2010
Junior Member
Hello,

I would like to write a QVT transformation in Eclipse Indigo that accomplishes the following:

I have an Input Meta-Model, lets call it In.ecore (which is generated from an xsd file).

I have two Output Meta-Models, Out_includes_A.ecore and Out_included_B.ecore, which are also generated from two different xsd description files. These xsd files import one another, or to be more precise Out_includes_A includes Out_included_B.
In the Ecore models, I could deal with these references either by implementing Attributes of type AnySimpleType or something, or by using references to the types in the other Meta-Model. I decided to go with the second option, which might be wrong already.

Now, I wrote a QVT transformation that should create an output model (out.xmi) something like

<node xmlns:BBB="http:SLASHSLASHwww.BBB.orgSLASHBBB"
  xmlns="http:SLASHSLASHwww .AAA.orgSLASHAAA">
   <something_from_AAA name="xxx" />
   <BBB:something_from_BBB </> 
</node>


However, that's not what I get. Instead, the second namespace is completely disregarded (in a sense). I get something like
<node xmlns="http:SLASHSLASHwww .AAA.orgSLASHAAA">
   <something_from_AAA name="xxx" />
   <BBBsomething_from_BBB </> 
</node>

where BBBsomething_from_BBB was the name given to the reference Element in the node-part of the AAA-Input Meta-Model. The Extended Meta Data references are correct (they point to the correct namespace).

The QVT transformation looks like
transformation Input2AAA(in a : Input, out : AAA);

i.e. the Output model is of type AAA, maybe this is my mistake.


So, my question is: what do I need to do, to accomplish the behavour I want? My problem is, I don't really know where to start. Is it an Ecore Problem? Should I somehow try to combine both output metamodels into one? Should I use AnyType-based solutions? Or are my Extended Meta Data references broken? Or should I go about my QVT transformation in a different way? Or is it a problem with the xsd importer?

I have worked with all of these tools quite a lot, but my understanding of them is not very deep, as one can surely see easily. And I left out quite a lot of information. What kind of information would you need in order to answer these questions above?

Is there a standard way to go about this? I googled but I could not come up with a lot, concerning multiple namespaces in xsd and there handling Ecore and in the M2M tooling.

Thank you very much in advance for your help. It is deeply appreciated!

Best regards,
Daniel
Re: [QVTo] Generate XMI with multiple namespaces [message #739584 is a reply to message #739527] Mon, 17 October 2011 16:17 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Daniel

I recommend separating your concerns.

Most of the Eclipse Modeling tools support Ecore, and QVTo supports
Ecore to Ecore transformations.

EMF provides XSD import and export capabilities for Ecore files that are
then used by other tools, so find out which of

a) XSD2Ecore
b) Ecore2Ecore
c) Ecore2XSD

does not do as you want and then fix it. Each stage has plenty of
configuration capabilities and opportunities for errors.

Regards

Ed Willink


On 17/10/2011 16:19, daniel.engelhardt wrote:
> Hello,
>
> I would like to write a QVT transformation in Eclipse Indigo that
> accomplishes the following:
>
> I have an Input Meta-Model, lets call it In.ecore (which is generated
> from an xsd file).
>
> I have two Output Meta-Models, Out_includes_A.ecore and
> Out_included_B.ecore, which are also generated from two different xsd
> description files. These xsd files import one another, or to be more
> precise Out_includes_A includes Out_included_B.
> In the Ecore models, I could deal with these references either by
> implementing Attributes of type AnySimpleType or something, or by
> using references to the types in the other Meta-Model. I decided to go
> with the second option, which might be wrong already.
>
> Now, I wrote a QVT transformation that should create an output model
> (out.xmi) something like
>
> <node xmlns:BBB="http:SLASHSLASHwww.BBB.orgSLASHBBB"
> xmlns="http:SLASHSLASHwww .AAA.orgSLASHAAA">
> <something_from_AAA name="xxx" />
> <BBB:something_from_BBB </> </node>
>
>
> However, that's not what I get. Instead, the second namespace is
> completely disregarded (in a sense). I get something like
> <node xmlns="http:SLASHSLASHwww .AAA.orgSLASHAAA">
> <something_from_AAA name="xxx" />
> <BBBsomething_from_BBB </> </node>
>
> where BBBsomething_from_BBB was the name given to the reference
> Element in the node-part of the AAA-Input Meta-Model. The Extended
> Meta Data references are correct (they point to the correct namespace).
>
> The QVT transformation looks like
>
> transformation Input2AAA(in a : Input, out : AAA);
>
> i.e. the Output model is of type AAA, maybe this is my mistake.
>
>
> So, my question is: what do I need to do, to accomplish the behavour I
> want? My problem is, I don't really know where to start. Is it an
> Ecore Problem? Should I somehow try to combine both output metamodels
> into one? Should I use AnyType-based solutions? Or are my Extended
> Meta Data references broken? Or should I go about my QVT
> transformation in a different way? Or is it a problem with the xsd
> importer?
>
> I have worked with all of these tools quite a lot, but my
> understanding of them is not very deep, as one can surely see easily.
> And I left out quite a lot of information. What kind of information
> would you need in order to answer these questions above?
>
> Is there a standard way to go about this? I googled but I could not
> come up with a lot, concerning multiple namespaces in xsd and there
> handling Ecore and in the M2M tooling.
>
> Thank you very much in advance for your help. It is deeply appreciated!
>
> Best regards,
> Daniel
Re: [QVTo] Generate XMI with multiple namespaces [message #742446 is a reply to message #739584] Thu, 20 October 2011 13:55 Go to previous messageGo to next message
Daniel Engelhardt is currently offline Daniel EngelhardtFriend
Messages: 11
Registered: November 2010
Junior Member
Hi Edward,

thank you very much for your post.

As I tried to dig deeper, I could reduce the problem so far, by going through your list backwards:

If I use the Ecore files produced from the XSD2Ecore importer, and create a dynamic instance, I already get the problem. The resulting XMI file does not contain the namespace information I need.

So, it's not a M2M problem and I am in the wrong forum to begin with. It's an Ecore problem.

But I begin to wonder if it is even possible to create an XMI file (via dynamic instances out of one Ecore file) that contains references using namespaces to another Ecore.

I.e. my question is on how to create something like:
 <node xmlns:BBB="http:SLASHSLASHwww.BBB.orgSLASHBBB"
  xmlns="http:SLASHSLASHwww .AAA.orgSLASHAAA">
 <AAA:something_from_AAA name="xxx" />
 <BBB:something_from_BBB </> </node>

?

I went through the options for exporting (like OPTION_USE_ENCODED_ATTRIBUTE_STYLE) and I could not make it work.

What would be the correct way? Can someone help me?

(Should I repost this in the Ecore forum? Such a behaviour is frowned upon in some forums ...)


Best regards, Daniel


Edward Willink wrote on Mon, 17 October 2011 12:17
Hi Daniel

I recommend separating your concerns.

Most of the Eclipse Modeling tools support Ecore, and QVTo supports
Ecore to Ecore transformations.

EMF provides XSD import and export capabilities for Ecore files that are
then used by other tools, so find out which of

a) XSD2Ecore
b) Ecore2Ecore
c) Ecore2XSD

does not do as you want and then fix it. Each stage has plenty of
configuration capabilities and opportunities for errors.

Regards

Ed Willink


On 17/10/2011 16:19, daniel.engelhardt wrote:
> Hello,
>
> I would like to write a QVT transformation in Eclipse Indigo that
> accomplishes the following:
>
> I have an Input Meta-Model, lets call it In.ecore (which is generated
> from an xsd file).
>
> I have two Output Meta-Models, Out_includes_A.ecore and
> Out_included_B.ecore, which are also generated from two different xsd
> description files. These xsd files import one another, or to be more
> precise Out_includes_A includes Out_included_B.
> In the Ecore models, I could deal with these references either by
> implementing Attributes of type AnySimpleType or something, or by
> using references to the types in the other Meta-Model. I decided to go
> with the second option, which might be wrong already.
>
> Now, I wrote a QVT transformation that should create an output model
> (out.xmi) something like
>
> <node xmlns:BBB="http:SLASHSLASHwww.BBB.orgSLASHBBB"
> xmlns="http:SLASHSLASHwww .AAA.orgSLASHAAA">
> <something_from_AAA name="xxx" />
> <BBB:something_from_BBB </> </node>
>
>
> However, that's not what I get. Instead, the second namespace is
> completely disregarded (in a sense). I get something like
> <node xmlns="http:SLASHSLASHwww .AAA.orgSLASHAAA">
> <something_from_AAA name="xxx" />
> <BBBsomething_from_BBB </> </node>
>
> where BBBsomething_from_BBB was the name given to the reference
> Element in the node-part of the AAA-Input Meta-Model. The Extended
> Meta Data references are correct (they point to the correct namespace).
>
> The QVT transformation looks like
>
> transformation Input2AAA(in a : Input, out : AAA);
>
> i.e. the Output model is of type AAA, maybe this is my mistake.
>
>
> So, my question is: what do I need to do, to accomplish the behavour I
> want? My problem is, I don't really know where to start. Is it an
> Ecore Problem? Should I somehow try to combine both output metamodels
> into one? Should I use AnyType-based solutions? Or are my Extended
> Meta Data references broken? Or should I go about my QVT
> transformation in a different way? Or is it a problem with the xsd
> importer?
>
> I have worked with all of these tools quite a lot, but my
> understanding of them is not very deep, as one can surely see easily.
> And I left out quite a lot of information. What kind of information
> would you need in order to answer these questions above?
>
> Is there a standard way to go about this? I googled but I could not
> come up with a lot, concerning multiple namespaces in xsd and there
> handling Ecore and in the M2M tooling.
>
> Thank you very much in advance for your help. It is deeply appreciated!
>
> Best regards,
> Daniel

Re: [QVTo] Generate XMI with multiple namespaces [message #742564 is a reply to message #742446] Thu, 20 October 2011 15:59 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Daniel

Don't repost.

Post a new message focussed on your XSD2Ecore problem.

There are many powerful capabilities very few of which I use since I
regard starting with XSD as like upgrading from COBOL.

Regards

Ed Willink

On 20/10/2011 14:55, daniel.engelhardt wrote:
> Hi Edward,
>
> thank you very much for your post.
>
> As I tried to dig deeper, I could reduce the problem so far, by going
> through your list backwards:
>
> If I use the Ecore files produced from the XSD2Ecore importer, and
> create a dynamic instance, I already get the problem. The resulting
> XMI file does not contain the namespace information I need.
>
> So, it's not a M2M problem and I am in the wrong forum to begin with.
> It's an Ecore problem.
>
> But I begin to wonder if it is even possible to create an XMI file
> (via dynamic instances out of one Ecore file) that contains references
> using namespaces to another Ecore.
>
> I.e. my question is on how to create something like:
> <node xmlns:BBB="http:SLASHSLASHwww.BBB.orgSLASHBBB"
> xmlns="http:SLASHSLASHwww .AAA.orgSLASHAAA">
> <AAA:something_from_AAA name="xxx" />
> <BBB:something_from_BBB </> </node>
>
> ?
>
> I went through the options for exporting (like
> OPTION_USE_ENCODED_ATTRIBUTE_STYLE) and I could not make it work.
>
> What would be the correct way? Can someone help me?
>
> (Should I repost this in the Ecore forum? Such a behaviour is frowned
> upon in some forums ...)
>
>
> Best regards, Daniel
>
>
> Edward Willink wrote on Mon, 17 October 2011 12:17
>> Hi Daniel
>>
>> I recommend separating your concerns.
>>
>> Most of the Eclipse Modeling tools support Ecore, and QVTo supports
>> Ecore to Ecore transformations.
>>
>> EMF provides XSD import and export capabilities for Ecore files that
>> are then used by other tools, so find out which of
>>
>> a) XSD2Ecore
>> b) Ecore2Ecore
>> c) Ecore2XSD
>>
>> does not do as you want and then fix it. Each stage has plenty of
>> configuration capabilities and opportunities for errors.
>>
>> Regards
>>
>> Ed Willink
>>
>>
>> On 17/10/2011 16:19, daniel.engelhardt wrote:
>> > Hello,
>> >
>> > I would like to write a QVT transformation in Eclipse Indigo that >
>> accomplishes the following:
>> >
>> > I have an Input Meta-Model, lets call it In.ecore (which is
>> generated > from an xsd file).
>> >
>> > I have two Output Meta-Models, Out_includes_A.ecore and >
>> Out_included_B.ecore, which are also generated from two different xsd
>> > description files. These xsd files import one another, or to be
>> more > precise Out_includes_A includes Out_included_B.
>> > In the Ecore models, I could deal with these references either by >
>> implementing Attributes of type AnySimpleType or something, or by >
>> using references to the types in the other Meta-Model. I decided to
>> go > with the second option, which might be wrong already.
>> >
>> > Now, I wrote a QVT transformation that should create an output
>> model > (out.xmi) something like
>> >
>> > <node xmlns:BBB="http:SLASHSLASHwww.BBB.orgSLASHBBB"
>> > xmlns="http:SLASHSLASHwww .AAA.orgSLASHAAA">
>> > <something_from_AAA name="xxx" />
>> > <BBB:something_from_BBB </> </node>
>> >
>> >
>> > However, that's not what I get. Instead, the second namespace is >
>> completely disregarded (in a sense). I get something like
>> > <node xmlns="http:SLASHSLASHwww .AAA.orgSLASHAAA">
>> > <something_from_AAA name="xxx" />
>> > <BBBsomething_from_BBB </> </node>
>> >
>> > where BBBsomething_from_BBB was the name given to the reference >
>> Element in the node-part of the AAA-Input Meta-Model. The Extended >
>> Meta Data references are correct (they point to the correct namespace).
>> >
>> > The QVT transformation looks like
>> >
>> > transformation Input2AAA(in a : Input, out : AAA);
>> >
>> > i.e. the Output model is of type AAA, maybe this is my mistake.
>> >
>> >
>> > So, my question is: what do I need to do, to accomplish the
>> behavour I > want? My problem is, I don't really know where to start.
>> Is it an > Ecore Problem? Should I somehow try to combine both output
>> metamodels > into one? Should I use AnyType-based solutions? Or are
>> my Extended > Meta Data references broken? Or should I go about my
>> QVT > transformation in a different way? Or is it a problem with the
>> xsd > importer?
>> >
>> > I have worked with all of these tools quite a lot, but my >
>> understanding of them is not very deep, as one can surely see easily.
>> > And I left out quite a lot of information. What kind of information
>> > would you need in order to answer these questions above?
>> >
>> > Is there a standard way to go about this? I googled but I could not
>> > come up with a lot, concerning multiple namespaces in xsd and there
>> > handling Ecore and in the M2M tooling.
>> >
>> > Thank you very much in advance for your help. It is deeply
>> appreciated!
>> >
>> > Best regards,
>> > Daniel
>
>
Previous Topic:[ATL]: a target model inconsistant with it's metamodel
Next Topic:Match with abstract Classes
Goto Forum:
  


Current Time: Fri Apr 26 14:03:05 GMT 2024

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

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

Back to the top