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

Re: RE: XML data interchange format: Flatter isbetter

  • From: =?utf-8?Q?Jens_=C3=98stergaard_Petersen?= <oesterg@gmail.com>
  • To: "=?utf-8?Q?xml-dev=40lists.xml.org?=" <xml-dev@lists.xml.org>, "=?utf-8?Q?Costello=2C_Roger_L.?=" <costello@m...>
  • Date: Mon, 3 Nov 2014 16:35:31 +0100

Re:  RE: XML data interchange format: Flatter isbetter
Hi,

With XML, you can be both flat and fat, if you flatten your document in document order and keep track of the depth of each element. If you look at <https://stackoverflow.com/questions/20729593/transforming-tree-to-sequence-of-elements> and <https://stackoverflow.com/questions/21527660/transforming-sequence-of-elements-to-tree>, you will get the idea. 

There are things you can do with your document in its flat form that are hard to do with it in its fat form. I have used this in a script I have played around with recently, in which I gather the unique paths of a document in a flat document and then use these paths to construct a minimal fat instance of all unique paths, <https://github.com/jensopetersen/tei-compactor>.

Jens

On 29 Oct 2014 at 18:08:33, Costello, Roger L. (costello@mitre.org) wrote:

Thanks for the great feedback!

 

I received feedback from a couple colleagues. Below is my response to them.  /Roger

 

Scott wrote:

 

Dr. Scott Law of Data #3:

 

Hierarchical data structures are great, if it's your hierarchy.

Otherwise they [expletive deleted].

 

I like it!

 

how do I know that <metabolism> is related to <picker>

instead of <Vineyard>?

 

Great question! I am not sure. Perhaps that knowledge should be made available out-of-band (not hardcoded into the XML)?

 

David wrote:

 

the real issue is, what’s the data model separate from XML?

 

My thinking is that with most data-modeling problems many different models could be created. That is, there is no one, true model.

 

For example, with my grape vineyard one expert modeler argues that the correct model is this:

 

                A Lot may have zero or more Pickers on it.

 

This XML is a perfect representation of that model:

 

<Vineyard>

    <Lot id="1">

        <ripe-grapes>4</ripe-grapes>

        <Picker id="John">

            <metabolism>2</metabolism>

            <grape-wealth>20</grape-wealth>

        </Picker>

    </Lot>

    <Lot id="2">

        <ripe-grapes>3</ripe-grapes>

    </Lot>

    ...

</Vineyard>

 

Another expert modeler argues that the correct model is this:

 

                There are Lots. There are Pickers. A Picker

                may be located on one and only one Lot.

 

This XML is a perfect representation of that model:

 

<Vineyard>
    <Lot id="1">
        <ripe-grapes>4</ripe-grapes>
    </Lot>
    <Lot id="2">
        <ripe-grapes>3</ripe-grapes>
    </Lot>
    <Picker id="John" locatedOn="1">
        <metabolism>2</metabolism>
        <grape-wealth>20</grape-wealth>
    </Picker>
    ...
</Vineyard>

 

So which expert modeler has the correct view of the world? And thus, which XML representation is correct?

 

It seems to me that both models/representations are well-suited to some consumers and horrible to others.

 

So I am proposing this: Be model-agnostic in the XML representation. That is, give consumers a flat XML and let them parse it to represent whatever model is best-suited to them.

 

Thank you!

 

/Roger



[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.