RE: Using substitution groups as meta-types

That's a relief. I'll continue to use these constructs in this way, and I'll
hope that the validators will catch up and start doing their jobs. Still,
it's a little disconcerting that none of them catches a violation.

Mark


----------------------------------------------------------------------------
----
 
Mark Feblowitz                                   [t] 617.715.7231
Frictionless Commerce Incorporated     [f] 617.495.0188 
XML Architect                                     [e]
mfeblowitz@frictionless.com
400 Technology Square, 9th Floor 
Cambridge, MA 02139 
www.frictionless.com  
 

 -----Original Message-----
From: 	Jeni Tennison [mailto:jeni@jenitennison.com] 
Sent:	Thursday, November 08, 2001 11:52 AM
To:	Mark Feblowitz
Cc:	Xmlschema-Dev (E-mail)
Subject:	Re: Using substitution groups  as meta-types

Hi Mark,

> 1. should schema validators reject any "Phrase" specialization that
> contains a Verb child or Object child that is not a member of its
> respective substitution group?

It would make sense, and after going through
http://www.w3.org/TR/xmlschema-1/#cos-particle-restrict in detail, I'm
fairly sure the answer is yes.

The Phrase type is the sequence of a single Verb element followed by a
single Object element. Valid restrictions of this sequence are either
single element particles or other sequences. If it's an element
particle, then it's mapped on to a sequence for the purpose of
validation.

So now we're comparing the base sequence and the derived sequence.
Each of the particles in the derived sequence must map to one of the
particles in the base sequence, preserving order and not skipping any
of the non-emptiable particles in the base sequence. So the derived
sequence must contain one particle that maps on to the Verb element
particle and another particle that maps on to the Object element
particle.

Because they're heads of substitution groups, the Verb and Object
element particles are mapped onto a choice element, containing the
members of the substitution group of which they are the heads. When
comparing a choice to an element, the element is placed in a choice
and the choices are compared.

When comparing two choices, each of the particles in the derived
choice must map on to one of the particles in the base choice. That
will only happen if the base choice (i.e. the choice created from the
element particle due to it being the head of a substitution group)
contains an element particle contained in the derived choice (i.e. the
element declared).

So the only legal derivations of the Phrase type are those that
contain two element particles, the first of which is the Verb element
or one of its substitution group memebers, and the second of which is
the Object element or one of its substition group members.

> 2. should schema validators reject an instance document containing a
> specific phrase element that names a Verb child or Object child that
> is not a member of its respective substitution group?

Again, it would make sense and after going through
http://www.w3.org/TR/xmlschema-1/#cvc-particle I'm fairly sure the
answer is yes.

To be valid, the content of the element that has the Phrase type must
consist of a sequence of elements that are valid against the sequence
defined for the Phrase type (of a single Verb element followed by a
single Object element).

The first element must be locally valid against the (global)
declaration of the Verb element. This can only happen if the name of
the element is 'Verb' or if the (global) declaration of the element is
validly substitutable for the Verb element's declaration. This only
happens if the element's declaration is (eventually) affiliated with
the substitution group of which Verb is the head.

Similarly for Object.

> 3. By using these constructs "at the metalevel", am I using the
> substitution group mechanism in a way that is not intended to be
> used?

I don't think so - it seems like a reasonable use to me.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Thursday, 8 November 2001 12:00:22 UTC