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

Re: Multiple and circular import/include

From: <noah_mendelsohn@us.ibm.com>
Date: Sat, 5 Mar 2005 18:42:46 -0500
To: vivek agarwal <vivekorama@gmail.com>
Cc: bill.michell@bbc.co.uk, rschloss@us.ibm.com, Jack Lindsey <tuquenukem@hotmail.com>, xmlschema-dev@w3.org
Message-ID: <OF85EA155F.2742BB3E-ON85256FBB.00817BE2@lotus.com>

FWIW, Schema 1.1 will attempt to clarify details of inclusion, import, 
etc.    Though the Workgroup has not yet agreed on specific language, my 
expectation is that it will be made very clear that cycles in the graph of 
inclusion, import, xsi:schemaLocation, etc.  are definitely allowed.  As 
someone has noted they are useful.  Circular redefines typically make no 
sense, and I expect that they will be disallowed.

While implementations are free to get the right answer anyway they can, I 
expect that the design will be compatible with an algorithm along the 
following lines:

1. Compute the set of files resulting from the transitive closure of a) 
all the schema docs explicitly named on a command line, API, or similar 
processor-dependent mechanism b) files included by them c) imports for 
which schemaLocation is honored d) xsi:schemaLocations that are honored d) 
redefines.   Note that transitive closures don't look infinitely on 
cycles.   We just collect a set of filenames.

2.  Check for cycles in the redefine graph.

3.  Compute the schema resulting from this collection of schema docuemnts

The above oversimplifies many details, including among others "chamelon 
include"  (include of a document with no targetNamespace by a doc that has 
one), but the spirit is right.

If you're wondering about incremental processing of xsi:schemaLocations as 
the validation proceeds, that's allowed, but it's only an optimization. 
The results must be the same as if you had prescanned the instance to find 
the schemaLocations you intended to honor, included the files for them in 
advance in step 1, and computed the schema in bulk.  It turns out that 
certain rules in the schema language make it practical to do such 
incremental construction, but they are not fundamental to the language any 
more than JIT'ing, for example is part of the Java language definition. 
It's a cool incremental optimiation, but the burden is on you to get the 
same result as if you had run the same program without incremental 
compilation.

Again, these are all just my intuitions as to how the clarifications will 
come out.  At least some of us in the WG believe that this is how schema 
1.0 works, but all agree that the recommendation is at best vague and most 
likely contradictory in these areas.

--------------------------------------
Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------








vivek agarwal <vivekorama@gmail.com>
Sent by: xmlschema-dev-request@w3.org
03/04/2005 01:37 AM
Please respond to vivek agarwal

 
        To:     Jack Lindsey <tuquenukem@hotmail.com>, bill.michell@bbc.co.uk, 
rschloss@us.ibm.com
        cc:     xmlschema-dev@w3.org, (bcc: Noah Mendelsohn/Cambridge/IBM)
        Subject:        Re: Multiple and circular import/include



I think I too appreciate circular references and multiple imports now.

Thanks to all.

-Vivek.


On Thu, 03 Mar 2005 22:37:14 -0500, Jack Lindsey <tuquenukem@hotmail.com> 
wrote:
> I absolutely agree.  However, such recursive element references that 
span
> files with redundant xs:include/import statements can crash JAXB, as a
> development team politely informed me.  Then I got a taste of my own
> medicine when Spy 2005 SP1 did the same to me.  I just upgraded but to 
keep
> my developers happy, I am trying a re-modularization of a large schema.
> After all, the customer is always right!
> 
> Cheers Jack
> 
> >From: "Bill Michell" <bill.michell@bbc.co.uk>
> >To: "vivek agarwal" <vivekorama@gmail.com>,        "Bob Schloss"
> ><rschloss@us.ibm.com>
> >CC: <xmlschema-dev@w3.org>
> >Subject: RE: Multiple and circular import/include
> >Date: Thu, 3 Mar 2005 09:32:50 -0000
> >
> >
> >I find them really useful...
> >
> >I have a generic "asset" that can have many types of extension - but 
any
> >instance of that asset need to be able to contain other assets - either
> >references, or completely embedded inline.
> >
> >The core document contains the basic asset definition but the 
extensions
> >each live in their own schema - that needs a reference to the core 
document
> >- which in turn needs a reference to the current collection of 
extension
> >schemae...
> >
> >In other words elements can be nested recursively so the schema 
documents
> >need to be able to express that nesting.
> >
> >
> >
> >--
> >Bill Michell
> >Development Team Leader, Broadcast Platforms, BBC News Interactive.
> >
> >
> >
> >-----Original Message-----
> >From: xmlschema-dev-request@w3.org 
[mailto:xmlschema-dev-request@w3.org] On
> >Behalf Of vivek agarwal
> >Sent: Wednesday, March 02, 2005 9:03 PM
> >To: Bob Schloss
> >Cc: xmlschema-dev@w3.org
> >Subject: Re: Multiple and circular import/include
> >
> >
> >Thanks Bob!
> >But, I still don't understand why the spec allows circular references!? 
Is
> >there a reason? or is it just like that?
> >
> >Thanks,
> >Vivek.
> >
> >
> >
> >On Tue, 1 Mar 2005 15:17:04 -0500, Bob Schloss <rschloss@us.ibm.com> 
wrote:
> > >
> > >
> > > Vivek,
> > >
> > >       It is not an error to include the same schema document as the
> > > target of multiple <include> or <import> directives.
> > >
> > >       Circular <include> or <import> directives are permitted.
> > >
> > >       This is my mental model:
> > >
> > > 1. The processor fetches your top-level schema document, and then
> > > keeps fetching any other schemas which are referenced through
> > > directives, transitively, but whenever it sees a directive 
targetting
> > > something it has already fetched, it doesn't fetch it again.  At the
> > > end of this process, the "actual schema" to be used for processing 
now
> > > exists in memory, having been merged from 1...n individual documents
> > > having the XML representation of XML Schema.
> > >
> > > 2. Then the processor starts doing whatever it plans to do 
(validation
> > > of instance documents during parsing, generating Data Binding code,
> > > generating UI forms, or whatever).
> > >
> > >       Because of subtleties associated with <redefine>, for the 
sanity
> > > of anyone who may have to maintain what you design, I would try to
> > > avoid circular redefines.
> > >
> > >             Good Luck,
> > >             Bob
> > >
> > > Scalable XML Infrastructure
> > > IBM Thomas J Watson Research Center
> > > Yorktown Heights, New York, USA
> > > http://www.research.ibm.com/XML
> > >
> > >              vivek agarwal
> > >              <vivekorama@gmail
> > >              .com>
> >To
> > >              Sent by:                  xmlschema-dev@w3.org
> > >              xmlschema-dev-req
> >cc
> > >              uest@w3.org
> > >
> >Subject
> > >                                        Multiple and circular
> > >              03/01/2005 01:41          import/include
> > >              AM
> > >
> > >              Please respond to
> > >                vivek agarwal
> > >
> > >
> > > Hi,
> > >
> > > I have a question on multiple and circular import/include each, if
> > > somebody could help.
> > >
> > > Is it an error to import/include a schema more than once?
> > > A import/includes B1 and B2.
> > > Both B1, and B2, import/includes C.
> > > What is the expected behaviour of the processor in such a case?
> > >
> > > Are circular import/includes allowed?
> > > A import/includes B, and B import/includes A?
> > > What is the expected behaviour of the processor in such a case?
> > >
> > > Thanks,
> > > Vivek.
> > >
> > >
> >
> >
> >http://www.bbc.co.uk/
> >
> >This e-mail (and any attachments) is confidential and may contain
> >personal views which are not the views of the BBC unless specifically
> >stated.
> >If you have received it in error, please delete it from your system.
> >Do not use, copy or disclose the information in any way nor act in
> >reliance on it and notify the sender immediately. Please note that the
> >BBC monitors e-mails sent or received.
> >Further communication will signify your consent to this.
> >
> >
> 
> _________________________________________________________________
> MSNŽ Calendar keeps you organized and takes the effort out of scheduling
> get-togethers.
> http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines
>   Start enjoying all the benefits of MSNŽ Premium right now and get the
> first two months FREE*.
> 
>
Received on Saturday, 5 March 2005 23:58:56 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:49 GMT