W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > April to June 2011

[Bug 12185] Conditional Type Assignment and substitutability

From: <bugzilla@jessica.w3.org>
Date: Mon, 25 Apr 2011 16:01:53 +0000
To: www-xml-schema-comments@w3.org
Message-Id: <E1QEOET-0004VT-Ad@jessica.w3.org>
http://www.w3.org/Bugs/Public/show_bug.cgi?id=12185

Sandy Gao <sandygao@ca.ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sandygao@ca.ibm.com

--- Comment #9 from Sandy Gao <sandygao@ca.ibm.com> 2011-04-25 16:01:48 UTC ---
1. Substitution group vs. Content type restriction

Suggestion: no change.

> Firstly, it seems illogical to impose a restriction on the second case but 
> none on the first. We should either require CTA type tables to be consistent
> in both cases, or in neither.

The treatments of CTA for these 2 cases are different. Sub-group only require
consistency between the declared type, while content type restriction requires
the type tables to satisfy certain rules.

This doesn't *feel* right. But there are many other aspects that are different
between the 2 cases. For sub-group, the only thing required is consistency
between declared type, and all other aspects about an element declaration can
be different (block, default, fixed, nillable ...). But for content type
restriction, we make sure that the *content* of the element in the restriction
type is also valid against the element in the base type.

I don't know why there is this difference (its history predates my involvement
in the WG), but it's been like this for 10 years. I don't think now is the
right time to revisit and change this. So I suggest we leave sub-group out of
this discussion.

Also observe that sub-group allows extension, but complex type restriction
(obviously) doesn't.

2. CTA and content type restriction

Suggestion: need a rule for CTA.

The goal of content type restriction (as I understood it) has always been to
make sure a sequence of EIIs valid against the restriction type is also valid
against the base type. Note that this is not only about local validity (the
sequence of QNames is allowed), but also deep validity (value/content of the
child elements), which is why we made sure they have compatible type, nillable,
fixed value, IDC, etc.

Again, it's been like this for 10 years, and I don't think the introduction of
CTA should break that.

>From comment #6:

> Similarly, I
> do not believe that we explicitly thought about the constraint
> Content Type Restricts when we worked on conditional type assignment
> and the Conditional Type Substitutable (CTS) rule.  If we had, we
> either would have tightened CTRCC to cover selected types, not just
> declared types, ...

I believe we did consider CTR. Among the proposals from 2007, some were to
change CTR to ensure the "selected types" are consistent. For example
(member-only link)

http://www.w3.org/XML/Group/2004/06/xmlschema-1/structures.cta.pf.200706.html#loc-testSubP

> ... restriction will not guarantee that the
> governing type of any item I in a restriction will be identical to
> or a restriction of the type I would have in the base type ...
> That guarantee has *never* been made for the governing type; it has
> *always* been made only for the declared type of I.

True. But we have never needed to *make* that guarantee for the governing type;
it has always been true. Before CTA, same declared type implies same governing
type, because xsi:type was the only mechanism to make the governing to be
different from the declared.

3. What rule to enforce restriction then?

There are different options mentioned at different times. From 2007 Pisa F2F
[1] and MikeK's email [2], I think the following are relevant:

1) The 2 type tables must be equivalent
2) The 2 type tables have the same length, and for the corresponding entries,
the XPath tests must be the same, and the type in the restriction type table
restricts that in the base type table.
3) The base type table must be a prefix of the restriction type table, and any
additional entries in the restriction type table have a type that restricts the
base default type.
4) Combines #2 and #3
5) Status Quo: runtime rule.

[1] http://www.w3.org/XML/Group/2007/06/xml-schema-ftf-minutes#cta-problem
[2] http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/2011Feb/0008.html

We chose #5 in Pisa. Given the recent discussions about its complexity, we may
need to look at some of the other alternatives.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Monday, 25 April 2011 16:01:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 25 April 2011 16:01:56 GMT