W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > October to December 2009

Re: Question on XSD 1.1 cyclic <override>

From: C. M. Sperberg-McQueen <cmsmcq@blackmesatech.com>
Date: Sun, 27 Dec 2009 16:55:10 -0700
Cc: "C. M. Sperberg-McQueen" <cmsmcq@blackmesatech.com>, www-xml-schema-comments@w3.org
Message-Id: <0088C103-2905-4B36-81DC-0B6C670E0CE2@blackmesatech.com>
To: Kevin Braun <kbraun@obj-sys.com>

On 23 Dec 2009, at 14:53 , Kevin Braun wrote:

> The spec seems to say that if override(O1, D1) = D1 and override(O2,  
> D2) = D2 (both true, I think) then it is okay that target_set(O1)  
> includes D1 and target_set(O2) includes D2.  Yet, it seems that  
> schema(D1) should contain two conflicting declarations for elementA.

I agree that schema(D1) should (and does) contain conflicting
declarations for elementA.

But the salient condition is not

   override(O1, D1) = D1 & override(O2,D2) = D2

(which are indeed true, unless I'm missing something), but

   override(O1,D2) = D2 & override(O2,D1) = D1

which is false in both conjuncts.  If you replace both overrides
with equivalent includes of modified schema documents, and
continue substituting equivalents for equivalents, you do get a
cyclic include of two schema documents (call them a'.xsd and
b'.xsd) which declare elementA and elementB of type string.
But you also have the original declaration of a.xsd, which
conflicts with that of a'.xsd.

Algebraically:

(1) schema(D1) = builtins + immed(D1) + schema(override(O1,D2))

Expanding the last term this gives

(2) schema(D1) = builtins + immed(D1)
                  + builtins + immed(override(O1,D2))
                  + schema(override(O2',D1))

where O2' = the element O2 in override(O1,D2).  Here, O2' = O2,
so (simplifying) we have

(3) schema(D1) =  builtins + immed(D1) + immed(override(O1,D2))
                  + schema(override(O2,D1))

Again expanding the last term this gives

(4) schema(D1) = builtins + immed(D1) + immed(override(O1,D2))
                  + builtins + immed(override(O2,D1))
                  + schema(override(O1',D2))

where O1' = the element O1 in override(O2,D1).  Here, O1' = O1,
so we have

(5) schema(D1) = builtins + immed(D1) + immed(override(O1,D2))
                  + immed(override(O2,D1))
                  + schema(override(O1,D2))

The last term was already present in (1) and has already been
expanded, so it can be omitted.  (That, in essence, is the
meaning, for algebraic manipulations of this kind, of the rule
permitting cyclic includes and specifying fixpoint semantics for
them.) So we have

(5) schema(D1) = builtins
                  + immed(D1)
                  + immed(override(O1,D2))
                  + immed(override(O2,D1))

which might be paraphrased as

(5) schema(D1) = builtins
                  + element elementA as decimal
                  + element elementB as string
                  + element elementA as string

which is, as you correctly observe, not a legal schema.

HTH

--CMSMcQ




-- 
****************************************************************
* C. M. Sperberg-McQueen, Black Mesa Technologies LLC
* http://www.blackmesatech.com
* http://cmsmcq.com/mib
* http://balisage.net
****************************************************************
Received on Sunday, 27 December 2009 23:55:42 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 27 December 2009 23:55:44 GMT