[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Restriction in XML Schema

  • From: Jay Zhang <jz@i...>
  • To: xml-dev@x...
  • Date: Mon, 05 Mar 2001 21:09:28 +0800

complextype restriction
Restriction is a very important construct. I need to have a clear
understanding of its definition. There is the distance between elegant
semantic definition and computation-oriented syntactic definition.
 
My sloppy example clouded my question the first time. (Who
does not have a personal abbreviation of such a verbose language?;-)
 
Let me try again.
 
The base type is defined as:
 
<complexType name='fields'>
  <sequence>
    <element name='field' maxOccurs='2'>
      <complexType>
        <attribute name='tag'/>
      </complexType>
    </element>
  </sequence>
</complexType>
 
Let me derive the following type:
 
<complexType name='myfields'>
  <complexContent>
    <restriction base='fields'>
      <sequence>
        <element name='field'>
          <complexType>
            <attribute name='tag' use='fixed' value='15A'/>
          </complexType>
        </element>
        <element name='field'>
          <complexType>
            <attribute name='tag' use='fixed' value='20'/>
          </complexType>
        </element>
      </sequence>
    </restriction>
  </<complexContent>
</complexType>
 
>From: ht@c... (Henry S. Thompson)
...
> > The definition of restriction in XML Schema reads:
> >
> > >A type definition whose declarations or facets are in a
> > >one-to-one relation with those of another specified type
> > >definition, with each in turn restricting the possibilities
> > >of the one it corresponds to, is said to be a restriction.
>
>Note this is an introductory summary early in the spec.
This is actually Definition 2 in 2.2.1.1. Looks like the official
definition of restriction, unless someone can point to a "more"
official definition. According to this definition, my derivation
'myfields' is in error! I have to rewrite 'fields' as:
 
<complexType name='fields'>
  <sequence>
    <element name='field'>
      <complexType>
        <attribute name='tag'/>
      </complexType>
    </element>
    <element name='field'>
      <complexType>
        <attribute name='tag'/>
      </complexType>
    </element>
  </sequence>
</complexType>
 
Of course, an elegant semantic definition we all prefer can be
( actually in "an introductory summary early in the spec"):
"...the values represented by the new type are a subset of the values
represented by the base type ..."
 
But this definition is not computationally feasible! It got to be
NP-hard to compare the language sets defined by two schemas.
 
I am glad that you brought up the issue of Unique Particle
Attribution constraint. It is also a computational feasibility
challenge to enforce. Finding that one instance element looks
NP-Complete to me again.
 
I expect syntax-oriented, but more elaborate definitions
dictated by standards. Where is it? Did I lose a page in my book? :-)
 
Jay Zhang
IntermicsTech, Inc.
 
 
 

 

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.