[Swift-user] XDTM

Mihael Hategan hategan at mcs.anl.gov
Fri Aug 14 11:30:58 CDT 2009


On Fri, 2009-08-14 at 10:38 -0500, Michael Wilde wrote:
[...]
> >    5. I am still confused when talk about XML Data Type and Mapping. 
> >       Where is the XML representation?  Is it the .xml that gets
> >       generated when run the swift code?
> 
> No, the XML - if indeed it still exists - is only internal. I described 
> it this way in an earlier post:

The Swift type declarations are "compiled" into XML schema since XML
schema is sufficiently powerful to express the structure of Swift
user-declared types. That piece appears in the <types></types> header of
a .kml file. However, it has nothing to do with mapping, so it's
probably not to be called XDTM.

> 
> --
> 
> "As Swift evolved from its early prototypes to a more mature system, the 
> notion of XDTM evolved to one of mapping between filesystem-based 
> structures and Swift in-memory data structures (ie, scalars, arrays, and 
> structures, which can be nested and typed).
> 
> This is best seen by looking at the "external" mapper, ...
> 
> In other words, it still has the flavor of XDTM, but without any XML 
> being visible to the user. It meets the same need but is easier to use 
> and explain."
> 
> --
> 
> When XDTM was first implemented, by Yong Zhao, he used XML within Swift 
> to represent the mapping. I am not even sure if this XML representation 
> is still used in the current implementation, or not. I suspect *not*.

XML is used by virtue of the .kml files being XML (loosely). But it
isn't and was never (in any version of Swift/VDL2 compiled to Karajan I
know of) a representation of the mapping, but a declaration of the
mapper:

  <vdl:mapping descriptor="single_file_mapper">
    <vdl:parameter name="file" value="0231-complex-type.out"/>
  </vdl:mapping>

That's the translation of 
... <"0231-complex-type.out">;

When the first swift prototype was written we went directly to
representing swift data as a tree of in-memory objects, and mappers as
being attached to the root of each such tree. We figured that we could
achieve better scalability if we avoided storing actual mappings when we
could and used algorithmic ways to calculate the mappings on-the-fly.

In other words, it takes more (O(n)) space to store "(1, 1), (2, 4), (3,
9), (4, 16), ... (n, n^2)" than to store "f(k) = k^2, x = {1..n}" (O(1))
but they are the same function.

Mihael




More information about the Swift-user mailing list