Re: multiply-connected graph of schema import

On Apr 15, 2011, at 10:32 AM, Michael Kay wrote:

> 
>> ...  Other implementations of XSD 1.0
>> have taken the view that circular includes are legal and have a
>> well defined meaning, but I do not know how they derive that
>> conclusion from the text of the spec
> 
> Well, yes, when I was implementing it I struggled with this, and I made circular includes work not because the spec was explicit that they should work, but because there were schemas out in the wild that other processors accepted and it made sense to accept them too.
> 
> I think we thrashed this out when dealing with circular xs:override in 1.1. If you have two documents A and B which include each other, the spec says that the schema corresponding to A must contain the components corresponding to its own declarations, as well as all components from the schema corresponding to B, and vice versa. If you take all the components from all the documents reachable transitively via some sequence of xs:include links, then you have satisfied all the rules in the spec. The spec doesn't mandate this interpretation, but it certainly allows it, and since it doesn't define any error condition for a circular xs:include, and since failure to terminate isn't really an option, using the transitive closure seems the most reasonable reading. To get to this interpretation, you have to avoid reading the spec as a set of computations to be performed, or even of functional dependencies, and read it instead as a set of constraints to be satisified. The constraint is that schema(A) contains components(A) and schema(B), while schema(B) contains components(B) and schema(A), and the constraint is satisfied if schema(A) and schema(B) are both equal to the union of components(A) and components(B).

Thank you for this lucid exposition.

From the spec-drafting point of view, the problem that
most consistently troubles me is here that the spec 
refers to 'the schema' corresponding to a particular
schema document, in the singular, which in English 
entails the proposition that there is just one such schema, 
but there are an infinite number of schemas which satisfy 
the constraints that the immediate components of A 
and B are both included.  

The approach you took in implementing 1.0 does not seem
unreasonable to me, especially when coupled with a
disavowal of any claim that the spec explicitly requires it.
The approach of schema processors which flag an error 
in the case of circularity seems equally reasonable to
me as an interpretation of the spec, or perhaps slightly 
more reasonable (because closer to what the spec 
actually does say explicitly).

What I find unreasonable in this context is the claim 
occasionally met with that the semantics of inclusion 
are cleanly specified in XSD 1.0, or that 'compatibility
with 1.0' is a notion which can coherently be applied 
in trying to clarify XSD's account of schema composition.


-- 
****************************************************************
* C. M. Sperberg-McQueen, Black Mesa Technologies LLC
* http://www.blackmesatech.com 
* http://cmsmcq.com/mib                 
* http://balisage.net
****************************************************************

Received on Friday, 15 April 2011 16:54:21 UTC