OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] RE: List of differences between XML and JSON?

On 5/1/2015 3:43 PM, Costello, Roger L. wrote:
Below is a fantastic response from Walter Perry. Thank you Walter!
(Walter gave me permission to forward his message to the list)


The fundamental semantic premise of XML markup is the "hasA"
relationship; that of JSON is "isA". This is the opposite of what one is
likely to see at first blush, and it has taken me a full 20 years to
understand how the syntax of XML enforces the "hasA" view, ultimately to
the exclusion of "isA".

Sparing the 20-year learning curve: the XML syntax permits only the
expression of "hasA" relationships between entities--even where those
'entities' are expressed in the XML attribute syntax (color=blue means
only that the enclosing entity *has* an identified color and that that
color *has* the identified value 'blue'). The Generic Identifier itself
of an XML entity expresses no more than that the entity *has* an
identified label, and specifies its instance value. The axes of XSL are
those along which the XML syntax permits the semantics of identified
"hasA" relationships to be expressed.
With respect to Walter Perry, whose ideas I always read with interest, and despite the wisdom in what he says above about XSL axes, XML markup isn't fundamentally limited to "hasA". Consider RDF. In RDF, a thing springs into existence when it is referred to, if it doesn't exist already. RDF, in fact (and OWL, for that matter), is an "existential conjunctive" language, which means that it can declare both isA and hasA notions. RDF graphs can be expressed with an XML syntax. Therefore, (at least some) XML languages are able to express isA.

Similarly, relational databases can express isA. Table definitions define the relations, which are the hasA. The actual data populating the tables declare existence, which is the isA. That is, each row of a table declares "there is a relation, and its components have these values: ...". That's about as much of an "isA" as you can get. And all this can be represented with XML if someone wants to.

Remember that XML is not actually a language but a toolkit for specifying languages. JSON is a language.

As for some of the other things people have been saying on this topic the last few days:

- XML only has hierarchy, JSON is more general. No, XML expresses *relationships*, which may or may not be hierarchical. You can describe fully non-hierarchical data, such as maps or graphs, with several different methods. Think of RDF, or XLink (which describes networks of directional links). ID/IDREFs are one way among others. Understanding nested elements as hierarchies is a matter of interpretation and convention, not an inherent limitation. And <strong>inline markup</strong> is something else again, not really in that hierarchical/nonhierarchical axis.

- JSON objects can be shared, XML objects can not. No, XML "objects" can easily be shared, for example by using ID/IDREF references or by using entities.

- XML can express object identity, JSON cannot. No, in JSON just add an "identity" property to an object and you have got object identity. In fact, that's how, in essence, it's done in RDF.

There's an older but still interesting book that bears directly on similarities between XML languages and JSON (although JSON wasn't around then), and what kind of data can be transmitted/exchanged with them:

Data on the Web: From Relations to Semistructured Data and XML
by Serge Abiteboul, Peter Buneman, Dan Suciu

Here, JSON is very close to their "semistructured data".

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS