LC-193 co-occurrence constraints

Dear Mr. van de Hoef:

The W3C XML Schema Working Group has spent the last several months
working through the comments received from the public on the last-call
draft of the XML Schema specification.  We thank you for the comments
you made on our specification during our last-call comment period, and
want to make sure you know that all comments received during the
last-call comment period have been recorded in our last-call issues
list (http://www.w3.org/2000/05/12-xmlschema-lcissues).

You raised the point registered as issue LC-193, which asks how we
would recommend that you express constraints on data which depend on
the values of other data (in particular, constraints on elements or
attributes which depend on the value of other attributes).

A small number of people have suggested that XML Schema should support
such co-occurrence constraints, but the view of the WG has been that
this feature does not belong in version 1.0 of the language.  There is
no clear and obvious way of handling such co-occurrence constraints in
a grammatical approach to schemas (attribute and affix grammars offer
one possibility, but it seems unwise to try to introduce these as the
basis for XML Schema at this time).  The more database-oriented
approach to such constraints with which many of us are familiar models
such constraints with CHECK clauses. While there are certainly those
in the WG who believe something like a CHECK clause would be worth
considering for a future version of the language, it will be much
easier to formulate conditions for such clauses after the XML Query WG
has completed a definition of the XML Query language, and so it seems
wiser to wait for a while before raising the issue and seeing whether
other WG members agree that CHECK clauses are worth looking into.

In the short term, I believe you have two main options: you can add
some representation of the co-occurrence constraints you wish to
express to the appinfo portion of the annotation element.  (This is
available on virtually all schema constructs; I suspect I would put
it, in your example, on the declaration of the enclosing element.)  Or
you can exploit the current ability of XML Schema to make validation
depend on parent element and on left-hand siblings.  In the example
you give, this could take the form of moving the model information
from the content of the Model element into the name of specialized
element types:

   <complexType name="Car">
     <choice>
       <sequence>
	<element name="Golf" substitutionGroup="Model"/>
	<element name="CarrierSet" minOccurs="0" maxOccurs="1"/>
       </sequence>
       <sequence>
	<element name="Cabrio" substitutionGroup="Model"/>
       </sequence>
     </choice>
   </complexType>

This exploits the fact that you have postulated a finite, closed
enumeration of possible models; each value can be transformed into an
element type, and their commonality can be captured by placing them
all into the same substitution group.

In the long term, there is indeed interest in the WG in adding some
ability to define and enforce co-occurrence constraints.  Just not in
version 1.0.

It would be helpful to us to know whether you are satisfied with the
decision taken by the WG on this issue, or wish your dissent from the
WG's decision to be recorded for consideration by the Director of
the W3C.

with best regards,

-C. M. Sperberg-McQueen
  World Wide Web Consortium
  Co-chair, W3C XML Schema WG

Received on Thursday, 5 October 2000 21:49:48 UTC