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

Re: Two quick questions regarding restriction in XML Schema


subsumption book
Hi Murali,

> I have one question regarding extension:
> can we define the following types
> type Book -> (Title, Author+)
> type Book1 extends Book -> (Title, Author+, Title)

Yes, this is valid. However, it's important to remember that when extending an element in
W3C XML Schema you actually sequence the old content model together with the new one so
the correct (DTD equivalent) of the above extension would actually be:

type Book1 extends Book -> ((Title, Author+), Title))

In this case it doesn't matter much but say you have the following type:

type Contact -> (Email | Phone)

and you want to extend this choice type with a new element Fax. The new derived type would
actually be:

type Contact1 -> ((Email | Phone)), Fax)

Cheers,
/Eddie

>
>
> Note: If the above type definitions are valid, then I am afraid, there is
> a problem with the framework of subsumption. I think subsumption will be
> able to capture only restricted subset of extensions allowed in W3C's
> XML-Schema. I am quite confident of my conclusions. (The above extension
> cannot be captured using subsumption)
>
> thanks and regards - murali.
>
> On Fri, 17 May 2002, Dare Obasanjo wrote:
>
> > From the little I know of W3C XML Schema, the answer to all your questions is Yes.
> >
> > I'd love to read this report when you are done with it. Will it be online somewhere?
> >
> >       -----Original Message-----
> >       From: Murali Mani [mailto:mani@C...]
> >       Sent: Fri 5/17/2002 9:13 AM
> >       To: Dare Obasanjo
> >       Cc: Eddie Robertsson; Nada Reinprecht; xml-dev@l...
> >       Subject: RE:  Two quick questions regarding restriction in XML Schema
> >
> >
> >
> >
> >       My question was this:
> >       We have type definitions,
> >
> >       type Book (block="restriction") -> (Title, Author*)
> >       type Book1 restricts Book -> (Title, Author, Author)
> >
> >       and element declaration
> >       <element book type="Book">
> >
> >       So which of the two following documents are valid?:
> >       <book>
> >           <title>XYZ</title>
> >           <author>ABC</author>
> >           <author>DEF</author>
> >       </book>
> >
> >       and
> >
> >       <book xsi:type="Book1">
> >           <title>XYZ</title>
> >           <author>ABC</author>
> >           <author>DEF</author>
> >       </book>
> >
> >       I think the answer is the first document is valid, whereas the second one
> >       is not, because of the reason which Dare gives second. This is clear.
> >
> >       Now, one more question on restriction:
> >
> >       suppose we defined
> >       type Book (final="restriction") -> Title, Author*
> >       now we cannot define type Book1 as above, correct??
> >
> >       also let us assume the element declaration as above
> >       <element book type="Book">
> >
> >       Consider the following document:
> >       <book>
> >           <title>XYZ</title>
> >           <author>ABC</author>
> >           <author>DEF</author>
> >       </book>
> >
> >       The above document is valid, right?
> >
> >       I will tell you what I am trying to understand: "I have seen two
> >       frameworks trying to explain subtyping in XML - one is in XDuce using
> >       inclusion, and other is a framework known as subsumption. I am trying to
> >       analyze them. These questions help me in understanding. I am presently
> >       writing a "short" report (presently 6 pages, I believe it will be less
> >       than 10 pages) analyzing the various subtyping schemes for XML."
> >
> >       thanks and regards - murali.
> >
> >       On Fri, 17 May 2002, Dare Obasanjo wrote:
> >
> >       > The validity first document is valid while the second isn't but not
> >       > for the reasons you suppose. The second one is invalid because no type
> >       > definition exists for a type named "Book1". :)
> >       >
> >       >  However, assuming that a Book1 type one existed and it was a valid
> >       > restriction of Book then you are correct that the document is invalid.
> >       > According to
> >       >
> >       >  Validation Rule: Element Locally Valid (Element) [0] 4 If there is an
> >       > attribute information item among the element information item's
> >       > [attributes] <http://www.w3.org/TR/xml-infoset/#infoitem.element>
> >       > whose [namespace name]
> >       > <http://www.w3.org/TR/xml-infoset/#infoitem.attribute> is identical to
> >       > http://www.w3.org/2001/XMLSchema-instance and whose [local name]
> >       > <http://www.w3.org/TR/xml-infoset/#infoitem.attribute> is type, then
> >       > all of the following must be true:  4.1 The �·normalized value�· of
> >       > that attribute information item must be �·valid�· with respect to the
> >       > built-in QName
> >       > <http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes#QName>
> >       > simple type, as defined by String Valid (�§3.14.4);  4.2 The �·local
> >       > name�· and �·namespace name�· (as defined in QName Interpretation
> >       > (�§3.15.3)), of the �·actual value�· of that attribute information
> >       > item must resolve to a type definition, as defined in QName resolution
> >       > (Instance) (�§3.15.4) -- [Definition:] call this type definition the
> >       > local type definition; 4.3 The �·local type definition�· must be
> >       > validly derived from the {type definition} given the union of the
> >       > {disallowed substitutions} and the {type definition}'s {prohibited
> >       > substitutions}, as defined in Type Derivation OK (Complex) (�§3.4.6)
> >       > (if it is a complex type definition), or given {disallowed
> >       > substitutions} as defined in Type Derivation OK (Simple) (�§3.14.6)
> >       > (if it is a simple type definition).
> >       >
> >       > [0] http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#cvc-elt
> >
> >
> >
> >
> >


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.