Oslo, Quadrant and the Repository is dead, long live “M”?

What the community (me included) has hoped and feared at the same time and what many foresaw, happened: Microsoft discontinued it’s investment in SQL Modeling Services (aka “Oslo” Repository) as well as “Quadrant”, as Don Box states on the Model Citizen Blog.

One important aspect of that focus is that we will not bring “Oslo” repository to market.

The Winners on the data-side of things are OData and the Entity Framework including EDM.

Given the increasing adoption of both OData and EDM, we have decided to focus our investments in those technologies to make our modeling vision a reality.

But Don also states, that Micrsosoft will further invest in the modeling language codenamed “M”, which also was a former part of Oslo, but clearly didn’t fit into the “SQL” rebranding right from the beginning.

While we used “M” to build the “Oslo” repository and “Quadrant,” there has been significant interest both inside and outside of Microsoft in using “M” for other applications. We are continuing our investment in this technology and will share our plans for productization once they are concrete.

I think, all together this is good news. Both the Repository and Quadrant were very far away from what I consider useful.

Hopefully the “M” team moves over to DevDiv into the ScottGu-Area. Hopefully it then returns to collaborative language design, now that the internal goals are removed.  Hopefully, Microsoft also now listens’ to the modeling community when designing the final language. And hopefully they bring great Visual Studio Support for textual DSLs.

Hey Microsoft, what about open sourcing “M”? This would be a huge step forward, after this very huge step backwards!

Advertisement

What is left of Microsoft “Oslo”? What now with SQL Server Modeling? (Early 2010)

Back in October 2008 Microsoft announced “Oslo” as a new and world-changing modeling platform. While it always consisted of a language, an editor and a repository the community seemed to be mostly interested in the language “M” and it’s grammar features for creating new domain specific languages.

The feedback could be summarized to:

Great! We love model-driven. We love DSLs. But why the heck SQL?

After that they got engaged with that community. Chris hosted the DSL Dev Con. And Doug released “M” under the Open Specification Promise and founded the “M” Specification Community. Mathew Wilson implemented M in JavaScript. Hugo Brunelier elaborated on the possibilities of bridging it with Eclipse Modeling.

Many wrote, spoke and blogged about it. The fellow hope was, that Microsoft could bring model-driven development to a broader audience and by that increase both productivity and quality in software development.

For that community the renaming of “Oslo” to SQL Server Modeling was a slap in the face. Many stated that they were disappointed by Microsoft’s decisions.

Let’s look into the reasoning and the real consequences of that rename.

Even though I think it was a wise decision business-wise both the timing and the messaging was really bad.

The Repository and “Quadrant” were closely tied to SQL right from the beginnings of “Oslo”. The schema, constraints and functions part of “M” had and mostly still has only one implementation: also SQL.

But the languages part of “M” also referenced to as “MGrammar” had nothing to do with SQL at all and it still doesn’t have much to do with it today either.

“M” should have been split out from “Oslo” before the rename and everybody would have been happy.

So where is this going now?

“M” and “Quadrant” today are still code names. The only thing that has a final name is the repository part of “Oslo” which is now named SQL Server Modeling Services. And I think we agree that that is a OK name.

Most probably “M” will not become SQL Server Modeling M and neither will “Quadrant” be named SQL Server Modeling Quadrant.

I think the final “M” will be as much SQL as Entity Framework and OData are SQL today. All those are developed within the same group and I expect it to merge anyway.

“Quadrant” will probably replace the part in SQL Server Management Studio that enables browsing and editing of SQL data – which is horrible today anyway. It also has the potential of replacing Access as a platform for Information Workers.

And maybe some day we’ll see ideas from “Quadrant” in Excel.

Future of DSL Development with Microsoft Tools

Visual: There was a hope, that “Quadrant” could be a better DSL Toolkit. Those teams didn’t talk to each other, but now they do. I think MS gave up on visual DSLs with “Quadrant”. Instead we’ll see the DSL Toolkit getting more attention. In some Demos at PDC we saw diagrams in Visual Studio working together with SQL Server Modeling. That were already DSL Tools operating on “M” models.

Textual: “M” is at maximum a third of the “Oslo” vision. And the languages part again is only a subset of “M”. Maybe that helps seeing the priorities in the big context.

But still the commitment is alive. The November CTP has some great new features. For example more powerful “M” projections for grammar rules or basic debugging support.  Probably some day this will merge with the DSL Tools and we’ll have both graphical and textual DSLs support right within Visual Studio. I think and hope that the connection to SQL will not be very strong in the future.

Model-driven Development

As often when Microsoft starts (mis)using existing terms they or at least many of their employees just don’t get it. At least not in the first place.

An application that uses “M” to define the M in MVC is not automatically model-driven. It’s just a normal application that operates on data as most applications do. If you want to argue like that, then every C# file and all SQL table rows are models.

In my perception model-driven is, when models become part of the implementation. The Workflow Foundation is a good example for what model-driven means. You model something that is the source of truth for your application – instead of C# code.

If tools help building things like the workflow foundation based on either visual or textual DSLs, using interpreters or code generation, then they truly support the vision of model-driven software development.

“M” Samples Review: One-to-Many vs. Many-to-One

Isn’t this title funny? I like it 🙂

As I browse through the samples for the SQL Server Modeling CTP I find a lot of odd “M” code. This is sad, because Microsoft should know how to write “M” code. They are inventing it. Sure I’m expressing my personal opinion, but I think I have no hard time finding people that agree with me.

Why I do this in the “public”? Because I care! I like M and it’s concepts. For me M has the potential to become a great replacement for a variety of technologies. Most of all XSD, and maybe parts of SQL. That it comes with a SQL-code-generator is nice, though. But not too exciting. I still hope that the team adjusts their current direction. But more on that in a longer post 🙂

I’ll just start with one of the first samples I found:

Relationships

It comes with four M-Files:

asdf

 

 

 

 

 

So, what again is the difference between one-to-many and many-to-one?

OneToMany.m and ManyToOne.m

Well, this is OneToMany.m:

// original OneToMany.cs
module OneToMany {
    type A {
        Id : Integer32 => AutoNumber();
    } where identity Id;
    
    type B {
         A : A; 
    } where value.A in As;
    
    As : {A*};
    Bs : {B*};  
}

And this is ManyToOne.m:

// original ManyToOne.m
module ManyToOne {
    type A {
         B : B;  
    } where value.B in Bs;
    
    type B {
        Id : Integer32 => AutoNumber();
    } where identity Id;
    
    As : {A*};  
    Bs : {B*};
}

Do you spot the difference? I do! It would be easier to see, if we changed the ordering on the second one. Now compare this to the first one.

// reordered ManyToOne.m
module ManyToOne {
    type B {
        Id : Integer32 => AutoNumber();
    } where identity Id;
    
    type A {
         B : B;  
    } where value.B in Bs;
    
    Bs : {B*};
    As : {A*};
}

Do you see it now? Exactly. The XPath-function translate(‘AB’, ‘BA’) would have done the job! There is exactly NO difference between except for A and B switched around!

Usually the relationship the sample tries to illustrate is called one-to-many, even though in relational databases the reference goes from the many to one.

The funny part is over. Lets look at one-to-one and many-to-many.

OneToOne.m

This is OK. Although I do not like how coupled the code is. If I used the same style to express the same intent in C# people would blame me for violating every single principle we have learned over the past couple of years. I’ll write about what bothers me here in another post sometime.

// original OneToOne.m
module OneToOne {
    type A {
        Id : Integer32 => AutoNumber();
    } where identity Id;

    type B {
        A : A where value in As;
    } where unique A;
    
    As : {A*};
    Bs : {B*};
}

ManyToMany.m

// original ManyToMany.m
module ManyToMany {
    type A {
        Id : Integer32 => AutoNumber();
    } where identity Id;
    
    type B {
        Id : Integer32 => AutoNumber();
    } where identity Id;
    
    As : {A*};
    Bs : {B*};  

    type AB
    {
        ReferencedA : A;
        ReferencedB : B;
    } where value.ReferencedA in As && value.ReferencedB in Bs;
     
    ABs : {AB*};    
}

What is that. Natural modeling? What you really want to say is, that A has a n2m-Relationship with B, right? Now tell me, how this M-code is any better than SQL! It does not raise the level of abstraction, at least! IMHO this is not a solution for something that claims to be a modeling language, it’s a hack.

In“M” when you model something that naturally would be called a hierarchy or containment, the SQL compiler projects it as n2m anyway.

Relationship vs. Reference

Actually M doesn’t really support relationships (or associations) at all today. It just knows about references. What the difference is?

I’m not too sure if I get it right, but I’ll try.

A relationship is always coherent and integer. Something both sides agree on.

holding-hands1[1] 

A reference, though, is just something holding on something else.

detlef_46983[1] @Pitopia, Detlef

In relational databases relationships are modeled using references plus constraints.

So for example saying to the man, that he isn’t allowed to move as long as this baby holds his finger, you would enforce something that could be called an relation.

Summary

I think samples of this quality rather chase away people than buying them into the language. The language team should review all the documentation and samples. They should discuss them and give good guidance.

What I’ve seen so far is rather bad guidance.

Update: Also check out the MSDN Documentation on Relationships. It’s at least better than the samples. (found it after I wrote this post)

Migrating WBS from “Oslo” to SQL Server Modeling

I finally found some time to migrate two of my pet projects from the “Oslo” May CTP to the new SQL Server Modeling November 2009 CTP. I didn’t publish the sources so far, but I will soon.

Work Breakdown Structure

The first application that I want to migrate is a so-called work-breakdown-sheet (WBS). Originally it was a Excel sheet containing tasks and task estimates. Some smart calculations apply a set of statistics to give a forecast that is as close as possible to the real effort required.

The technologies I wanted to try out with that were mostly “Quadrant” and the “Repository”, now SQL Server Modeling Services. Also I wanted to test the team on their ambitious goal to make something that gets close to the experience of Access in ease of use.

The project contains of a set of “M”-based models and functions as well as some basic “Quadrant” customization. No plain old C# code needed, so far.

The basic domain model expressed in M (May CTP):

type Project {
    Name : Text;
};

type Story {
    Name : Text;
    Project : Project;
};

type TaskGroup {
    Name : Text;
    Story : Story;
};

type Task {
    Description : Text;
    Comment : Text?;
    Group : TaskGroup;
};

type Estimate {
    BestCase : Double;
    AverageCase : Double;
    WorstCase : Double;
} where value.BestCase < value.AverageCase
     && value.AverageCase < value.WorstCase; 

I’ll write an introduction to the project soon. But now, I’ll just log the changes I had to make in order to be able to get it running on the new CTP.

The Project File

In May, both Visual Studio and Intellipad used a *.mproj-File to collect multiple models in a project. In November this is embedded in a *.csproj-File. The easiest thing was to create a new “Oslo Library” in VS 2010 and just add the files that previously were linked in Wbs.mproj.s

Now I got the project both in Visual Studio 2010 and in Intellipad:

asdf[4]

asdf

Now lets build.

Syntax Changes

Lets walk through the errors I get, and how the syntax has to be changed to fix them.

  • First surprise. Intellipad builds the project without complaining. Well this message still leaves me unconfortable: Skipping target "MCompileCore" because all output files are up-to-date with respect to the input files.

So lets switch over to VS. The Messages I get are:

  • Error: Expected a ‘;’ to finish the extent declaration.
  • Error: Expected a ‘;’ to finish the computed value declaration or a ‘{‘ to start its body.
  • Warning: The ‘item’ expression is being deprecated. Please replace with an appropriate ‘value’ expression.

Those were easy to fix. Although the error messages look more explaining then they are.

Actually both first errors had to do with the new collection syntax. This goes for extent declarations as well as functions. This, for example:

TaskEstimates() :  PersonalTaskEstimate* {
    from e in RawTaskEstimates
    select MixEstimates(CalculateEstimate(e), e)
}

Needs to be changed to:

TaskEstimates() :  {PersonalTaskEstimate*} {
    from e in RawTaskEstimates
    select MixEstimates(CalculateEstimate(e), e)
}

The warning about the deprecated item keyword in:

RawStories : (Story & HasFolderAndAutoId)*
        where item.Project in RawProjects;

is solved by using value plus making sure, that the constraint goes inside the collection.

RawStories : {((Story & HasFolderAndAutoId) 
    where value.Project in RawProjects)*};

After having fixed those I get a next set of errors:

  • The left-hand side ‘value.BestCase’ of ‘in’ must  be compatible with the collection element type ‘LifelikeEstimateNumber’.

This seems to be a implicit change enforced by the new type checker in the current CTP. This is the “invalid” code:

type LifelikeEstimateNumber : Double where value < 24
    || value in SomeFibonacciNumbers;
    
type SomeFibonacciNumbers : {55, 89, 144, 233, 377, 610};

The problem here is, that the compiler doesn’t infer that SomeFibonacciNumbers actually is a collection of Doubles. So we have to tell her.

There are different ways to do so. We can either ascribe the first value in the collection to a Double by writing:

{55: Double, 89, 144, 233, 377, 610}

or we could ascribe the whole collection to a collection of Doubles

{55, 89, 144, 233, 377, 610} : {Double*}

or we can mix it with a collection of Doubles:

{55, 89, 144, 233, 377, 610} & {Double*}

I don’t really know, what the differences will be. I’ll just go for the last one, because it looks so nice 🙂

Project References

The next problem is, that my references to models from the “Repository” and “Quadrant” can’t be found. Sure, I didn’t copy the references from the mproj-file, either. As described here, you now have to reference dll files instead of the mx-files that where needed in May.

In my case, I needed a reference to “C:\Program Files\Microsoft Oslo\1.0\bin\Repository.dll” in order to support the SQL Server Modeling Services type HasFolderAndAutoId.

Now all the “M” code seems to be ok. The only thing is, that some concepts do not compile to SQL.

For this code:

type LifelikeEstimateNumber : Double where value < 24
    || value in SomeFibonacciNumbers;
    
type SomeFibonacciNumbers : {55, 89, 144, 233, 377, 610} & {Double*};

type TaskEstimate : (Estimate & {
    Task : Task;
}) where value.BestCase in LifelikeEstimateNumber
    && value.AverageCase in LifelikeEstimateNumber
    && value.WorstCase in LifelikeEstimateNumber;

i get the following error for each occurence in the last three constraints:

  • Not yet implemented: There is no SQL expression generator to handle the expression ‘TypeRef: Reference, resolve to get the target’.

It seems, that the constraint expressions can’t handle types completely. I’ll just refactor that to an inline expression plus an extent for the allowed high estimates:

AllowedHighTaskEstimates : {Double*} {
    55, 89, 144, 233, 377, 610};

type TaskEstimate : (Estimate & {
    Task : Task;
}) where 
    (value.BestCase < 24 
        && value.BestCase in AllowedHighTaskEstimates)
    && (value.AverageCase < 24 
        && value.AverageCase in AllowedHighTaskEstimates)
    && (value.WorstCase < 24 
        && value.WorstCase in AllowedHighTaskEstimates);

Build succeeded!

Well I cheated a little bit, because I removed the models that drive the quadrant customization. But since those have changed completely anyway, I’ll just rebuild the requirements.

Deployment

For the May CTP I had a bunch of batch files to manage the build and deploy process. This was also, because I had to install a external SQL function before deploying my module. Lets see how this works with the deployment integration in Visual Studio 2010.

I configured the connection string in the M Deploy settings to a local database called ‘WbsTestRepository’. But trying to deploy the solution fails with a couple of errors. It seems, that the repository is not deployed automatically, allthough I added a project reference.

Repository Issues

In Wbs I want to use the Repository (now SQL Server Modelling Services) Rolders as well as the catalog which stores data about my models.

You still need to install the “Repository” on your database using the command line. This should be necessary only once, though.

The commands I ran were (described here):

'create a clean db
mx create /d:WbsTestRepository /s:.\SQLExpress /force
'install the rep
mx install Repository.mx /database:WbsTestRepository /server:.\SQLExpress

But now redeploying in VS yields another expected error:

  • error M6040: Sql Exception: Cannot find either column "itemis.Wbs" or the user-defined function or aggregate "itemis.Wbs.Power", or the name is ambiguous.

Wbs needs the power-function to compute some values. Since M doesn’t know about it, and neither can express it natively, I had to model an so called extern:

extern Power(Expression : Double, Power : Integer32) : Double;

This just makes a concept available to M that has to be implemented in SQL. Since we want to ensure this in the installation, we have to compile it along with the M files. This is done by adding a SQL file containing the “create function [itemis.Wbs].[Power] …” script and set the compile action to “MPreSql”.

As I almost expected, redeploying the model doesn’t work. I’ll post a workaround for that soon.

  • error M6040: Sql Exception: The module ‘itemis.Wbs’ is already present in the database.

But for now we just put the two lines in a batch file to recreate a fresh repository before each deploy.

The next problem I run into is:

  • Sql Exception: Target folder must be specified.

There are two ways to add a target folder to your initial values. The documented one suggests adding your Folder to the FoldersTable and then specifying that value in every single instance. The much cleaner and simpler is, too set the target folder globally for the whole project.

Since there is no Visual Studio support for that, you have to add this property to the csproj-File manually:

<MTargetFolder>Repository/Wbs</MTargetFolder>

You will also have to create the folder along with the repository every time you deploy, using the following command:

mx createFolder "Repository/Wbs" /database:WbsTestRepository /server:.\SQLExpress

The next thing is some complaints about my constraints on TaskEstimate. Since I have no time left, and those constraints should be weak, instead of hard CHECK constraints anyway, I’ll just comment them "away” for now.

Deployed successfully.

Wonderful. Now lets go to “Quadrant” and see, how we can make use of the model with it’s sample data.

asdf[1] 

Summary

It were not really the syntax changes that made trouble, but rather the integration with Visual Studio. I had a couple of simple customizations for Quadrant, but I’ll rewrite them soon.

The only comment I have to make so far, is, that it is totally unacceptable to have a development cycle that takes more than 5 seconds from M over compile, deploy and look at the changes in Quadrant. Now it takes more than 30 seconds.

Future Plans

I’ll probably elaborate more on WBS next week. I’ll also migrate my DSL pet project called “Web Layout DSL” and integrate it with a MVC Client Application over WBS.

So stay tuned.

Tired of hearing “M” is to “T-SQL” what X is to Y…

I have heard a couple of variations of these analogies. I do not like them. I think they are simply absurd.

At last PDC, “M” was to “SQL” what C is to Assembler. This year it was, what VB is to C. And now I even read this:

The code name “M” language is like a more manageable (though more limited) form of Transact-SQL, the language normally used to describe data schema and values.

Kraig Blockschmidt, Microsoft Data Development Technologies: Past, Present, and Future 

“M” has some overlaps with T-SQL, ok. But far from every concept in “M” can be translated into T-SQL. What about structural subtyping? Types without identities? Polymorphic references and function arguments? Languages/DSLs? Ordered collections? Lot’s more.

And only a very small, although useful subset of T-SQL maps to “M”. Also most of the translation to SQL is opinionated, not natural.

What the schema and values part of M compares much more to, is XML and XSD.

Would you even try to compare XML to T-SQL?

Updates on what Oslo is and Quadrant not is (September 2009)

It has been more quiet around “Oslo” the last month. Maybe just about everybody is on vacations. Or people feel that everything will change with the PDC in November and are afraid of publishing nonsense.

Nonetheless, I felt it’s time for an update on what I think, heard and read about “Oslo”.

I divided my post in two sections:

  • Information about “Oslo”
  • What I think about “Oslo” today

have fun!

Some Information about “Oslo”

For those who don’t know, “Oslo” is the current codename for Microsoft’s forthcoming modeling platform, which is available as CTP Download since back in October 2008.

If you want to read more about what Oslo is about, I recommend those Resources:

Well, since then Microsoft has released two more CTP releases (January and May), written a lot of documentation and posted quite some videos and samples. If you ask me, it’s yet too much for such a young and undone technology. Oslo’s modeling language “M” has and The "Oslo" Modeling Language Specification, which yet has been implemented in JavaScript by Mathew Wilson (jsmeta).

The community did also care a lot, and there are even companies investing in tools around “Oslo”. Telrik published two projects on their Labs Site. A tool for comparing and migrating M as well as LINQ to M. There are even trainings offered by Agilitrain and PluralSight.

Some recommended links:

What I think about Oslo today
(May CTP + Announcements)

First of all I want to say, that I’m happy Microsoft released Oslo in such an early state. I think they know the pros and cons of such an open process. The community can help with forming the product, and companies can start to invest early in what they think might be valuable for the future. But It also means more friction for any changes that are made.

I have used M for defining schemas and languages and also played around with the Repository and Quadrant. As Microsoft also states, it’s early Alpha. I stumbled over many bugs which I still plan to report and blog about. But that is OK, no one ever said it was production ready.

“M”

So far I like the schema part of M, also called MSchema. It has a very concise (compared to XSD) c-style syntax and covers a lot of what I want to express when modeling information structures. The M-graph (for values) syntax is also OK, while I don’t like the MGraph API. M-constraints let you restrict your types in a nice way. What I don’t like here, is the missing support for weak constraints. Named M-queries (similar to LINQ syntax), are a nice way to query M structures.

M-grammar is useful for DSLs. I think it could be more opinionated. I feel MS is striving for an expressiveness that let you describe all computer languages in the world using MGrammar. This makes it more complex than necessary for covering DSLs. At the same time it doesn’t support nesting of languages, which would be especially useful for DSLs, because you often need to talk to external models (e.g. pinvoke). The support for editor customizing (crucial language workbench feature) as it is today is not sufficient and too hard to configure.

Another feature I miss here is referencing between nodes and even across files (linking + scoping). For now all references are just values (ids), and the output of a DSL program will be a tree model, no graphs!

The Repository

The Repository basically offers some features on-top of SQL server as are row-level security, hierarchies, localization, versioning, additional constraints. All those features are plain SQL “libraries” in conjunction with M-models which also are compiled down to SQL. I don’t yet know what to think about the Repository.

Naming / Packaging

In the last couple of weeks the Oslo team published two posts that confirmed some of my speculations.

Let’s start with Doug’s Post: On “Oslo” at Douglas Purdy

In this post he basically makes two statements:

The only thing that I feel bad about is that we kept the “Oslo” name around so long (you will see that change at the next PDC), which has continued to be a confusing point for customers (“I thought Oslo was your new SOA platform”).

Douglas Purdy

I agree. It was confusing. Although people slowly start to accept “Oslo” as for “Modeling”.

Oslo and EF / Data Programmability

With this in mind, we made a decision to merge the Data Programmability team (EDM, EF, Astoria, XML, ADO.NET, and tools/designers) and the “Oslo” team (“Quadrant”, Repository, “M”) together.

Douglas Purdy

I don’t yet know what to think about this. “Oslo” is not and should not evolve to an O/R-Mapper. M’s type system is structural and doesn’t map well to strongly typed objects as used by EF. I can see this choice limiting the modeling capabilities of Oslo. But I guess we have to wait and see.

Quadrant. A graphical Editor?

The other post, confirming my fears about Quadrant was Model Citizen : What’s So Compelling about "Quadrant" Anyway?.

Back in November last year, when I wrote a sum-up post about “Oslo” I concluded Quadrant:

Yes. Quadrant lets you interact with models graphically. It’s highly generic, customizable and it looks great.

Lars Corneliussen, November 2008, What "Oslo" is and is not

I concluded this from the official statement about Oslo plus some videos and screenshots I had seen.

A tool that helps people define and interact with models in a rich and visual manner

Doulas Purdy, September 2008, What is Oslo?

But here is the smackdown:

Microsoft code name "Quadrant" is a ‘tool for viewing and editing SQL data,’ but… so what?

Michael Murray, July 2009, What’s So Compelling about "Quadrant" Anyway?

As I understand today, and as it shows up in the May CTP, it is not a graphical editor or graphical editing toolkit but rather a light WPF-version of Microsoft Office Access that understands Oslo Modeling concepts and relationships and builds up default editors in a generic manner. This is still useful (if it is free), but not far as useful as what I hoped Quadrant to be.

Please, Microsoft, make Quadrant a graphical editing toolkit with good support for configurable diagramming and any custom WPF editors. It should also have the plug-in model VS2010 offers for sharing any extensions.

The “Oslo” Story

Microsoft tries to sell “Oslo” as if it was all one story. It’s a lie.

There is tons of impedance mismatches that restrict you in many ways.

Modeling Structure

  • M in general uses structural typing (duck typing, supports mix-ins) and supports real graphs (including references)
  • MGrammar ASTs are hierarchal (tree structure) and for now only supporting nodes and strings.
  • Databases store flat relational data,
  • and objects in the .NET world are typed nominally (no multiple inheritance).

DSLs + Repository

There is no story for “DSLs and the repository”, and there is not yet a good story for any runtime support off the repository or DSL files. It’s basically what you had before. You can either access the database via ADO.NET or an O/R-Mapper or you run directly off the parsed MGraph-AST representing your DSL-Script, which feels like visiting xml documents. M has a nice LINQ-ish query language, but that doesn’t work in memory against a graph.

Querying

M has good support for complex data structures. As said there is no support for in-memory queries. But even the database implementation is limited by it’s relational backend. Even though queries can consult complex properties for sorting or filtering, it can only return rows with a list of scalar fields.

Constraints

Most constraints on types are only implemented in the SQL-Mapping. Also here there is no in-memory implementation that would validate your model against a schema. Basically the M-compiler generates a database schema including checks that would not let you insert invalid data into the database.

Data and schema evolution

There is this dream about capturing requirements in quite fuzzy ways and then piece for piece add details to them – until they have reached some formal state that might be executable. This sounds nice in theory, but there is no chance to implement this stuff. M is very easy to change, and it is easy to add constraints and refactor schema structures. But there is no story around how to let your data evolve together with your schemas using the Repository. So, besides nice theories, Oslo doesn’t help here.

More to come

There will be new content and Chris Sells also announced a fresh CTP around this years PDC in November.

So far, only one session has been scheduled, but watch this list for more sessions to come: Microsoft PDC09 – Modeling Sessions

Hope to see you in LA in November!

Microsoft “Oslo” May CTP available (Including Quadrant)

The "Oslo” team has released the third CTP of Microsoft’s forthcoming modeling platform.

Some of the  changes are:

For more detailed information check out the team announcement and the release notes.

New Installer

oslo setup

Empty Quadrant Workspace

empty quadrant

Intellipad Splitting

intellipad-multisplit And yes, I’ll be blogging about my web-layout DSL 🙂

kick it on DotNetKicks.com

Please stop emphasizing the SQL Mapping part of Microsoft “Oslo”

Just my random reaction to 2009 Lang.NET Symposium – Language and Data.

As all of us know these days, Oslo is about a language, a repository and Quadrant. We all know the hard parts are the language and quadrant.

I have the gut feeling that the repository just is about the data backing for  the glue between M and Quadrant. This is the tool that has the potential to bring in money and I do understand it needs a repository.

But since PDC we have not heard anything about Quadrant, so for now all is about the language “M”. We also agree on that we won’t model customers and orders in Quadrant.

So why the heck do we still have to stand all that SQL mapping demos?

Just show us the modeling part… And show us Quadrant as soon as you’ve got something to show.

Microsoft “Oslo” MGraph – the next XML?

Microsoft’s upcoming “Oslo” modeling initiative is about tools and languages. MGraph is the piece within the language “M” that defines values, while MSchema is for schemas, functions and constraints and MGrammar is for textual DSLs. “Oslo” is still CTP and it will take some time until all concepts are available for production use.

By then, Microsoft plans to publish an open specification, such that everyone who wants to can implement the “M” language. Their ambition is to make it be as broad as XML is today.

Anyone can implement it. We want this approach wide spread on a variety of different platforms. We want it to be as broad as Xml is today.

Douglas Purdy, A Lap around “Oslo”

Today we have lots of XML on the wire. There’s also lots of JSON.

I want to see MGraph get there as well.

Jeff Pinkston alias Pinky:-), MGraph as a data rep

What is MGraph?

MGraph at it’s base is not a language. It is a simple contract for storing structured data in form of a labeled directed graph. This is a set of nodes where each node has an optional label and a set of successors, each of which may be a node or any other object.

The idea behind that is, that every structure can be exposed as a MGraph just by implementing the following interface, which is the core API behind MGraph.

I added some comments for easier understanding.

// Exposes whatever structure as an MGraph
public interface IGraphBuilder
{
  // Checks, if the object submitted is a value or a (custom) node.
  bool IsNode(object value);
  // Retrieves a comparer for the (custom) node objects.
  IEqualityComparer NodeComparer { get; }
  // Extracts the label from a (custom) node.
  object GetLabel(object node);
  // Extracts the successors from a (custom) node.
  IEnumerable GetSuccessors(object node);
  // Gets a (custom) node with a label.
  object DefineNode(object label);
  // Sets successors to a (custom) node.
  void DefineSuccessors(object protoNode, IEnumerable successors);
}

As you see, even the node is not specified by an interface or a base class. Both labels and successors are extracted by the visiting graph builder.

If you want, read more about the MGraph Api here.

MGraph as a language

What I do care more about is how MGraph’s textual notation looks like and how it compares to XML.

On MSDN you can find a language specification covering MSchema and MGrammar which both use parts of MGraph, but in a slightly different manner. Microsoft definitely plans to bring those pieces together

Today MGraph is used for values in MSchema extent initializers as well as for the AST (Abstract Syntax Tree) productions in MGrammar.

The basic syntax of MGraph very similar to JSON:

label { 
  otherLabel { "value" },
  "value",
},
"value"

As mentioned previously a successor can be either a node or a value. A value is just written directly, while a node is split into a label followed by its comma-separated successors within curly braces.

The same data as a XML-fragment would look like this:


  value
  value

value

One of the major differences is, that MGraph doesn’t distinguish attributes and elements. As XML is used today, anyone use attributes and elements according to their personal taste anyway.

Typed values

The next great difference is, that values are not just strings, but typed. Some of the intrinsic types are Text, Logical or Number.

mynode
{
  text { "some text" },
  number { 1234 }
  logical { true }
}

Find a list of the supported types in chapter 3.5 Intrinsic Types in the “Oslo” Modeling Language Specification.

Escaped Labels

While XML-elements and attributes are restricted to QName, a label in MGraph can be any object. They way how this is expressed in the textual syntax is not finished yet, but in MGrammar productions more complex strings are defined with an id-function.

id("some label xyz") 
{
  true, 
  id("another node") { "value" }
}

Ordered and unordered successors

In order to make a mapping to relational structures easier, successors are not sorted by default. In order to sort the successors, they have to be encapsulated in an integer-labeled node.

{
  0 { "value1" },
  1 { "value2" }
}

Which alternatively also can be expressed by brackets instead of braces. In the “M” jargon this is called a sequence.

[
  "value1",
  "value2"
]

Single successor nodes, or labeled values

A named value in MGraph is just a labeled node with a single value successor. The equals-sign is just some syntactic sugar for better read- and writability. In the “M” jargon this is called Entity, but this name is subject to change. Record structure might be a better name.

person
{
  name = "John Smith",
  age = 24
}

equals to

person
{
  name { "John Smith" },
  age { 24 }
}

Better than XML?

XML is great. Mostly because it can be read by almost every system, not because it has such a nice syntax. It was never meant for the purpose it is used for today either. It is a markup language for defining additional metadata onto text.

But what XML is broadly used for today, is configuration files, transport messages and even internal DSLs. For this kind of information, that has more structuring elements than data, XML is way to verbose.

Therefore I think MGraph with its tight syntax has the potential to become a great and broad alternative.

What do you think?

Comparing XML, JSON and MGraph

Continue reading