Type Hierarchy

Hi,

Would XQuery's type system be easier to understand if we define
its type to (always) consists of the following type-components

    Unit-Type(QName) + Content-Type(QName) + Occurrence

to be orthogonal along 3 hierarchies as follows,

// Unit-Type(QName)
  item(*:*) == anyTree(*:*)
        |-- node(*:*) [7 node types ?]
        |    |-- anyElement(*:*) == Element(*:*)
        |    |    |-- Element(QName)
        |    |
        |    |-- anyAttribute(*:*) == Attribute(*:*)
        |    |   |-- Attribute(QName)
        |    |
        |    |-- Comment(*:*)
        |    |
        |    |-- anyProcessingInstruction(*:*)
        |        |-- ProcessingInstruction(NCName)
        |
        |-- anySimpleType(*:*)         { appears to simultaneously define
            |-- SimpleType(QName)   { the unit-type and content-type

  //Content-Type(QName)
     anyType(*:*)
        |-- anySimpleType(*:*) == SimpleType(*:*)
        |    |-- SimpleType(QName)
        |         |-- <hierarchy for built-in type follows>
        |
        |-- anyComplexType(*:*) == ComplexType(*:*)
             |-- ComplexType(QName)

 // OccurrenceIndicator(min,max)
 // - since the value of an XQuery expression is always a sequence
    Star(0,*)
         |-- Plus(1,*)
         |-- QMark(0,1)


Firstly, casting is independent on each of the hierarchy.
Secondly, up/down casting is legal only if the cast remains on the same
lineage.
Lastly, if any type-component is not defined, it defaults to its
respective root.


Thanks.
Kuan Hui

Received on Wednesday, 23 January 2002 20:50:14 UTC