{"id":1103,"date":"2009-04-20T09:37:00","date_gmt":"2009-04-20T09:37:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/cesardelatorre\/2009\/04\/20\/starting-using-oslo-m-language-oslo-repository-and-intellipad\/"},"modified":"2009-04-20T09:37:00","modified_gmt":"2009-04-20T09:37:00","slug":"starting-using-oslo-m-language-oslo-repository-and-intellipad","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/starting-using-oslo-m-language-oslo-repository-and-intellipad\/","title":{"rendered":"Starting using OSLO, \u201cM\u201d Language, Oslo Repository and Intellipad"},"content":{"rendered":"<p><TABLE border=\"0\" cellSpacing=\"0\" cellPadding=\"2\" width=\"872\">\n<TBODY>\n<TR>\n<TD vAlign=\"top\" width=\"89\"><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/image_2.png\"><IMG title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/image_thumb.png\" width=\"122\" height=\"122\"><\/A><\/TD>\n<TD vAlign=\"top\" width=\"781\">\n<P><B>Microsoft \u201cOSLO\u201d<\/B> is Microsoft\u2019s next generation of Modeling Platform, Tools and DSLs. <\/P>\n<P><B>OSLO<\/B> is basically composed by: <\/P>\n<P>&#8211; <B>\u201cM\u201d Language<\/B> (For Data Modeling and Textual DSLs ) <\/P>\n<P>&#8211; <B>QUADRANT<\/B> (Visual Tool for Visual Modeling) <\/P>\n<P>&#8211; <B>Oslo Repository<\/B> (Based on SQL Server. IT is the Oslo\u2019s data store, for meta-data and data itself) <\/P><\/TD><\/TR><\/TBODY><\/TABLE>\n<P>You can actually research about Microsoft OSLO using the published \u201cOslo\u201d SDK January 2009 CTP. This is the version I\u2019m using for this post. <\/P>\n<P><B>Download &#8211; Microsoft &#8220;Oslo&#8221; SDK &#8211; January 2009 CTP (Refresh)<\/B><\/P>\n<P><A href=\"http:\/\/www.microsoft.com\/downloads\/details.aspx?FamilyID=f2f4544c-626c-44a3-8866-b2a9fe078956&amp;displaylang=en\">http:\/\/www.microsoft.com\/downloads\/details.aspx?FamilyID=f2f4544c-626c-44a3-8866-b2a9fe078956&amp;displaylang=en<\/A><\/P>\n<P>What I\u2019m going to do in this post, is to play a bit with INTELLIPAD, \u201cM\u201d Language and OSLO Repository, so we can see what it is about. <\/P>\n<P><STRONG>Keep in midn that this post is about \u201cDATA MODELING with OSLO and M-Language\u201d, but in the future, we could potencially model anything with OSLO (Web Services, Workflows, Deployments, custom specific domains, etc.)<\/STRONG><\/P>\n<P>So, <STRONG>Intellipad<\/STRONG> is a very special text editor that comes with OSLO SDK, but as you can suppose (because of its name), it is kind of \u201cintelligent\u201d, I mean, it is <B>Oslo Textual DSL<\/B> oriented and aware. \ud83d\ude09 <\/P>\n<P>So, <B>Intellipad<\/B> gives you support for directly writing in \u201cM\u201d Language. At the end of the day, Intellipad lets you write and execute any TEXTUAL-DSL you have installed over Intellipad.<\/P>\n<P>I\u2019m going to use Intellipad to write simple \u201cM\u201d Language arbitrary data and we\u2019ll see how Intellipad translates to specific languages like TSQL, etc.<\/P>\n<P>Steps to do:<\/P>\n<P>1.- Open Intellipad. You\u2019ll see it like that:<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/clip_image002_2.jpg\"><IMG title=\"clip_image002\" border=\"0\" alt=\"clip_image002\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/clip_image002_thumb.jpg\" width=\"575\" height=\"256\"><\/A><\/P>\n<P>2.- Select \u201cM Mode\u201d as current Intellipad mode:<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/clip_image004_2.jpg\"><IMG title=\"clip_image004\" border=\"0\" alt=\"clip_image004\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/clip_image004_thumb.jpg\" width=\"580\" height=\"119\"><\/A><\/P>\n<P>3.- We\u2019re going to create kind of a \u2018Software Catalog\u2019 or Library. It could be a Library about books, songs or whatever, but I chose to do it about Software products, ok?.<\/P>\n<P>So we start typing the following M-code that you can copy&amp;paste:<\/P>\n<P>\n<TABLE border=\"1\" cellSpacing=\"0\" cellPadding=\"0\">\n<TBODY>\n<TR>\n<TD vAlign=\"top\" width=\"576\">\n<P>module OsloDemos<\/P>\n<P>{<\/P>\n<P>SoftwareCatalog<\/P>\n<P>{<\/P>\n<P>{ProductName = &#8220;Windows 7&#8221;, Company = &#8220;Microsoft&#8221;, Rating = 3},<\/P>\n<P>{ProductName = &#8220;Windows Vista&#8221;, Company = &#8220;Microsoft&#8221;, Rating = 3},<\/P>\n<P>{ProductName = &#8220;Visual Studio 2010&#8221;, Company = &#8220;Microsoft&#8221;, Rating = 3}<\/P>\n<P>}<\/P>\n<P>}<\/P><\/TD><\/TR><\/TBODY><\/TABLE><\/P>\n<P>You\u2019ll see it like that:<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/clip_image006_2.jpg\"><IMG title=\"clip_image006\" border=\"0\" alt=\"clip_image006\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/clip_image006_thumb.jpg\" width=\"653\" height=\"256\"><\/A><\/P>\n<P>Nice, it is very simple and intuitive as we\u2019re focusing just on the data I\u2019m handling, right?. M-code with Data and metadata can be stored in Oslo Repository, but before doing so, I\u2019m going to show you how this M-Mode DSL understands that code. I mean, Intellipad can actually translate that code to T-SQL (SQL Sentences for schema and data)\u2026<\/P>\n<P>4.- It is very easy to generate that T-SQL code, just change M Mode to \u201cGeneric T-SQL Preview\u201d:<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/clip_image008_2.jpg\"><IMG title=\"clip_image008\" border=\"0\" alt=\"clip_image008\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/clip_image008_thumb.jpg\" width=\"659\" height=\"258\"><\/A><\/P>\n<P>Then, we have another pane, to the right, where M runtime has translated our simple data code to T-SQL:<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/clip_image010_2.jpg\"><IMG title=\"clip_image010\" border=\"0\" alt=\"clip_image010\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/clip_image010_thumb.jpg\" width=\"754\" height=\"451\"><\/A><\/P>\n<P>As you can see, it generates SQL Sentences in order to create the table and then INSERT sentences in order to insert that data. It is interesting that it guesses the data schema types depending on actual data. For instance, nvarchar(max) for ProductName, etc.<\/P>\n<P>5.- We can even specify constraints or restrictions. For instance, I want to specify that we have an entity type called \u2018Product\u2019, and that my data within SoftwareCatalog is based on that entity.<\/P>\n<P>We type the following, after our actual M code: \n<TABLE border=\"1\" cellSpacing=\"0\" cellPadding=\"0\">\n<TBODY>\n<TR>\n<TD vAlign=\"top\" width=\"576\">\n<P>SoftwareCatalog : Product*;<\/P>\n<P>type Product<\/P>\n<P>{<\/P>\n<P>ProductName : Text;<\/P>\n<P>Company: Text;<\/P>\n<P>Rating: Integer32;<\/P>\n<P>}<\/P><\/TD><\/TR><\/TBODY><\/TABLE><\/P>\n<P>Therefore, we\u2019re explicitly declaring what and how is our data type.<\/P>\n<P>We can even set restrictions, like field length, etc, like the following: \n<TABLE border=\"1\" cellSpacing=\"0\" cellPadding=\"0\">\n<TBODY>\n<TR>\n<TD vAlign=\"top\" width=\"576\">\n<P>SoftwareCatalog : Product*;<\/P>\n<P>type Product<\/P>\n<P>{<\/P>\n<P>ProductName : Text where value.Count &lt;= 128;<\/P>\n<P>Company: Text where value.Count &lt;= 128;<\/P>\n<P>Rating: Integer32;<\/P>\n<P>}<\/P><\/TD><\/TR><\/TBODY><\/TABLE><\/P>\n<P>You can check that it is changing the generated T-SQL, on the right side:<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/clip_image012_2.jpg\"><IMG title=\"clip_image012\" border=\"0\" alt=\"clip_image012\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/clip_image012_thumb.jpg\" width=\"715\" height=\"428\"><\/A><\/P>\n<P>6.- Next step I want to show is \u201cCompiling M-code\u201d, so we can afterwards execute it and get that schema and definitions into OSLO Repository. J<\/P>\n<P>So first of all, let\u2019s save our M-code to a file, called \u201cSoftwareCatalog.m\u201d<\/P>\n<P>And now, let\u2019s compile it.<\/P>\n<P>Open a Command-Prompt for Oslo Tools, and type the following: \n<TABLE border=\"1\" cellSpacing=\"0\" cellPadding=\"0\">\n<TBODY>\n<TR>\n<TD vAlign=\"top\" width=\"576\">\n<P>m.exe SoftwareCatalog.m \/p:image<\/P><\/TD><\/TR><\/TBODY><\/TABLE><\/P>\n<P>You\u2019ll see it like the following:<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/clip_image014_2.jpg\"><IMG title=\"clip_image014\" border=\"0\" alt=\"clip_image014\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/clip_image014_thumb.jpg\" width=\"714\" height=\"205\"><\/A><\/P>\n<P>This tool (m.exe) compiles \u201cM\u201d code and generates an image file. In this case: \u201cSoftwareCatalog.mx\u201d.<\/P>\n<P>7.- Next step is to deploy that compiled image file into the OSLO REPOSITORY (into SQL Server), using the mx.exe tool. Type the following: \n<TABLE border=\"1\" cellSpacing=\"0\" cellPadding=\"0\">\n<TBODY>\n<TR>\n<TD vAlign=\"top\" width=\"576\">\n<P>mx.exe \u2013i:SoftwareCatalog.mx \u2013d Repository<\/P><\/TD><\/TR><\/TBODY><\/TABLE><\/P>\n<P>After that, you\u2019ll be able to see that data in the OSLO Repository, I mean, in the SQL Server database called \u201c<B>Repository<\/B>\u201d (when installing OSLO SDK you provided a specific SQL Server or SQL Express Server) and now we have a table called \u201c<B>OsloDemos. SoftwareCatalog<\/B>\u201d, where we can check even the model\u2019s data:<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/clip_image016_2.jpg\"><IMG title=\"clip_image016\" border=\"0\" alt=\"clip_image016\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/clip_image016_thumb.jpg\" width=\"755\" height=\"442\"><\/A><\/P>\n<P>8.- Of course, we\u2019ve been doing this in a kind of low level way (TEXTUAL DSL called M Language, Intellipad and Command-line Tools), but you could do it also in a VISUAL way, using QUADRANT. <\/P>\n<P>At this moment, we could also Access our data model in Oslo Repository using QUADRANT. Just DRAG &amp; DROP \u201cQuadrant\u2014&gt;Explorer&#8211;&gt;Browse All &#8211;&gt; <B>OsloDemos. SoftwareCatalog\u201d<\/B> into the Quadrant\u2019s design Surface. J<B> <\/B><\/P>\n<P><STRONG><\/STRONG><\/P>\n<P>FINAL CONCLUSIONS<\/P>\n<P>IMPORTANT:<\/P>\n<P>Keep in midn that in this example we\u2019ve been using Oslo, \u201cM\u201d Language and Intellipad to model data and data\u2019s schema, BUT, this is just one way you can use OSLO. In fact, in the future we\u2019ll be using OSLO for many more things like:<\/P>\n<P>&#8211; Modeling a Web Service (WCF Services, etc.)<\/P>\n<P>&#8211; Modeling Restful Clients (like using MUrl)<\/P>\n<P>&#8211; Modeling WF Workflows <\/P>\n<P>&#8211; Modeling Web Apps (ASP.NET)<\/P>\n<P>&#8211; \u201cModeling your Specific Doman, whatever you want!\u201d<\/P>\n<P>&#8211; Etc.<\/P>\n<P>So, in this post we\u2019ve been using plain \u201cM\u201d Language for modeling data, but,<STRONG> it is just one of the possibilities!!<\/STRONG> \ud83d\ude42<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Microsoft \u201cOSLO\u201d is Microsoft\u2019s next generation of Modeling Platform, Tools and DSLs. OSLO is basically composed by: &#8211; \u201cM\u201d Language (For Data Modeling and Textual DSLs ) &#8211; QUADRANT (Visual Tool for Visual Modeling) &#8211; Oslo Repository (Based on SQL Server. IT is the Oslo\u2019s data store, for meta-data and data itself) You can actually [&hellip;]<\/p>\n","protected":false},"author":362,"featured_media":12806,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[59,74],"class_list":["post-1103","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cesardelatorre","tag-m-language","tag-oslo"],"acf":[],"blog_post_summary":"<p>Microsoft \u201cOSLO\u201d is Microsoft\u2019s next generation of Modeling Platform, Tools and DSLs. OSLO is basically composed by: &#8211; \u201cM\u201d Language (For Data Modeling and Textual DSLs ) &#8211; QUADRANT (Visual Tool for Visual Modeling) &#8211; Oslo Repository (Based on SQL Server. IT is the Oslo\u2019s data store, for meta-data and data itself) You can actually [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/posts\/1103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/users\/362"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/comments?post=1103"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/posts\/1103\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/media\/12806"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/media?parent=1103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/categories?post=1103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/tags?post=1103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}