W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2002

Re: Derivation by restriction from <any>

From: Jeni Tennison <jeni@jenitennison.com>
Date: Sat, 9 Mar 2002 11:50:41 +0000
Message-ID: <89352868548.20020309115041@jenitennison.com>
To: "Dare Obasanjo" <dareo@microsoft.com>
CC: xmlschema-dev@w3.org
Hi Dare,

>> By the rules of the Schema Component Constraint: Particle Valid
>> (Restriction) 
>> (http://www.w3.org/TR/xmlschema-1/#cos-particle-restrict), 
>> the sequence in the base model group is "pointless" so the 
>> base model group is equivalent to:
> The rules for pointlessness for an xs:sequence are
>         <sequence> 
>         One of the following must be true:
>         2.2.1 {particles} is empty. [Dare - Nope, not in this case] 
>         2.2.2 All of the following must be true:
> The particle within which this <sequence> appears has
> {max occurs} and {min   occurs} of 1. [Dare - the sequence does not
> appear in a particle. Now it is possible that somewhere in the spec
> defines some implicit particle similar to how there is an implicit
> xs:complexContent child of a xs:complexType when it has particles as
> children. If this is the case I'd appreciate it if you could point this
> out]

Yes :) I admit that I performed a little 'interpretation' of the spec
here, and went with what I felt was the spirit rather than the letter.

It's clear that does not apply to a <sequence> that is the
top-level particle in a content model, since it does not appear within
a particle itself. The question is whether the fact that it does not
appear within a particle means that the condition is met or not met,
in other words, does mean:

  "If the <sequence> appears within a particle, then the particle
   within which this <sequence> appears has {max occurs} and {min
   occurs} of 1."

or does it mean:

  "The <sequence> appears within a particle and the particle
   within which this <sequence> appears has {max occurs} and {min
   occurs} of 1."

I think that both interpretations are valid interpretations based on
the letter of the Rec. I think that the former interpretation, which
is the one that I made, makes more sense, by extension, since if you

      <any maxOccurs="unbounded" />
    <element ref="baz" />

being restricted to:

      <element ref="foo" />
      <element ref="bar" />
    <element ref="baz" />

Then that would be OK - the sequence in the base is *definitely*
pointless, and the map from the base any to the restricted sequence
is fine (as I demonstrated in the last message).

But then again, if you have the base particle:

  <sequence maxOccurs="unbounded">
    <any />

and the restriction:

    <element ref="foo" />
    <element ref="bar" />

To my eyes, that looks like a valid restriction, but according to the
Rec I don't think it is. The sequence/sequence derivation rule states
that the there must be an order-preserving functional mapping between
the particles making up the two sequences, which there clearly isn't
in this case - there's nothing for the second element to map on to.

And if it doesn't work for the above base model group, then it
shouldn't work for the model group:

    <any maxOccurs="unbounded" />

which I think is functionally equivalent.

As usual with these things, the not-quite-errata document registers
that there's already been a comment about the pointlessness rules:


Apparently it's been resolved:

  "The WG has decided that although the rules have some awkward
   results, they are not in error. It will be put on the list of
   issues to consider for a future revision of XML Schema."

So there you go. I guess that means that one-to-many mappings are
possible in some cases but not in others (with a little ambiguity
about which examples fall into which class).



Jeni Tennison
Received on Saturday, 9 March 2002 06:50:48 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:55 UTC