W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2004

Re: Unique Particle Attribution

From: <noah_mendelsohn@us.ibm.com>
Date: Tue, 4 May 2004 22:47:23 -0400
To: Veerappan Saravanan-ESV007 <esv007@motorola.com>
Cc: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Message-ID: <OF2860FD68.27DA0E8F-ON85256E8B.000EBB87@lotus.com>

Veerappan Sravanan writes:

>> Is there a better tutorial with examples where can I learn more about UPA 
and how to get around? 

I must ask:  "better than what"?  Here's a quick intro:

First, what's a particle.  Consider:

                <element ref="a"/>
                <element ref="b" maxOccurs="5"/>
                <element ref="c">

In the above, there are 4 particles[1].  One is the outer sequence, the 
others are the three element references.  The maxOccurs is considered part 
of the particle.   Particles have recursive structure:

                <element ref="a"/>
                <element ref="b" maxOccurs="5"/>
                        <element ref="x"/>
                        <element ref="y"/>
                <element ref="c">

Anyway, UPA says that for a given content model to be legal, there can be 
no instance that would have an element matching more than one particle. 
The above are OK per UPA.  The following is not:

                <element ref="a" minOccurs="0"/>
                <element ref="a" minOccurs="0"/>

Why illegal?  Well, if I asked you to validate the instance:


you could match it against either of the element references, since both 
are optional and both match <a/>.  So, you cannot "uniquely attribute" the 
element to a particle.  UPA is violated. 

Note:  it's the original <sequence> that is not legal.  We can't really 
ask whether the instance is valid, because there is no legal schema 
against which to try (though clearly, if the schema were allowed, the 
instance would validate...for two reasons!)

UPA is an interesting tradeoff.  It makes validators simpler, because you 
don't have to go down two or more branches of the content model to try and 
see whether your instance matches.  At least as important, it makes things 
easier for tools that do things like binding schemas to Java, relational 
databases, etc.  In the first schema above you can map any valid instance 
to: a variable a, an array of up to 5 b's, and a c.  The sequence that 
violates UPA is somewhat harder to map;  done in the obvious way, the 
element <a/> could map to either of two variables, and crucially, 
different processors might reasonably make different decisions.

I hope this helps.


[1] http://www.w3.org/TR/2004/PER-xmlschema-1-20040318/#Particle_details

Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142

Veerappan Saravanan-ESV007 <esv007@motorola.com>
Sent by: xmlschema-dev-request@w3.org
05/03/04 05:00 PM

        To:     "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
        cc:     (bcc: Noah Mendelsohn/Cambridge/IBM)
        Subject:        Unique Particle Attribution

Is there a better tutorial with examples where can I learn more about UPA 
and how to get around? 
I have problem in validating my schema due to UPA constraint. 
Received on Tuesday, 4 May 2004 22:49:50 UTC

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