Data Model pseudo-code: multiple declarations

XQuery 1.0 and XPath 2.0 Data Model
W3C Working Draft
7 June 2001

The pseudo-code appears to allow multiple declarations of the same
identifier, as long as it is declared as functions with disjoint domain
categories. Thus:

    4.   parent : Node            -> Sequence(0,1)<...>
    8.   parent : SchemaComponent -> Sequence(0,1)<...>

    4.   string-value : Node        -> xs:string
    5.2  string-value : SimpleValue -> xs:string

    4.1  children : DocumentNode -> Sequence(1,*)<...>
    4.2  children : ElementNode  -> Sequence<...>

    4.2  declaration : ElementNode   -> SchemaComponent
    4.3  declaration : AttributeNode -> SchemaComponent

    4.2  type : ElementNode   -> SchemaComponent
    4.3  type : AttributeNode -> SchemaComponent
    5.2  type : SimpleValue   -> SchemaComponent

    4.2  typed-value : ElementNode   -> Sequence<SimpleValue>
    4.3  typed-value : AttributeNode -> Sequence<SimpleValue>

That's fine. But consider the declarations of "name":
    4.   name : Node            -> Sequence(0,1)<xs:QName>
    4.2  name : ElementNode     -> expanded-QName
    4.3  name : AttributeNode   -> xs:QName
    8.   name : SchemaComponent -> xs:QName
ElementNode and AttributeNode are subcategories of Node, and therefore
not disjoint from it. Presumably, the second and third declarations are
meant to denote special cases of the first, rather than being on an
equal footing with it. But there is a different syntax for such
specializations, introduced in 4.1 Documents:
         name(DocumentNode)    : Sequence(0,0)<xs:QName>
Therefore, I think the those two declarations should be changed to:
    4.2  name(ElementNode)     : xs:QName
    4.3  name(AttributeNode)   : xs:QName

(In 4.2, I also changed "expanded-QName" to "xs:QName" -- see my previous
posting.)

-Michael Dyck

Received on Monday, 24 September 2001 03:26:14 UTC