Compositions in XML


Mapping Compositions to XML

Compositions and Relations are mapped to elements in XML

Note:
Attributes were not chosen because they are just boiled down elements. Everything you can do with an attribute is possible with elements, but not the other way around.

Restrictions imposed by XML

XML defines a hierarchical model (a-cyclical graph). This restricts compositions from being related by multiple compositions.

Example

The haschild relation

Assume we have a family with a grandparent, a parent and a child.

The following relations hold:

this would map to the following XML document

<grandparent>
 <haschild>
  <parent>
   <haschild>
    <child/>
   </haschild>
  </parent>
 </has>
</diputree>

Assume that we have two children, then we can use Canonical XML representation or Compressed XML notation

Canonical and compressed mapping

Canonical mapping

the Canonical mapping would result in the following XML document

<grandparent>
 <haschild>
  <parent>
   <haschild>
    <child/>
   </haschild>
   <haschild>
    <child/>
   </haschild>

  </parent>
 </has>
</diputree>

Compressed mapping

the Compressed mapping would result in the following XML document

<grandparent>
 <haschild>
  <parent>
   <haschild>
    <child/>
    <child/>
   </haschild>

  </parent>
 </has>
</diputree>

This looks like one relation with two objects. However these are actually two compressed relations each with only one object.


diputree documentation © 2000 dipu