Re: YAML compared to MGraph

Jakob Voss <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <[email protected]>
Oren Ben-Kiki wrote:

> According to the rumor mill
> http://www.infoq.com/news/2010/08/quadrant-drops
 > Microsoft is not really pushing it.

That would answer why I does not beat XML as promised ;-)

> The M model isn't identical to YAML's (e.g., collections are unsorted
> and arrays are second class).
> M isn't a superset of JSON, YAML is.
> M is tightly coupled with the Microsoft ecosystem.
> There are plenty or differences...

I found a good summary at 
http://msdn.microsoft.com/en-us/library/dd878360.aspx that says 
(summarized):

An "M" values instance is a directed, edge-labeled multi-graph[1]. Each 
node is either atomic, holding a single value, or non-atomic, holding a 
multiset of outgoing edges. Nodes carry an optional brand. Brands are 
strings. Edges outgoing from a node are either unlabeled or uniquely 
labeled, relative to their source node. Labels are either strings or 
integers. A value held by an atomic node is either of an "M" values 
classified type or of unclassified type.

In the same way you can describe YAML:

A YAML representation graph instance is a directed edge-labeled[2] 
multi-graph. Each node is either atomic, holding a single value 
("scalar"), or non-atomic, holding a multiset of outgoing edges. Nodes 
carry an optional tag. Tags are either URIs ("global tags") or strings 
from the URI character set ("local tags"). Edges outgoing from a node 
are either unlabeled and ordered ("sequence") or uniquely labeled 
("mapping"), relative to their source node and defined by recursion, as 
labels are nodes. A value held by an atomic node is a Unicode string, 
optionally classified by a tag.

It looks like "M" can model ordered collections, records, tuples, lists 
etc. by additional constraints just like YAML models sets and multisets 
(they are not directly supported but must be emulated). The "M" concept 
of "brands" is similar to YAML's tags. I find both model and syntax of 
YAML and "M" look very similar - they share much more then for example 
XML and one of the two.

Remarks:

[1] "M" is a multigraph, as collections can contain the same node 
multiple times.

[2] edge-labels are nodes themselves - this is the most unique features 
of YAML compared to other data serialisation languages. And it's one of 
the most rarely used features I think. Arbitrary mapping keys make 
validating YAML as complex as graph isomorphism testing which is not 
solvable in polynomial time for the worst case. Do you know of any YAML 
implementation that supports graph isomorphism testing?

Cheers,
Jakob

> On Fri, Aug 6, 2010 at 11:11 AM, Jakob Voss <[email protected]
> <mailto:[email protected]>> wrote:
>
>     Hi,
>
>     I stumbled upon Microsoft's "M" aka project Oslo which includes the
>     MGraph language. It is often compared with XML but looks much more like
>     YAML. Has anyone had a look at it and compared it with YAML? Some good
>     introductions:
>
>     http://startbigthinksmall.wordpress.com/2008/12/10/mgraph-the-next-xml/
>     http://blog.jclark.com/2008/11/some-thoughts-on-oslo-modeling-language.html


-- 
Jakob Voß <[email protected]>, skype: nichtich
Verbundzentrale des GBV (VZG) / Common Library Network
Platz der Goettinger Sieben 1, 37073 Göttingen, Germany
+49 (0)551 39-10242, http://www.gbv.de

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.