XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
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] What is a sematic data model?

On Fri, 12 Nov 2021 08:33:05 -0500, Ihe Onwuka wrote:
>  Except you cannot generally do that because XML and JSON are not
> representationally equivalent so an XML model translated to JSON will be
> lossy.

Okay, so this is generally true (although I expect cries of outrage 
from those who wish to point out that JSON can represent things that 
XML cannot so that it's lossy to translate from JSON to XML (as well, 
or instead)), but that's because it's general cases, generalized 
conversion tools.

If you want a solid JSON to XML and XML to JSON conversion, then you'll 
have to constrain both XML and JSON to subsets, and restrict data usage 
to those subsets. Then define the conversion between these two language 
subsets (with any options you care to support, and configuration or 
negotiation to specify the use of those options), not the whole thing. 
This gives fairly good results (the principle in general is that you 
have to be able to round trip it without loss; if you can do that, the 
model is working within specs).

If you try to do the same thing for the corpus of all documents 
matching the XML grammars and all documents matching the JSON grammars, 
you're going to either stumble, or write more documentation covering 
the corner cases and underspecified behaviors than both parts of XML 
Schema. But if you start by constraining to a better-defined, 
interoperable-by-design subset (of both sides), you can get reliable 
results.

Note that XDM in its modern forms also offers greater interoperability 
for generalized processors and converters (I'm still in XPath/XSLT 
2.0/XQuery 1.0 land, though, so not going to do more than acknowledge 
that).

Amy!
-- 
Amelia A. Lewis                    amyzing {at} talsever.com
    Songs and fame are vain endeavor--
    only two things fail us never,
    only two things last forever--
    sorrow and love, sorrow and love ....
                -- The Last Song of Sirit Byar


[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