[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: What is a sematic data model?

  • From: Ihe Onwuka <ihe.onwuka@gmail.com>
  • To: Michael Kay <mike@saxonica.com>, Amelia A Lewis <amyzing@t...>
  • Date: Fri, 12 Nov 2021 11:42:18 -0500

Re:  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.

>Amy wrote
---------------------------------------------------------------------------------------------------------------------
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 
-----------------------------------------------------------------------------------------------------------------------
Ihe replied
But this overlooks the other problem highlighted that a UML model cannot be properly represented in JSON because JSON does not support subtyping whereas XML does. 
You can't paper over that in an OO model.  It's a chasmic deficiency. 


On Fri, Nov 12, 2021 at 8:33 AM Ihe Onwuka <ihe.onwuka@gmail.com> wrote:
On Fri, Nov 12, 2021 at 8:11 AM Michael Kay <mike@s...> wrote:
>
> Michael, what is a "semantic data model"?

A semantic data model tells you how the items in your data relate to things in the real world. An XML document might have a <product> element, but it doesn't tell you what a product is - and it's always more complicated than you think (for example, if you put your cornflakes in a Christmas-themed package one week, does that make it a different product?).

> Would you give an example of a semantic data model for XML and an example of a semantic data model for JSON, please?

You're putting the cart before the horse. You create a semantic data model for a problem domain (for example, in UML), and then you define XML or JSON representations of the data in that domain. The conceptual data model comes first, the concrete realisations come second.

 
Except you cannot generally do that because there is an impedance mismatch between JSON and UML meaning you cannot faithfully represent a UML model in JSON 


> How are their semantic data models used to transform XML to JSON and vice versa?
>

You design an XML representation of the data model, and you design a JSON representation of the data model, and then you work out how they relate to each other, by referring back to the data model.


 Except you cannot generally do that because XML and JSON are not representationally equivalent so an XML model translated to JSON will be lossy.


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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.