- From: Mary Fernandez <mff@research.att.com>
- Date: 05 Feb 2004 22:56:55 -0500
- To: Ashok Malhotra <ashokma@microsoft.com>
- Cc: public-qt-comments@w3.org
Ashok,
My example has to do with the meaning of a SequenceType
in an XQuery expression, which is entirely independent
of schema validation of documents. In the current language
book, an XQuery expression can contain a SequenceType
that has absolutely no relationship to imported schemas.
For example, they may write:
element(person, Company)
where element person is a globally declared element with
type Person, Company is a globally defined type, and
there is no derivation relationship between Company and Person.
This is the problem.
thx Mary
On Thu, 2004-02-05 at 09:17, Ashok Malhotra wrote:
> Mary:
> You said ...
>
> "XML Schema (and hence the XQuery type system) requires the type name
> of a substitution group member to be derived from the type name of
> the head of the substitution group. This constraint is not enforced
> by sequence-type matching, and therefore it is out of the scope of
> XML Schema and our type system."
>
> If we are dealing with valid Schemas then this constraint has been
> enforced during schema validation. I don't see why we need to check it
> again.
>
> All the best, Ashok
> -----Original Message-----
> From: public-qt-comments-request@w3.org
> [mailto:public-qt-comments-request@w3.org] On Behalf Of Mary Fernandez
> Sent: Wednesday, February 04, 2004 7:59 AM
> To: public-qt-comments@w3.org
> Subject: [XQ] Meaning of substitution groups in
> element(ElementName,TypeName)
>
>
> The following issue was identified during formal definition of
> SequenceType matching. Resolution of this issue is necessary to
> complete closure of Issue 559 (New Sequence Type needs to be fully
> implemented in Formal Semantics).
>
> Current status:
>
> 1. The XQuery type system is based on XML Schema.
>
> 2. Section 2.4.4.3 Matching an ElementTest and an Element Node, point 2
> states that:
>
> a. element(ElementName, TypeName) matches a given element node if
> the name of the element node matches ElementName or matches the
> name of an element in a substitution group headed by an element
> with the name ElementName [if such a head element exists]
>
> b. type-matches(TypeName, AT) is true, where AT is the type of the
> given element node.
>
> 3. To express a sequence type in the XQuery type system, it should
> correspond to some valid XML Schema structure. In XML Schema
> terminology, the sequence type syntax element(ElementName,TypeName)
> represents a new local element ElementName in the substitution
> group of a global element with the *same* ElementName, and with
> type TypeName.
>
> In XML Schema, you might express this sequence type as:
>
> <xs:element name="ElementName" substitutionGroup="ElementName"
> type="TypeName"/>
>
> Problem 1:
>
> XML Schema requires that all members of a substitution group be
> globally declared, therefore the above XML Schema type is invalid
> and thus there is no valid XQuery type expression that represents
> the sequence type element(ElementName, TypeName).
>
> Problem 2:
>
> Even if we permitted such a type in the XQuery type system, another
> problem arises.
>
> XML Schema (and hence the XQuery type system) requires the type name
> of a substitution group member to be derived from the type name of
> the head of the substitution group. This constraint is not enforced
> by sequence-type matching, and therefore it is out of the scope of
> XML Schema and our type system.
>
> Because the current semantics of element(ElementName, TypeName)
> cannot be expressed in the XQuery type system, any example based on
> it is potentially unsound. To illustrate, consider the following
> XML Schema structures:
>
> An element person of type Person:
>
> define element person of type Person
> define type Person {
> element manager of type xs:string,
> }
>
> A type Company:
>
> define type Company {
> element ticker of type xs:string
> }
>
> and consider the sequence type:
>
> element(person, Company)
>
> There is no corresponding XML Schema or XQuery type for this
> sequence type, i.e., the following is invalid, because type Company
> is _not_ derived from type Person:
>
> <xs:element name="person" substitutionGroup="person"
> type="Company"/>
>
> Consequence: we do not know how to map this sequence type into the
> XQuery type system and therefore cannot provide a static semantics
> for it.
>
> Possible solution 1: enforce the XML Schema's type-derivation
> constraint.
>
> Possible solution 2: treat element(person,Company) as the following
> local XML Schema element:
>
> <xs:element name="person" type="Company"/>
>
> which is simple, but excludes substitution groups from the semantics.
--
Mary Fernandez <mff@research.att.com>
AT&T Labs - Research
Received on Thursday, 5 February 2004 22:54:48 UTC