Model to Model transformations in Oslo, any plans?(I don't talk about transforming text into models. I know, MGrammar is great for doing that.)<br><br>We do M2M-transformations all day. We convert DAOs to DTOs, messages to messages, xml to xml, xml to xhtml, ...<br><br>Do you have any plany on creating a M* language that helps writing M2M transformations?<br><ol><li>I can for example see, that the output of a DSL even using projections, might result in ugly models - just because it is to tightly bound to the textual representation. A DSL for M2M transformations could then help transforming that model into something more representative. </li><li>M2M would also be a great support for model evolution. Along with a new schema a M2M could then define how to convert from my type V1 to V2.</li><li>...</li></ol><br>What do you think?<br> © 2009 Microsoft Corporation. All rights reserved.Wed, 14 Jan 2009 06:21:25 Zfb633bba-e922-4642-9f88-2a942f114224http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#fb633bba-e922-4642-9f88-2a942f114224http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#fb633bba-e922-4642-9f88-2a942f114224lcorneliussenhttp://social.msdn.microsoft.com/Profile/en-US/?user=lcorneliussenModel to Model transformations in Oslo, any plans?(I don't talk about transforming text into models. I know, MGrammar is great for doing that.)<br><br>We do M2M-transformations all day. We convert DAOs to DTOs, messages to messages, xml to xml, xml to xhtml, ...<br><br>Do you have any plany on creating a M* language that helps writing M2M transformations?<br><ol><li>I can for example see, that the output of a DSL even using projections, might result in ugly models - just because it is to tightly bound to the textual representation. A DSL for M2M transformations could then help transforming that model into something more representative. </li><li>M2M would also be a great support for model evolution. Along with a new schema a M2M could then define how to convert from my type V1 to V2.</li><li>...</li></ol><br>What do you think?<br> Wed, 19 Nov 2008 11:00:49 Z2008-11-19T11:03:28Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#1c4d7d1a-f588-481b-ac1b-eca23852829ehttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#1c4d7d1a-f588-481b-ac1b-eca23852829eChris Sellshttp://social.msdn.microsoft.com/Profile/en-US/?user=Chris%20SellsModel to Model transformations in Oslo, any plans? Transformation is a whole area where I want to see us go. We have a powerful transformation language in the query syntax of M, but I don't believe we've done any serious thinking about model-to-model transformation. I'd be curious how you'd like to see that surfaced, Lars.Fri, 21 Nov 2008 16:27:16 Z2008-11-21T16:27:16Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#892693b8-b3f2-46e4-bc8e-83f18704cabfhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#892693b8-b3f2-46e4-bc8e-83f18704cabflcorneliussenhttp://social.msdn.microsoft.com/Profile/en-US/?user=lcorneliussenModel to Model transformations in Oslo, any plans?Hm, I'd like a mix of MGraph, LINQ and some dynamic-style language. Just an idea - I don't have any clear picture yet.<br><br><div style="overflow:auto;background-color:white;line-height:100% ! important;font-family:Courier New;font-size:11px"><table style="border-width:0px;margin:2px 0px;width:99%;border-collapse:collapse;background-color:rgb(255, 255, 255)" cellpadding=0 cellspacing=0><col style="font-family:Courier New;font-size:11px;padding-left:10px;white-space:nowrap"><tbody><tr><td><font style="font-size:11px"> </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)">Books{ </td></tr><tr><td>  Books{ </td></tr><tr><td style="background-color:rgb(247, 247, 247)">    Book{ Author{&quot;Juwal Lövy&quot;}, Title{&quot;Programming WCF Services&quot;}, Rating {3} }, </td></tr><tr><td>    Book{ Author{{&quot;Elisabeth Freeman&quot;,&quot;Eric Freeman&quot;,&quot;Bert Bates&quot;, &quot;Kathy Sierra&quot;}}, </td></tr><tr><td style="background-color:rgb(247, 247, 247)">     Title{&quot;Head First Design Patterns (Head First)&quot;}, Rating {2} }  </td></tr><tr><td>  } </td></tr><tr><td style="background-color:rgb(247, 247, 247)">} </td></tr></tbody></table></div> <br>Transformation:<br><br><div style="overflow:auto;background-color:white;line-height:100% ! important;font-family:Courier New;font-size:11px"><table style="border-width:0px;margin:2px 0px;width:99%;border-collapse:collapse;background-color:rgb(255, 255, 255)" cellpadding=0 cellspacing=0><col style="font-family:Courier New;font-size:11px;padding-left:10px;white-space:nowrap"><tbody><tr><td><font style="font-size:11px">module XY { </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)">  transform AuthorsOnly { </td></tr><tr><td>    def Main(Books): Authors{ from b in Books.Book select b.Author.ForEach( <font style="color:red">x</font><font style="font-size:11px"> =</font><font style="color:blue">&gt;</font><font style="font-size:11px"> Author { x }) };</font></td></tr><tr><td style="background-color:rgb(247, 247, 247)">  } </td></tr><tr><td>} </td></tr></tbody></table></div>Mon, 24 Nov 2008 12:31:39 Z2008-11-24T12:31:39Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#61c633ae-298f-45fe-8c54-b852b9b8a537http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#61c633ae-298f-45fe-8c54-b852b9b8a537Chris Sellshttp://social.msdn.microsoft.com/Profile/en-US/?user=Chris%20SellsModel to Model transformations in Oslo, any plans? Ah. You're in luck, Lars, We already have LINQ like query syntax in M. Check out section 1.3 of the M Language Specification: <a href="http://msdn.microsoft.com/en-us/library/dd285271.aspx">http://msdn.microsoft.com/en-us/library/dd285271.aspx</a>Thu, 27 Nov 2008 13:53:47 Z2008-11-27T13:53:47Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#7745530f-62b7-4080-bb75-3d70e856bd59http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#7745530f-62b7-4080-bb75-3d70e856bd59lcorneliussenhttp://social.msdn.microsoft.com/Profile/en-US/?user=lcorneliussenModel to Model transformations in Oslo, any plans?Sure, I've seen this. But isn't this only mapped to views when using the Oslo Repository? How is it usable via API? Is it the &quot;equivalent&quot; to XPath in the xml stack? <br><br>Anyway, it still doesn't enable m2m transformations. Do you think you will provide a &quot;language&quot; for M2M/M2T within the M-family?<br> Thu, 27 Nov 2008 14:46:35 Z2008-11-27T14:46:35Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#0c8d52dd-bf69-408b-8db4-c597eb315ad4http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#0c8d52dd-bf69-408b-8db4-c597eb315ad4Chris Sellshttp://social.msdn.microsoft.com/Profile/en-US/?user=Chris%20SellsModel to Model transformations in Oslo, any plans? What would you like that to look like, Lars?Tue, 02 Dec 2008 14:50:18 Z2008-12-02T14:50:18Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#1e0c599a-620a-4dd6-9eb1-28c409c99143http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#1e0c599a-620a-4dd6-9eb1-28c409c99143lcorneliussenhttp://social.msdn.microsoft.com/Profile/en-US/?user=lcorneliussenModel to Model transformations in Oslo, any plans?As I described in my post below. Here with some comments -but still, it's just an idea though :-) ...<br><br>It could back something similar to XSL but with embedded python or ruby scripts (or any dynamic/static .NET Language?). It could support aspects, f.ex. by a arround keyword, and it should have linq, MGraph(Expressions) and maybe MSchema as firstclass citizens.<br><br><div style="overflow:auto;background-color:white;line-height:100% ! important;font-family:Courier New;font-size:11px"><table style="border-width:0px;margin:2px 0px;width:99%;border-collapse:collapse;background-color:rgb(255, 255, 255)" cellpadding=0 cellspacing=0><col style="font-family:Courier New;font-size:11px;padding-left:10px;white-space:nowrap"><tbody><tr><td><font style="font-size:11px">module XY {  </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)">  // a transformation </td></tr><tr><td>  transform AuthorsOnly {  </td></tr><tr><td style="background-color:rgb(247, 247, 247)">    // function that matches &quot;Books&quot; - as xsl:template <font style="color:red">match</font><font style="font-size:11px">=</font><font style="color:blue">&quot;Books&quot;</font><font style="font-size:11px"> </font><font style="color:red">name</font><font style="font-size:11px">=</font><font style="color:blue">&quot;Main&quot;</font><font style="font-size:11px"> </font></td></tr><tr><td>    def Main(Books books):  </td></tr><tr><td style="background-color:rgb(247, 247, 247)">      // resulting MGraph </td></tr><tr><td>      Authors{ </td></tr><tr><td style="background-color:rgb(247, 247, 247)">        // query books for each author </td></tr><tr><td>        from b in books.Book select b.Author.ForEach( </td></tr><tr><td style="background-color:rgb(247, 247, 247)">          // put the author into an successor named &quot;Author&quot; with a singleton </td></tr><tr><td>          // successor &quot;Name&quot; with value x (labmda parameter) </td></tr><tr><td style="background-color:rgb(247, 247, 247)">          <font style="color:red">x</font><font style="font-size:11px"> =</font><font style="color:blue">&gt;</font><font style="font-size:11px"> Author { </font><font style="color:red">Name</font><font style="font-size:11px"> = </font><font style="color:blue">x</font><font style="font-size:11px"> } </font></td></tr><tr><td>        )  </td></tr><tr><td style="background-color:rgb(247, 247, 247)">      } </td></tr><tr><td>  }  </td></tr><tr><td style="background-color:rgb(247, 247, 247)">}  </td></tr></tbody></table></div><br> Tue, 02 Dec 2008 15:01:32 Z2008-12-02T15:04:50Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#05489fbb-7a15-40c5-8924-106fa03c0799http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#05489fbb-7a15-40c5-8924-106fa03c0799Erik Wynne Stepphttp://social.msdn.microsoft.com/Profile/en-US/?user=Erik%20Wynne%20SteppModel to Model transformations in Oslo, any plans?<p>Lars, this is valid M code:</p> <div style="border-bottom:#7f9db9 1px solid;border-left:#7f9db9 1px solid;line-height:100% !important;background-color:white;font-family:courier new;font-size:11px;overflow:auto;border-top:#7f9db9 1px solid;border-right:#7f9db9 1px solid"> <table style="border-bottom:#eee 0px solid;border-right-width:0px;background-color:#fff;margin:2px 0px;width:99%;border-collapse:collapse;border-top-width:0px;border-left-width:0px" cellspacing=0 cellpadding=0> <colgroup> <col style="border-bottom:#f7f7f7 1px solid;padding-left:10px;font-family:courier new;white-space:nowrap;font-size:11px"></colgroup> <tbody> <tr> <td><font style="font-size:11px">module XY {  </font></td></tr> <tr> <td style="background-color:#f7f7f7"> </td></tr> <tr> <td>  type Book {  </td></tr> <tr> <td style="background-color:#f7f7f7">       Title : Text;  </td></tr> <tr> <td>       Author : Text;  </td></tr> <tr> <td style="background-color:#f7f7f7">       ISBN : Text;  </td></tr> <tr> <td>       Published : Date;  </td></tr> <tr> <td style="background-color:#f7f7f7">       Publisher : Text;  </td></tr> <tr> <td>  };  </td></tr> <tr> <td style="background-color:#f7f7f7">    </td></tr> <tr> <td>  type Books : Book*;  </td></tr> <tr> <td style="background-color:#f7f7f7">    </td></tr> <tr> <td>  type AuthorsOnly {   </td></tr> <tr> <td style="background-color:#f7f7f7">        from b <font color=blue>in</font><font style="font-size:11px"> Books select b.Author   </font></td></tr> <tr> <td>  };  </td></tr> <tr> <td style="background-color:#f7f7f7"> </td></tr> <tr> <td>  type AuthorsName {  </td></tr> <tr> <td style="background-color:#f7f7f7">        Name = from b <font color=blue>in</font><font style="font-size:11px"> Books select b.Author;  </font></td></tr> <tr> <td>  };  </td></tr> <tr> <td style="background-color:#f7f7f7">}     </td></tr> <tr> <td> </td></tr></tbody></table></div> <p>I don't think that it transforms in the sense that you would like, though, but I think it is as close as you can get with the current philosophy in M.<br><br>Remember, that M types cannot be updated, only initialized.   So the type AuthorsOnly cannot be changed to become something new later--that's not a supported scenario in the current M language.  Because of this, we are only saying that AuthorsOnly and AuthorsName are initialized with the values of Books.<br><br>It is also important to note that M philosophically isn't going to specify HOW it is going to do this.  It might do this by creating new AuthorsOnly and AuthorsName tables and copying the data from the Books table to the new table.   It might do this by create a view on top of the Books table.   I don't know which it does today--I couldn't get it to generate SQL code for me in Rich or Reach SQL mode.  Whichever it is today, there is no promise nor expectation that it will remain the same.  It might be nice if M supported an annotation that allows you to specify either one explicitly, but I've not seen anything like that yet.<br><br>Finally, a type in M is just a way to define a shape of data.  It is not a strict OO type, like C++ and C#, but a &quot;duck&quot; type like JavaScript.  If the shape of the data matches, then it is that type.   Whether AuthorsOnly is a table or a view is uninteresting in M.   Because either match the shape expected, then both work equally well inside M.<br><br>The only possible interesting scenario is what happens post-initialization.   What should happen to AuthorsOnly if Books is changed exogenously post-initialization?  Do you expect this to be updated automatically or only when you explicitly request it?  I think your example expects it to be updated automatically.  If that is the case, I think that this works for you.   If you expect the transformation to be applied later, then again you are outside the current scope of M.   They explicitly do not support updating data after initialization.<br><br>Given that, I think that the code above is the best that you can do with the current philosophy of M.</p> <hr class=sig> ErikTue, 02 Dec 2008 19:29:38 Z2008-12-02T21:06:20Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#eb2d0c28-18e8-437d-aec9-a410b1f86b4bhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#eb2d0c28-18e8-437d-aec9-a410b1f86b4blcorneliussenhttp://social.msdn.microsoft.com/Profile/en-US/?user=lcorneliussenModel to Model transformations in Oslo, any plans?Hi Erik,<br><br>thanks for your answer. I know my &quot;request&quot; is not covered by the M philosophy. That is, what it is about. I think there is a need for beeing able to process models into new models somehow - post production. I don't want to change data - it's about generating new data. Like you do with xml-to-xml transformations using xslt.<br><br>It shouldn't matter where the data comes from. I neither see a problem with the ducktyping/structural subtyping here. It's just about processing MGraphs (produced by M or MGrammar) to other (can be similar) MGraphs.<br><br>cheers,<br>Lars<br> Tue, 02 Dec 2008 21:20:30 Z2008-12-02T21:20:30Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#696d6341-7353-47bd-8cc4-ea224f2cc830http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#696d6341-7353-47bd-8cc4-ea224f2cc830Mike Weinhardthttp://social.msdn.microsoft.com/Profile/en-US/?user=Mike%20WeinhardtModel to Model transformations in Oslo, any plans?<p>Hi Lars,<br><br>Model-to-model transformation is certainly something we're thinking about. Unfortunately, we don't know how that will look or when it will be available but your feedback helps, particularly with respect to detailing how you'd like to see it work.<br><br>I'd recommend using the &quot;Oslo&quot; <a href="https://connect.microsoft.com/oslo?wa=wsignin1.0">Connect</a> site to make this, or any, suggestions.<br><br>Cheers,<br>Michael</p>Fri, 05 Dec 2008 19:12:08 Z2008-12-05T19:12:08Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#f58ddb87-e00d-444b-8ae3-5f96b3233b71http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#f58ddb87-e00d-444b-8ae3-5f96b3233b71lcorneliussenhttp://social.msdn.microsoft.com/Profile/en-US/?user=lcorneliussenModel to Model transformations in Oslo, any plans?Thanks Mike. I submitted a Suggestion: <a href="https://connect.microsoft.com/oslo/feedback/ViewFeedback.aspx?Feedback">https://connect.microsoft.com/oslo/feedback/ViewFeedback.aspx?FeedbackID=388047 </a>Mon, 15 Dec 2008 09:15:19 Z2008-12-15T09:16:01Zhttp://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#a30d6b83-72be-4981-91c9-bf83694b6cf5http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/fb633bba-e922-4642-9f88-2a942f114224#a30d6b83-72be-4981-91c9-bf83694b6cf5the Pinkyhttp://social.msdn.microsoft.com/Profile/en-US/?user=the%20PinkyModel to Model transformations in Oslo, any plans? Lars,<br>Here's my 2 cents for what it's worth...<br><br>The query syntax in M is quite robust. We did lots of investigation comparing it to LINQ and T-SQL. I believe it will serve well as a syntax for writing just the transformations you want. I'm sure we have holes. In fact I know we do because there still more language work going on to look at things like XPath and see what we can do. So stay tuned.<br><br>The bigger problem, as you stated, is that the only way to do those evaluations today is to run them in SQL. What you really want is an in-memory evaluation to go from 1 MGraph to another. Well, you may want to check out Mr.Epl. It's current a sample (with source so you can see how SpankyJ built it), but it illustrates an important feature that we hope to get soon - an in-memory evaluator of M expressions.<br><br>Also, we hope to use MGrammar + M Expressions on the RHS to generate interesting transformations of character streams. <br><br>If this was too cryptic of an answer, let me know cause it's past my bed time :)<hr class="sig">-- pinky --/ http://www.tinyfinger.com/Wed, 14 Jan 2009 06:21:23 Z2009-01-14T06:21:23Z