<!DOCTYPE TEI.2 PUBLIC '-//C. M. Sperberg-McQueen//DTD
          TEI Lite 1.0 plus SWeb (XML)//EN'
          'http://www.w3.org/People/cmsmcq/lib/swebxml.dtd' [

<!ENTITY date.last.touched "5 September - 8 October 2007">
<!ENTITY date.last.touched "5 September 2007, last rev. 1 October 2007">
<!ENTITY date.last.touched "5 September 2007, rev. 24 September 2007">

<!ENTITY aacute  "&#225;" ><!-- small a, acute accent -->
<!ENTITY agrave  "&#224;" ><!-- small a, grave accent -->   
<!ENTITY amp    "&#38;#38;" ><!--=ampersand-->
<!ENTITY aring   "&#229;" ><!-- small a, ring -->
<!ENTITY auml    "&#228;" ><!-- small a, dieresis or umlaut mark -->
<!ENTITY ccedil  "&#231;" ><!-- small c, cedilla -->
<!ENTITY copy   "&#169;" ><!--=copyright sign-->
<!ENTITY eacute  "&#233;" ><!-- small e, acute accent -->
<!ENTITY ecirc   "&#234;" ><!-- small e, circumflex accent -->
<!ENTITY egrave  "&#232;" ><!-- small e, grave accent -->
<!ENTITY gt     ">"      ><!--=greater-than sign R:-->
<!ENTITY ldquo  "&#x201C;" ><!--=double quotation mark, left-->
<!ENTITY le     "&#x2264;" ><!--/leq /le R: =less-than-or-equal-->
<!ENTITY lsquo  "&#x2018;" ><!--=single quotation mark, left-->
<!ENTITY lt     "&#38;#60;"      ><!--=less-than sign R:-->
<!ENTITY mdash  "&#x2014;" ><!--=em dash-->
<!ENTITY ne     "&#x2260;" ><!--/ne /neq R: =not equal-->
<!ENTITY ntilde  "&#241;" ><!-- small n, tilde -->
<!ENTITY oacute  "&#243;" ><!-- small o, acute accent -->
<!ENTITY oslash  "&#248;" ><!-- small o, slash -->
<!ENTITY ouml    "&#246;" ><!-- small o, dieresis or umlaut mark -->
<!ENTITY rArr   "&#x21D2;" ><!--/Rightarrow A: =implies-->
<!ENTITY rdquo  "&#x201D;" ><!--=double quotation mark, right-->
<!ENTITY rsquo  "&#x2019;" ><!--=single quotation mark, right-->
<!ENTITY szlig   "&#223;" ><!-- small sharp s, German (sz ligature) -->
<!ENTITY times  "&#215;" ><!--/times B: =multiply sign-->
<!ENTITY uuml    "&#252;" ><!-- small u, dieresis or umlaut mark -->
<!ENTITY Uuml    "&#220;" ><!-- capital U, dieresis or umlaut mark -->

<!ENTITY larr   "&#x2190;" ><!--/leftarrow /gets A: =leftward arrow-->
<!ENTITY rarr   "&#x2192;" ><!--/rightarrow /to A: =rightward arrow-->
<!ENTITY uarr   "&#x2191;" ><!--/uparrow A: =upward arrow-->
<!ENTITY darr   "&#x2193;" ><!--/downarrow A: =downward arrow-->

<!NOTATION PDF SYSTEM "application/pdf" >
<!NOTATION PNG SYSTEM "image/png" >
<!ENTITY eg01 SYSTEM "images/eg01.png" NDATA PNG >
<!ENTITY eg02 SYSTEM "images/eg02.png" NDATA PNG >

<!ENTITY m1a00 SYSTEM "images/m1a00.png" NDATA PNG >
<!ENTITY m1a01 SYSTEM "images/m1a01.png" NDATA PNG >
<!ENTITY m1a02 SYSTEM "images/m1a02.png" NDATA PNG >
<!ENTITY m1a03 SYSTEM "images/m1a03.png" NDATA PNG >
<!ENTITY m1a04 SYSTEM "images/m1a04.png" NDATA PNG >
<!ENTITY m1a05 SYSTEM "images/m1a05.png" NDATA PNG >
<!ENTITY m1a06 SYSTEM "images/m1a06.png" NDATA PNG >
<!ENTITY m1a07 SYSTEM "images/m1a07.png" NDATA PNG >
<!ENTITY m1a08 SYSTEM "images/m1a08.png" NDATA PNG >
<!ENTITY m1a09 SYSTEM "images/m1a09.png" NDATA PNG >
<!ENTITY m1a10 SYSTEM "images/m1a10.png" NDATA PNG >
<!ENTITY m1a11 SYSTEM "images/m1a11.png" NDATA PNG >
<!ENTITY m1a12 SYSTEM "images/m1a12.png" NDATA PNG >
<!ENTITY m1a13 SYSTEM "images/m1a13.png" NDATA PNG >

<!ENTITY pvb SYSTEM "images/pvb.png" NDATA PNG >
<!ENTITY abc SYSTEM "images/abc.png" NDATA PNG >


<!ATTLIST list 
          type CDATA 'bullets' >
<!ATTLIST bibl id ID #IMPLIED>
<!ATTLIST div id ID #IMPLIED>
<!ATTLIST item id ID #IMPLIED>
<!ATTLIST scrap id ID #IMPLIED>

<!ENTITY spacer4 '<row><cell cols="4">&#xA0;</cell></row>'>
<!ENTITY spacer5 '<row><cell cols="5">&#xA0;</cell></row>'>

]>
<?xml-stylesheet type="text/xsl" href="scmodel.xsl"?> 
<!--*
<?xml-stylesheet type="text/xsl" href="../../../../../People/cmsmcq/lib/swebtohtml.xsl"?> 
<?xml-stylesheet type="text/xsl" href="http://www.w3.org/People/cmsmcq/lib/swebtohtml.xsl"?> 
*-->
<TEI.2 rend="w3c-public">
<teiHeader>
<fileDesc>
<titleStmt>
<title>Modeling schema composition in Alloy</title>
</titleStmt>
<publicationStmt>
<pubPlace>Cambridge, Mass.</pubPlace>
<pubPlace>Sophia-Antipolis</pubPlace>
<pubPlace>Tokyo</pubPlace>
<publisher>World Wide Web Consortium</publisher>
<date>2007</date>
</publicationStmt>
<sourceDesc>
<p>Created in electronic form.</p>
</sourceDesc>
</fileDesc>
</teiHeader>
<text>
<front>
<titlePage>
<docTitle>
<titlePart>Modeling schema composition in Alloy</titlePart>
</docTitle>
<titlePart>A working paper prepared for the W3C XML Schema Working Group</titlePart>
<docAuthor>C. M. Sperberg-McQueen</docAuthor>
<docDate>&date.last.touched;</docDate>
</titlePage>
</front>
<body>
<note place="block"><p>This document was originally prepared in 2007, as shown.</p>
<p>It was made public by the author in June 2009; the only changes made
for publication were (a) the updating of stylesheet and other links to
reflect the location of the public version and (b) the addition of this note.</p></note>
<div id="intro">
<head>Introduction</head>
<p>This document describes a simple model of XSDL schema composition
in Alloy <ptr target="Jackson" type="bibref"/>.  One goal is to help
clarify the design of composition; another is to generate test cases
for testing the behavior of existing processors.  If we know
what kinds of cases are treated consistently by existing XSDL software,
we have a better chance of ensuring that the description of schema
composition in XSDL 1.1 does not unnecessarily cause interoperability
problems between 1.0 and 1.1 processors.  Also, empirical information
on existing processor behavior can suggest places where XSDL 1.0
is underspecified, contradictory, unclear, or too subtle.
</p>
<p>The document first discusses aspects of schema composition we
may want to model, then addresses the problem of building test cases
with interpretable results.  Then a simple model of schema 
composition is presented in Alloy notation, and some sample 
instances of the model are presented.  Section <ptr target="testcasedesign"
type="secnum"/> describes the form of test cases to be generated 
from instances of the model;
section <ptr target="handcrafted" type="secnum"/> describes
a small number of tests hand-made on the basis of Alloy instances
(and in some cases from user reports) and the results of
running those tests on existing processors.
Section <ptr target="testcasegeneration" 
type="secnum"/> describes code that generates test
cases automatically from Alloy model instances; and 
section <ptr target="testresults" 
type="secnum"/> summarizes the tests generated in this way
and the results obtained from running them.</p>
<p>In this version of this document, familiarity with both XSDL and
Alloy is assumed.  If they have sufficient tolerance for partially
understood technical detail, readers lacking some of that knowledge
may nevertheless find it comprehensible in parts.</p>
</div>

<div id="variation">
<head>Sources of variation</head>
<p>To generate test cases with reasonably good coverage of schema
composition, it would be convenient to be able to model the points on
which the behavior of processors may or must vary.  These
include:<list>
<item><label>processor policy for component acquisition</label>: are
schemaLocation hints followed? In principle, the policy could be
anything; for testing, we probably need to specify a choice of:<list>
<item>follow <hi rend="bold">no</hi> schemaLocation hints; read only
the schema documents specified at invocation time (this involves using
a proxy server that ensures that the required attempts to dereference
the schema documents will fail)</item>
<item>follow schemaLocation hints <hi rend="bold">only when
required</hi>, i.e. only on xs:include and xs:redefine elements;
ignore schemaLocation hints on xs:import and in xsi:schemaLocation and
xsi:noNamespaceSchemaLocation attributes in the instance</item>
<item>follow the <hi rend="bold">first</hi> schemaLocation hint for
each namespace not covered by a schema document named at invocation
time</item>
<item>follow <hi rend="bold">all</hi> schemaLocation hints (even
multiples)</item>
</list>
Note that the existing XML Schema test suite appears to be built on
the assumption that the choice of processor policy for component
acquisition is unproblematic.  The test suite catalog does allow
several schema documents to be specified for a test, using the
<ident>schemaTest</ident> element and its
<ident>schemaDocument</ident> children.  It is not clear from the
documentation, however, whether processors running the test are
expected to read those schema documents and no others, or to read all
of those schema documents and optionally any others they may point at.
</item>
<item><label>starting documents</label>:  which schema documents are
specified at invocation time?</item>
<item><label>document availability</label>:  for each set of
documents, some subset may be unavailable</item>
<item><label>schemaLocation hints in instance</label>:  for each
namespace, does the instance point to a starting schema document for
that namespace?  Does it do so once, more than once, or not at all? In
what order do the schemaLocation hints occur?  
</item>
<item><label>order of lists</label>:  when several schema documents are
specified at invocation time, or in the same schemaLocation attribute,
what order are they listed in?
Does it matter?<note
place="foot">It clearly does matter sometimes.  Consider
an instance beginning<eg><![CDATA[ <ns1:wrapper 
  xmlns:ns1="http://www.w3.org/XML/Group/2007/09/schema_composition/ns1"
  xmlns:ns2="http://www.w3.org/XML/Group/2007/09/schema_composition/ns2"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="
    http://www.w3.org/XML/Group/2007/09/schema_composition/ns1
      c.xsd
  "
  >
]]></eg>
At least two processors
<!--* Xerces C and Saxon SA, tested 7 September 2007 *-->
build a schema and validate the instance without complaint, but
if a second namespace / schema document pair is added to the
schemaLocation attribute, they fail to find the declaration for
the ns1:wrapper element.
<eg><![CDATA[ <ns1:wrapper 
  xmlns:ns1="http://www.w3.org/XML/Group/2007/09/schema_composition/ns1"
  xmlns:ns2="http://www.w3.org/XML/Group/2007/09/schema_composition/ns2"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="
    http://www.w3.org/XML/Group/2007/09/schema_composition/ns2
      b.xsd
    http://www.w3.org/XML/Group/2007/09/schema_composition/ns1
      c.xsd
  "
  >
]]></eg>
If the order of the schema location pairs is changed, the
behavior of the processors changes.</note></item>
<item><label>schemaLocation information in the schema
documents</label>: for each pair of schema documents A and B, does A
include B?  B include A? import? redefine? N.B. I'll use the verb
<mentioned>call</mentioned> to cover all three of these relations:  A
calls B if and only if A includes B or A redefines B or A imports
B.</item>
<item><label>single call vs. multiple call</label>: if A includes B,
does it do so once? twice? how many times? Ditto for import and
redefine.<note place="foot"><p> It's not clear what interpretation the
XSDL spec supplies for schema document A containing two xs:redefine
elements each pointing to document B and redefining the same or
different components.  But I have not noticed any rules which
explicitly forbid it.  The example serves a useful purpose either way:
either we can demonstrate that the spec forbids it, or we can
demonstrate that the spec allows it and assigns a particular
interpretation to it, or we cannot demonstrate either of those
propositions, which is itself a useful, although not a particularly
happy, result.</p></note>
</item>
<item><label>namespace matching</label>:  when A calls B, do their
namespaces match or differ? The constraints in XSDL are
straightforward enough to check that there doesn't seem much point in
trying to exercise all possible variations here; it's probably enough
to have some simple examples of violations of these rules, and then to
generate other test cases from schema documents which obey these
rules:<list>
<item>if A includes or redefines B, then their target namespaces
match, or B lacks a target namespace</item>
<item>if A imports B, then their target namespaces differ</item>
</list> I don't see rules forbidding <list>
<item>cycles on any kind of composition</item>
<item>self-inclusion or self-redefinition (N.B. self-import fails the
namespace-cleanliness rules)</item>
<item>multiple calls to the same schema document of different
types</item>
<item>multiple calls of the same type to the same schema
document</item>
</list>
</item>
<item><label>behavior with respect to missing components</label>; the
possible kinds of missing component appear to be:<note place="foot">
See <ptr target="norq151" type="bibref"/>, Appendix A, for slightly
more detail.</note><list>
<item>attribute {type definition}</item>
<item>element {type definition}</item>
<item>element {substitution group affiliation}</item>
<item>type definition {base type definition}</item>
<item>type definition {attribute uses}</item>
<item>type definition {content type} (simple type may be
unavailable)</item>
<item>type definition content model may refer to unavailable
elements</item>
<item>attribute group may refer to unavailable attributes</item>
<item>named model group may refer to unavailable elements</item>
<item>element identity constraints may be unavailable </item>
<item>simple type definition {member type definition}</item>
<item>simple type definition {item type definition}</item>
</list> It might simplify life if we can successfully test schema
composition without getting into missing components.
</item>
<item><label>lazy assembly vs. eager assembly</label>: does the
processor gather all schema documents together first, then build the
schema, then validate?  Or does it begin validation with a partial
schema, to which components are added when needed?  In principle,  the
XSDL spec has been written to make lazy assembly possible, but we are
not supposed to be able to tell the difference.  And indeed one
rationale for the hand-waving in XSDL's description of component
acquisition is that leaving processors such freedom allows any odd
results of lazy assembly to be understood instead as quirky choices
during component acquisition.  It's not clear whether test cases
should, or can, actually expose the reality of the processor's
behavior in this area, but it may be possible to construct test cases
which present different challenges for lazy and eager
assemblers.</item>
</list>
</p>
</div>


<div id="m1">
<head>A simple model of schema composition</head>
<p>Trying to generate test cases to cover all possible combinations
of the variables identified above may be very time-consuming and
produce more test cases than we can conveniently handle.  If 
we assume<list>
<item>three schema documents</item>
<item>some subset (zero to three) of documents specified
as starting documents</item>
<item>some subset actually available</item>
<item>some subset of schema documents pointed to from 
the instance, in either or both of two locations</item>
<item>some network of call relations (include, redefine,
import) among schema documents</item>
<item>if one schema document calls another, it may do so
either once or twice<note place="foot">Strictly speaking,
it might do so any number of times, but it seems unlikely
that processors will handle two such calls but not three,
or vice versa.  So we limit the number to two, for
simplicity in the calculation we are performing.</note></item>
</list>
then there are 
8
&times; 8 
&times; 64 
&times; 7,625,597,484,987,<note place="foot">
I.e.
(2 ** 3) sets of starting documents,
&times; (2 ** 3) sets of documents actually available,
&times; (4 ** 3) distinct patterns of schemaLocation hints from the instance,
&times; (27 ** 9) different general labeled graphs of call relations.</note>
or about 3.1E16 (3.1 quadrillion) cases to be generated.</p>
<p>Even if these three quadrillion test cases could be generated with
acceptable speed, it might not be easy to find people willing to run
them all for various processors. It may be a good idea, therefore, to
try to divide the space a little and make some simplifying assumptions
in exchange for a more tractable set of test cases.</p>
<p>We are also not necessarily required to generate all possible test
cases; a systematic or random selection might suffice to point to
important unanswered questions.</p>
<p>In the spirit, therefore, of starting with a fairly simple model of
the problem, we can begin by ignoring some aspects of schema composition and
modeling just part of the phenomenon.</p>
<p>We are unlikely to need to reuse this model, but in case we do,
and for the sake of simple documentation, we define this model as
an Alloy model named <ident>schema_composition01</ident>.
The body of the model consists of some rules about namespaces,
some about schema documents, and finally some miscellaneous
predicates.
<scrap file="schema_composition01.als">
module schema_composition01

// First simple model of schema composition.  Think of this 
// as a sanity check.

// This model oversimplifies by not considering cases where
// the same schema document includes, redefines, or imports 
// other schema documents more than once.
<ptr target="sc_nss"/>
<ptr target="sc_sds"/>
<ptr target="sc_preds"/>
</scrap>
</p>
<p>For purposes of this model, namespaces are objects which
have identity and can thus be distinguished from each other.
They have no other properties of interest.  We say this with
a very simple Alloy signature declaration:
<scrap id="sc_nss" name="Namespaces">
// Namespaces are just things that have identity.  We don't
// care about their properties.
sig NS {}
</scrap>
</p>
<p>Schema documents, on the other hand, do have an internal structure
we care about.  We ignore most of what can actually happen in a schema
document: we don't model element or attribute declarations or type
definitions, only the relations between schema documents (and schemas)
defined in section 4 of the XSDL spec (<ptr target="xsdl10"
type="bibref"/>, <ptr target="xsdl11" type="bibref"/>), namely
inclusion, import, and redefinition.  For now we ignore the sequence
of <ident>xs:include</ident>, <ident>xs:import</ident>, and
<ident>xs:redefine</ident> elements, and also the possibility of
multiple arcs with the same values for originating node, target node,
and label.  It may be worth modeling the order of calls, and multiple
redundant calls, in a later variation of the model.
Also, each schema document has an optional target namespace.
<scrap id="sc_sds" name="Schema documents and their properties">
// Schema documents have a target namespace, includes,
// excludes, and imports.
sig SchemaDoc {
  tns : lone NS,
  includes : set SchemaDoc,
  redefines : set SchemaDoc,
  imports : set SchemaDoc
}
</scrap>
</p>
<p>It's informative to check to see whether the model
defined so far has any instances.  To do this, we define
an Alloy predicate asking for a non-empty world, and
ask Alloy to run it. 
<scrap id="sc_preds" name="Miscellaneous predicates">
pred non_empty_universe(S : SchemaDoc) {}
run non_empty_universe for 3
</scrap>
</p>
<p>
When we execute the command <q><code>run non_empty_universe for
3</code></q>, the Alloy Analyzer presents us with an instance of the
predicate we have defined, in which no signature has more than three
instances.  The first instance found has just one schema
document; in the graphical form generated by Alloy, it looks 
like this:<figure entity="eg01">
<p>A one-document instance of the model</p>
<figDesc>The figure shows a green oval labeled
<q>SD ($non_empty_universe_S) imports: SD
includes: SD</q>, with two arcs running out from the oval
and back to the oval, labeled <q>impors</q>
and
<q>includes</q>.  There is also a tan-colored box
labeled <q>NS</q>.</figDesc>
</figure>
The world has one schema document, SD, and one namespace, NS.
SD has no target namespace, and SD both includes and
imports itself.</p>
<p>Another more complex example may also be worth
showing:
<figure entity="eg02">
<p>A three-document instance of the model</p>
<figDesc>The figure shows three green oval labeled
SD0, SD1, and SD2.  Several arcs run from oval to
oval, as described in the text.
There is also a tan-colored box
labeled <q>NS</q>.</figDesc>
</figure>
There are three schema documents, none with a target
namespace:
<list>
<item>SD0 both includes and redefines SD2.</item>
<item>SD1 both includes and redefines both
itself and SD0.</item>
<item>SD2 includes SD1, redefines SD1, and
imports SD0, SD1, and itself.</item>
</list>
</p>
<p>Notice that neither of these two instances actually
represents a legal schema:  the self-imports violate
the rule that the namespace being imported must differ
from the schema document's target namespace.  Other
instances generated by the model so far violate
the rules about namespace matching for inclusions and
redefinitions.</p>
<p>We can define a predicate which is true of a schema
document S just in case S follows the basic rules for
namespaces in schema composition:<list>
<item>If S includes a document A, then
either their target namespaces match, or else
A has no target namespace.  (Here and in the other
rules, an absent target namespace matches another
target namespace, and does <emph>not</emph> match
an actual target namespace.)  In Alloy, this
can be expressed as <q><code>all SI : S.includes
| (SI.tns = S.tns or no SI.tns)</code></q> for
the case where S has a target namespace,<note place="foot">A
literal paraphrase of the Alloy expression may be helpful:
<q>For all SI in the set S.includes, it is the
case that SI.tns = S.tns or else that there exists
no namespace S.tns (S.tns is the empty set).</q>
</note> and 
as <q><code>all SI : S.includes
| (no SI.tns)</code></q> otherwise.<note place="foot">
A paraphrase:
<q>For all SI in the set S.includes, it is the case
that there is nothing in the set SI.tns.</q></note></item>
<item>If S redefines a document A, then
either their target namespaces match, or else
A has no target namespace.  (Here and in the other
rules, an absent target namespace matches another
target namespace, and does <emph>not</emph> match
an actual target namespace.)  The Alloy
expression is just as for inclusions, if we
substitute <q><code>redefines</code></q>
for <q><code>includes</code></q>.</item>
<item>If S imports a document A,<note place="foot">More exactly,
the XSDL spec would say that S imports a namespace
N, and identifies A as a schema document for
that namespace; for purposes of this paper, we
can say <q>S imports A</q> for this.</note> then
target namespaces differ.  In Alloy:
<q><code>all SI : S.imports | (ST.tns != S.tns or
no SI.tns)</code></q> (if S has a target namespace)
or as <q><code>all SI : S.imports | (some SI.tns)</code></q>
(otherwise).</item>
</list>
Putting these together, we have the Alloy definition of the
<ident>nsok</ident> (namespace OK) predicate:
<scrap prev="sc_preds" name="More miscellaneous predicates">
pred nsok[S : SchemaDoc] {
  some S.tns implies (
    (all SI : S.includes + S.redefines | (SI.tns = S.tns or no SI.tns))
    and
    (all SI : S.imports | (SI.tns != S.tns or no SI.tns))
  )
  no S.tns implies (
    no S.(includes+redefines).tns
    and
    (all SI : S.imports | some SI.tns)
  )
}
run nsok for 3
</scrap>
</p>
<p>Armed with the <ident>nsok</ident> predicate, we can define
a predicate that holds for worlds in which each schema
document is namespace-OK:<note place="foot">There might
be some mileage in defining a signature for the class of 
namespace-OK schema documents; if we did, then all_clean
might be defined this way:
<eg>sig NSCleanSchemaDoc extends SchemaDoc {}{
  nsok[this]
}

pred all_clean() {
  no SchemaDoc - NSCleanSchemaDoc
}</eg>
The body of the all_clean predicate says:  the set
difference of the set of schema documents
and the set of namespace-OK schema documents
(<q><code>SchemaDoc - NSCleanSchemaDoc</code></q>) 
is empty (there exists
no member of the set).
</note>
<scrap prev="sc_preds" name="More miscellaneous predicates">
pred all_clean() {
  all S : SchemaDoc | nsok[S]
}
run all_clean for 1
run all_clean for 2
run all_clean for 3
</scrap>
</p>
<p>If they are helpful in eliminating uninteresting test cases,
further constraints might be defined.  Some obvious candidates
(not defined here now because in fact I think the cases
which violate these constraints are interesting):<list>
<item>No self-inclusion, no self-redefinition.
(I.e. no cycles of length 1.  Longer cycles need not
and should not be forbidden, except to explore the
implications of adding such a constraint to the spec.</item>
<item>No overlap between the includes and the redefines
of a given document.  (Again, overlap in the transitive
closure should <emph>not</emph> be forbidden, for test
cases intended to explore XSDL 1.0 and its implementations,
since in reality we know such cases arise and cause
problems for implementations and users.)</item>
</list>
</p>

<p>It will be useful to generate some test cases which do not
obey the namespace-OK constraints (or the others, if we 
later define them), but for the most part, we will be
more interested in test cases which don't violate the
namespace matching constraints, since they are clear and
easily checked.</p>
<p>Recent versions of Alloy expose a Java API to the
Alloy Analyzer, by means of which it's possible to 
perform the operations offered by the Analyzer's GUI, 
under program control.  With the help of the Alloy
team (in particular Felix Chang), it has proven straightforward
to construct a Java program to load the model given above
and write out XML descriptions of instances of the model.
The format of these XML descriptions is described further
below.</p>
<p>As an example, when the Alloy command <q><code>run all_clean for 1</code></q> is
executed, several instances of the model are generated.  These
are perhaps useful because they compactly exercise conditions
of self-inclusion and self-redefinition.  If we are satisfied
that these instances provide an adequate check on processor
behavior in such cases, we can then eliminate self-arcs from
the model when generating later test cases.  (If self-arcs
may interact with code for other inclusions and redefinitions,
we won't want to eliminate self-arcs from the cases with multiple
schema documents.)
A summary of the single-document test cases follows:
<!--* <list type="ordered">
 <item><label>m1a00.xml</label>:  0 NS.
0 SchemaDoc.
</item>

 <item><label>m1a01.xml</label>:  0 NS.
1 SchemaDoc.
<list><item>SchemaDoc$0</item>
</list></item>

 <item><label>m1a02.xml</label>:  0 NS.
1 SchemaDoc.
<list><item>SchemaDoc$0
redefines:    SchemaDoc$0.</item>
</list></item>

 <item><label>m1a03.xml</label>:  0 NS.
1 SchemaDoc.
<list><item>SchemaDoc$0
includes:    SchemaDoc$0.</item>
</list></item>

 <item><label>m1a04.xml</label>:  0 NS.
1 SchemaDoc.
<list><item>SchemaDoc$0
includes:    SchemaDoc$0;
redefines:    SchemaDoc$0.</item>
</list></item>

 <item><label>m1a05.xml</label>:  1 NS.
1 SchemaDoc.
<list><item>SchemaDoc$0
redefines:    SchemaDoc$0.</item>
</list></item>

 <item><label>m1a06.xml</label>:  1 NS.
0 SchemaDoc.
</item>

 <item><label>m1a07.xml</label>:  1 NS.
1 SchemaDoc.
<list><item>SchemaDoc$0</item>
</list></item>

 <item><label>m1a08.xml</label>:  1 NS.
1 SchemaDoc.
<list><item>SchemaDoc$0
tns:    NS$0.</item>
</list></item>

 <item><label>m1a09.xml</label>:  1 NS.
1 SchemaDoc.
<list><item>SchemaDoc$0
tns:    NS$0.
redefines:    SchemaDoc$0.</item>
</list></item>


 <item><label>m1a10.xml</label>:  1 NS.
1 SchemaDoc.
<list><item>SchemaDoc$0
tns:    NS$0.
includes:    SchemaDoc$0.</item>
</list></item>

 <item><label>m1a11.xml</label>:  1 NS.
1 SchemaDoc.
<list><item>SchemaDoc$0
tns:    NS$0.
includes:    SchemaDoc$0;
redefines:    SchemaDoc$0.</item>
</list></item>

 <item><label>m1a12.xml</label>:  1 NS.
1 SchemaDoc.
<list><item>SchemaDoc$0
includes:    SchemaDoc$0;
redefines:    SchemaDoc$0.</item>
</list></item>

 <item><label>m1a13.xml</label>:  1 NS.
1 SchemaDoc.
<list><item>SchemaDoc$0
includes:    SchemaDoc$0.</item>
</list></item>

</list>
*-->
<table rend="white-bg">
 <row><cell>m1a00.xml</cell><cell>  0 NS,
0 SchemaDoc.</cell>
<cell>&#160;<!--* <figure rend="noscale" entity="m1a00">
</figure> *-->
</cell></row>

 <row><cell>m1a01.xml</cell><cell>  0 NS,
1 SchemaDoc.
<list><item>SchemaDoc$0</item>
</list></cell>
<cell><figure rend="noscale" entity="m1a01"></figure></cell></row>

 <row><cell>m1a02.xml</cell><cell>  0 NS,
1 SchemaDoc.
<list><item>SchemaDoc$0
redefines:    SchemaDoc$0.</item>
</list></cell>
<cell><figure rend="noscale" entity="m1a02">
</figure>
</cell>
</row>

 <row><cell>m1a03.xml</cell><cell>  0 NS,
1 SchemaDoc.
<list><item>SchemaDoc$0
includes:    SchemaDoc$0.</item>
</list></cell>
<cell><figure rend="noscale" entity="m1a03">
</figure>
</cell>
</row>

 <row><cell>m1a04.xml</cell><cell>  0 NS,
1 SchemaDoc.
<list><item>SchemaDoc$0
includes:    SchemaDoc$0;
redefines:    SchemaDoc$0.</item>
</list></cell>
<cell><figure rend="noscale" entity="m1a04">
</figure>
</cell>
</row>

 <row><cell>m1a05.xml</cell><cell>  1 NS,
1 SchemaDoc.
<list><item>SchemaDoc$0
redefines:    SchemaDoc$0.</item>
</list></cell>
<cell><figure rend="noscale" entity="m1a05">
</figure>
</cell>
</row>

 <row><cell>m1a06.xml</cell><cell>  1 NS,
0 SchemaDoc.
</cell>
<cell><figure rend="noscale" entity="m1a06">
</figure>
</cell>
</row>

 <row><cell>m1a07.xml</cell><cell>  1 NS,
1 SchemaDoc.
<list><item>SchemaDoc$0</item>
</list></cell>
<cell><figure rend="noscale" entity="m1a07">
</figure>
</cell>
</row>

 <row><cell>m1a08.xml</cell><cell>  1 NS,
1 SchemaDoc.
<list><item>SchemaDoc$0
tns:    NS$0.</item>
</list></cell>
<cell><figure rend="noscale" entity="m1a08">
</figure>
</cell>
</row>

 <row><cell>m1a09.xml</cell><cell>  1 NS,
1 SchemaDoc.
<list><item>SchemaDoc$0
tns:    NS$0.
redefines:    SchemaDoc$0.</item>
</list></cell>
<cell><figure rend="noscale" entity="m1a09">
</figure>
</cell>
</row>


 <row><cell>m1a10.xml</cell><cell>  1 NS,
1 SchemaDoc.
<list><item>SchemaDoc$0
tns:    NS$0.
includes:    SchemaDoc$0.</item>
</list></cell>
<cell><figure rend="noscale" entity="m1a10">
</figure>
</cell>
</row>

 <row><cell>m1a11.xml</cell><cell>  1 NS,
1 SchemaDoc.
<list><item>SchemaDoc$0
tns:    NS$0.
includes:    SchemaDoc$0;
redefines:    SchemaDoc$0.</item>
</list></cell>
<cell><figure rend="noscale" entity="m1a11">
</figure>
</cell>
</row>

 <row><cell>m1a12.xml</cell><cell>  1 NS,
1 SchemaDoc.
<list><item>SchemaDoc$0
includes:    SchemaDoc$0;
redefines:    SchemaDoc$0.</item>
</list></cell>
<cell><figure rend="noscale" entity="m1a12">
</figure>
</cell>
</row>

 <row><cell>m1a13.xml</cell><cell>  1 NS,
1 SchemaDoc.
<list><item>SchemaDoc$0
includes:    SchemaDoc$0.</item>
</list></cell>
<cell><figure rend="noscale" entity="m1a13">
</figure>
</cell>
</row> 
<!--*
<row><cell>m1a14.xml</cell>
<cell>1 NS, 3 SchemaDoc.</cell>
<cell><figure rend="noscale" entity="m1a14">
</figure></cell></row>
<row><cell>m1a15.xml</cell>
<cell>1 NS, 3 SchemaDoc.</cell>
<cell><figure rend="noscale" entity="m1a15">
</figure></cell></row>
<row><cell>m1a16.xml</cell>
<cell>1 NS, 3 SchemaDoc.</cell>
<cell><figure rend="noscale" entity="m1a16">
</figure></cell></row>
<row><cell>m1a17.xml</cell>
<cell>1 NS, 3 SchemaDoc.</cell>
<cell><figure rend="noscale" entity="m1a17">
</figure></cell></row>
<row><cell>m1a18.xml</cell>
<cell>1 NS, 3 SchemaDoc.</cell>
<cell><figure rend="noscale" entity="m1a18">
</figure></cell></row>
<row><cell>m1a19.xml</cell>
<cell>1 NS, 3 SchemaDoc.</cell>
<cell><figure rend="noscale" entity="m1a19">
</figure></cell></row>
<row><cell>m1a20.xml</cell>
<cell>1 NS, 3 SchemaDoc.</cell>
<cell><figure rend="noscale" entity="m1a20">
</figure></cell></row>
<row><cell>m1a21.xml</cell>
<cell>1 NS, 3 SchemaDoc.</cell>
<cell><figure rend="noscale" entity="m1a21">
</figure></cell></row>
<row><cell>m1a22.xml</cell>
<cell>1 NS, 3 SchemaDoc.</cell>
<cell><figure rend="noscale" entity="m1a22">
</figure></cell></row>
<row><cell>m1a23.xml</cell>
<cell>1 NS, 3 SchemaDoc.</cell>
<cell><figure rend="noscale" entity="m1a23">
</figure></cell></row>
<row><cell>m1a24.xml</cell>
<cell>1 NS, 3 SchemaDoc.</cell>
<cell><figure rend="noscale" entity="m1a24">
</figure></cell></row> 
*-->
</table>
It will be noted that some of these are essentially isomorphic:  if
the schema document has no target namespace, the presence of
an unused namespace in the world makes no material difference.  If
the presence of such extraneous namespaces proves irritating (as
it surely will, since it will double the number of cases to process
without adding further information), a predicate can be added
to require that all namespaces in the model be the target namespace
of some schema document.</p>

<p>Before we attempt to generate any concrete test cases
from these or other instances of this model, however, there are
some other problems we need to consider; we turn to those
problems in the next section.</p>

</div>

<div id="testcasedesign">
<head>Making interpretable test cases</head>
<p>The primary goal of the test cases is interoperability testing, not
conformance testing.  That is, we wish to be able to tell whether
different processors behave the same way, or in different ways, when
handling a particular test case.  For this purpose it is not essential
that we specify what the expected result of a given test is, only that it
be possible to tell what the processor did.  If the spec is clear,
then either there will be a clearly expected result, or else it will
be clear that the behavior is unspecified.  If it's not clear what
result is required by the spec for a given test, or whether a
particular result is required, that test is not much good for
conformance checking (except to illustrate that the spec is
underspecified).  But it can nevertheless be useful for
interoperability testing.</p>
<p>XSDL 1.0 defines what PSVI should result from a given input
document, given a particular set of schema components. But does not
require a processor to expose to clients any particular information about
what set of schema components was actually used in the validation. Nor
does it require the processor to follow any particular rules for
finding schema documents or other sources of schema components
(aka <soCalled>component acquisition</soCalled>):  at a
first approximation, processors may effectively do whatever they like
when it comes to schema composition.  XSDL 1.1 does require that a
processor document what component acquisition policies it follows (or
can follow at user option), but XSDL 1.0 does not.</p>
<p>So one important challenge for construction of test cases is to try
to ensure that from the test results it is possible to tell precisely
what components were present in the validating schema. If schema
document A includes schema document B, then we need to be able to
tell, from the validation results, whether B was actually included or
not. If schema document B is included by A and redefined by C,<note
place="foot"> By phrases like <q><mentioned>B is redefined by
C</mentioned></q> I mean that schema document C contains an
<ident>xs:redefine</ident> element which specifies schema document B
as a document to be consulted.  At the moment, it doesn't matter which
components of B are redefined in C; we need to choose the components
and the terms of redefinition in such a way as to ensure that we can
tell whether the <ident>xs:redefine</ident> was honored or not.</note>
then we need to be able to tell whether the relevant components from B
have been redefined or not.  And so on.</p>
<p>At the schema author's level, we would like to be able to
answer questions like:<list>
<item>Did the processor consult this particular schema document?</item>
<item>Did the processor honor this particular <ident>xs:include</ident>
element?</item>
<item>Did the processor honor this particular <ident>xs:redefine</ident>
element?</item>
<item>Did the processor honor this particular <ident>xs:import</ident>
element?</item>
<item>If a schema document has been called more than once in different
ways, which call was actually processed?  Was the schema document
included or imported?  Included or redefined?</item>
<item>Why did the processor consult this particular document?
Was it because the document was named at invocation time?
Pointed to from the document instance/
Pointed to from another schema document being consulted?</item>
<item>In what order did the processor consult the various schema
documents?  (If a document is reachable more than once, in
conflicting ways, a processor might raise an error.  Or it might
process the document the first time it sees a reference, and then 
decline to process it again when it sees the second reference,
either because it believes the document has already been
processed correctly or because it knows the second round of
processing would lead to an error.  In the latter cases, it
will be useful to know whether a schema document was processed
as for an include, or as for a redefinition.</item>
</list>
</p>
<p>It is not entirely clear whether test cases can easily
be constructed which allow all of these questions to be answered.
But I believe we can construct test cases which allow us to
answer the following questions for any schema document, by
looking at the validation results from any processor which
either provides access to the entire PSVI or at least issues
error or warning messages for invalid elements, as long as
it does not stop work as soon as it sees the first invalid
element.<note place="foot">If we encounter processors which
do stop as soon as they know that the root element is
invalid, then we will need to change from the single
test document outlined below to a set of 27, 54, or 81
test documents.</note>  (Let us call such processors
<term>indefatigable</term>, since they do not tire of
reporting validity problems.)
<list>
<item>Was this schema document consulted?</item>
<item>Were the components redefined?</item>
<item>By what other schema document were the components
redefined?</item>
</list>
We do this by making each schema document in the test
define a readily identifiable set of components, which
will be detectable if present in the schema, but which
will not cause problems by their absence.  We also
ensure that if any schema document redefines components
from any schema document, it does so in a characteristic 
way which allows us to tell which redefinitions were
involved.   Finally, we provide a test document which
provides element instances which will be valid, or invalid,
depending on which components are present in the schema.
</p>
<p>The discussion below assumes we define three (or at most three)
schema documents with one, two, or three different values for their
target namespaces; the principles can be extended for larger finite
numbers of schema documents.  The three schema documents
are called A, B, and C.</p>
<div id="m1_tracers">
<head>Basic tracer components</head>
<p>Each schema document defines (for its target namespace)
an element and a type with the same name as the schema
document.  That is, schema document A reads in part:
<eg><![CDATA[ <xsd:element name="a" type="tns:a"/>
 <xsd:simpleType name="a">
  ...
 </xsd:simpleType>]]></eg>
and schema documents B and C similarly define elements
named b and c, respectively, of type 
tns:b and tns:c, respectively.</p>
<p>
For simpllicity, we make the tracer components be simple
types; we will define different pattern facets at 
different places, to make it easy to tell which constraint
was imposed where.  The basic tracer components have a
very simple constraint:  element a, of type a, must
contain at least one <q><code>a</code></q>, and so on.
So the full definition of type tns:a is:
<eg><![CDATA[ <xsd:simpleType name="a">
  <xsd:restriction base="xsd:string">
   <xsd:pattern value=".*a.*">
   </xsd:pattern>
  </xsd:restriction>
 </xsd:simpleType>]]></eg>
</p></div>
<div id="m1_wrapper">
<head>Test document wrapper</head>
<p>If the test document contains some a, b, and c
elements in the appropriate namespaces, with at least
some of them guaranteed to be invalid, then 
we can tell which schema documents were consulted
by noticing which elements are actually validated.
</p>
<p>
The elements should match a lax wildcard to ensure
that the absence of an element declaration won't
lead to extraneous error messages.  So the test
document should have a root element declared something
like this:
<eg><![CDATA[ <xsd:element name="wrapper" type="tns:lax"/>
 <xsd:complexType name="lax">
  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
   <xsd:any processContents="lax"/>
  </xsd:sequence>
 </xsd:complexType>]]></eg>
</p>
<p>At the moment, I'm not sure how to guarantee that
the wrapper element is always declared no matter
what.</p>
</div>
<div id="m1_redefinition">
<head>Redefinition traces</head>
<p>The test cases we'll generate will, or won't, include
cases of arbitrary schema documents redefining (components
in) arbitrary schema documents.  To ensure that the
redefinition of a type is visible, each xs:redefine
element will impose a distinct constraint, in the form of
a unique pattern.</p>
<p>When schema document A redefines schema document B,
for example, we will add the pattern <q><code>.*A.*</code></q>
to type b.  For example:<eg><![CDATA[ <xsd:redefine schemaLocation="b.xsd">
  <xsd:simpleType name="b">
   <xsd:restriction base="tns:b">
    <xsd:pattern value=".*A.*"/>
   </xsd:restriction>
  </xsd:simpleType>
 </xsd:redefine>]]></eg>
So if instances of type b are valid only when they contain
an <q><code>A</code></q>, we can infer that type b was
redefined by schema document A.  If they also require
a <q><code>C</code></q>, then type b was also redefined
by schema document C.</p>
<p>This does <emph>not</emph> allow us to tell whether
the redefinition chain runs A &rarr; C &rarr; B
or C &rarr; A &rarr; B.
If that turns out to be of interest, we can add
length facets, with A requiring a minimum length of
1, B requiring minLength 2, and C requiring 3.  In
that case, the chain 
A &rarr; C &rarr; B would be illegal (you can't
restrict a minimum length of 3 by requiring a
minimum length of 1, and XSDL forbids it as
nonsensical), while
C &rarr; A &rarr; B 
would be legal.  We can tell which chain is present
by checking for errors in schema construction.
</p>
</div>
<div id="m1_testdoc">
<head>The test document</head>
<p>The test document itself consists of a wrapper
containing a series of a, b, and c elements in various 
namespaces.</p>
<p>For now, we don't try to distinguish lazy from 
eager assembly, but put schema location information
for all three schema documents on the root
element.  And we don't vary the sequence of children
to try to detect sequence dependencies in the processors.
</p>
<p>There are six constraints (the patterns requiring,
respectively, one of <q><code>abcABC</code></q> to 
appear in the literal), but we don't need to check for
all combinations.  For the constraints imposed by
schema document A, for example, we need to check for
the cases of
<list>
<item>no constraint at all (no <q><code>a</code></q>
or <q><code>A</code></q> required)</item>
<item>basic constraint (<q><code>a</code></q>
required but not <q><code>A</code></q>)</item>
<item>redefinition constraint (<q><code>A</code></q>
required)</item>
</list>
Since there are three such triples (one each for schema
documents A, B, and C), we need 3 ** 3 = 27 instances
of each element a, b, and c.  For now, I assume we only 
need to look at a, b, and c elements in the appropriate
namespace.</p>
<p>The outer shell of the test document looks like this:
<scrap id="st_root" file="sampletest.xml"> &lt;test:wrapper 
  <ptr target="st_nss"/>
  >

  &lt;!--* 27 instances of type a, obeying strong, weak, 
      * or neither forms of constraints imposed by 
      * schema documents A, B, C.
      *-->
  <ptr target="st_a"/>

  &lt;!--* 27 instances of type b, ditto.  *-->
  <ptr target="st_b"/>

  &lt;!--* 27 instances of type c, ditto. *-->
  <ptr target="st_c"/>
 &lt;/test:wrapper> 
</scrap></p>
<p>The namespace and schema location attributes will depend on 
the particular test case being generated.  For the sake of this
example assume that schema documents A and B have target
namespace ns0 (i.e.
<q><code>http://www.w3.org/XML/Group/2007/09/schema_composition/ns0</code></q>)
and that C has no target namespace.  
For now, at least, we'll put the wrapper element into namespace
<q><code>http://www.w3.org/XML/Group/2007/09/schema_composition/tests0</code></q>)
and assume it's got a schema document at <ident>driver.xsd.</ident>
Then the relevant attributes will read:<scrap id="st_nss"
name="Namespace declarations and schema locations">
  xmlns:test="http://www.w3.org/XML/Group/2007/09/schema_composition/tests0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:ns0="http://www.w3.org/XML/Group/2007/09/schema_composition/ns0"
  xsi:schemaLocation="
    http://www.w3.org/XML/Group/2007/09/schema_composition/tests0
      driver.xsd
    http://www.w3.org/XML/Group/2007/09/schema_composition/ns0
      a.xsd
    http://www.w3.org/XML/Group/2007/09/schema_composition/ns0
      b.xsd"
  xsi:noNamespaceSchemaLocation="c.xsd"
</scrap></p>
<p>The set of tests for type a work systematically through the 
27 possible combinations of nothing, lowercase only, uppercase
for A, B, and C:<scrap id="st_a" name="27 instances of type a">
  &lt;ns0:a>......&lt;/ns0:a>
  &lt;ns0:a>.....c&lt;/ns0:a>
  &lt;ns0:a>....Cc&lt;/ns0:a>
  &lt;ns0:a>...b..&lt;/ns0:a>
  &lt;ns0:a>...b.c&lt;/ns0:a>
  &lt;ns0:a>...bCc&lt;/ns0:a>
  &lt;ns0:a>..Bb..&lt;/ns0:a>
  &lt;ns0:a>..Bb.c&lt;/ns0:a>
  &lt;ns0:a>..BbCc&lt;/ns0:a>
  &lt;ns0:a>.a....&lt;/ns0:a>
  &lt;ns0:a>.a...c&lt;/ns0:a>
  &lt;ns0:a>.a..Cc&lt;/ns0:a>
  &lt;ns0:a>.a.b..&lt;/ns0:a>
  &lt;ns0:a>.a.b.c&lt;/ns0:a>
  &lt;ns0:a>.a.bCc&lt;/ns0:a>
  &lt;ns0:a>.aBb..&lt;/ns0:a>
  &lt;ns0:a>.aBb.c&lt;/ns0:a>
  &lt;ns0:a>.aBbCc&lt;/ns0:a>
  &lt;ns0:a>Aa....&lt;/ns0:a>
  &lt;ns0:a>Aa...c&lt;/ns0:a>
  &lt;ns0:a>Aa..Cc&lt;/ns0:a>
  &lt;ns0:a>Aa.b..&lt;/ns0:a>
  &lt;ns0:a>Aa.b.c&lt;/ns0:a>
  &lt;ns0:a>Aa.bCc&lt;/ns0:a>
  &lt;ns0:a>AaBb..&lt;/ns0:a>
  &lt;ns0:a>AaBb.c&lt;/ns0:a>
  &lt;ns0:a>AaBbCc&lt;/ns0:a>
</scrap></p>
<p>The tests for types b and c are exactly similar
and need not be repeated here.<note place="foot"><p>They
do, however, have to appear in this document
somewhere, in order for the literate programming system
to generate a correct sample test document.
So they have been hidden in this footnote.
First type b:
<scrap id="st_b" name="27 instances of type b">
  &lt;ns0:b>......&lt;/ns0:b>
  &lt;ns0:b>.....c&lt;/ns0:b>
  &lt;ns0:b>....Cc&lt;/ns0:b>
  &lt;ns0:b>...b..&lt;/ns0:b>
  &lt;ns0:b>...b.c&lt;/ns0:b>
  &lt;ns0:b>...bCc&lt;/ns0:b>
  &lt;ns0:b>..Bb..&lt;/ns0:b>
  &lt;ns0:b>..Bb.c&lt;/ns0:b>
  &lt;ns0:b>..BbCc&lt;/ns0:b>
  &lt;ns0:b>.a....&lt;/ns0:b>
  &lt;ns0:b>.a...c&lt;/ns0:b>
  &lt;ns0:b>.a..Cc&lt;/ns0:b>
  &lt;ns0:b>.a.b..&lt;/ns0:b>
  &lt;ns0:b>.a.b.c&lt;/ns0:b>
  &lt;ns0:b>.a.bCc&lt;/ns0:b>
  &lt;ns0:b>.aBb..&lt;/ns0:b>
  &lt;ns0:b>.aBb.c&lt;/ns0:b>
  &lt;ns0:b>.aBbCc&lt;/ns0:b>
  &lt;ns0:b>Aa....&lt;/ns0:b>
  &lt;ns0:b>Aa...c&lt;/ns0:b>
  &lt;ns0:b>Aa..Cc&lt;/ns0:b>
  &lt;ns0:b>Aa.b..&lt;/ns0:b>
  &lt;ns0:b>Aa.b.c&lt;/ns0:b>
  &lt;ns0:b>Aa.bCc&lt;/ns0:b>
  &lt;ns0:b>AaBb..&lt;/ns0:b>
  &lt;ns0:b>AaBb.c&lt;/ns0:b>
  &lt;ns0:b>AaBbCc&lt;/ns0:b>
</scrap></p>
<p>And then type c:
<scrap id="st_c" name="27 instances of type c">
  &lt;c>......&lt;/c>
  &lt;c>.....c&lt;/c>
  &lt;c>....Cc&lt;/c>
  &lt;c>...b..&lt;/c>
  &lt;c>...b.c&lt;/c>
  &lt;c>...bCc&lt;/c>
  &lt;c>..Bb..&lt;/c>
  &lt;c>..Bb.c&lt;/c>
  &lt;c>..BbCc&lt;/c>
  &lt;c>.a....&lt;/c>
  &lt;c>.a...c&lt;/c>
  &lt;c>.a..Cc&lt;/c>
  &lt;c>.a.b..&lt;/c>
  &lt;c>.a.b.c&lt;/c>
  &lt;c>.a.bCc&lt;/c>
  &lt;c>.aBb..&lt;/c>
  &lt;c>.aBb.c&lt;/c>
  &lt;c>.aBbCc&lt;/c>
  &lt;c>Aa....&lt;/c>
  &lt;c>Aa...c&lt;/c>
  &lt;c>Aa..Cc&lt;/c>
  &lt;c>Aa.b..&lt;/c>
  &lt;c>Aa.b.c&lt;/c>
  &lt;c>Aa.bCc&lt;/c>
  &lt;c>AaBb..&lt;/c>
  &lt;c>AaBb.c&lt;/c>
  &lt;c>AaBbCc&lt;/c>
</scrap></p>
</note>
</p>
<p>It should be clear now how this test setup allows us to answer
the low-level questions noted above:<list>
<item><p><label>Q</label>. Was this schema document consulted?</p>
<p><label>A</label>.  If the elements it defines (a, b, or c) are
being validated, then yes, it was consulted.  This should be visible
either from the PSVI dump (if the processor supports that) or from the
presence or absence of validation error messages.  The string
<q><code>......</code></q> is not a member of any of the three types,
so there should be an error message at least for the test element
containing that string.  If there are not messages about invalid
elements, then either the elements are not being validated or else the
processor does not issue error messages for invalid elements (in which
case the results must be interpreted in the light of the information
the processor actually does provide).</p></item>
<item><p><label>Q</label>. Were the components redefined?</p>
<p><label>A</label>.  If every test element containing the appropriate
lowercase letter (<q><code>a</code></q> for type a,
<q><code>b</code></q> for type b, etc.) is valid, then the type has
not been redefined.  Otherwise, it has. </p></item>
<item><p><label>Q</label>. By what other schema document were the components
redefined?</p>
<p><label>A</label>.  If the valid instances of any type all contain a 
capital letter (A, B, or C), then the type was redefined by the associated 
schema document.  If the only valid instance is <q><code>AaBbCc</code></q>,
then the type was redefined by all three schema documents.
</p></item>
</list></p>
</div>
</div>

<div id="handcrafted">
<head>Hand-created tests</head>
<div id="toyresults">
<head>Toy tests</head>
<p>Before discussing how to automate the task of generating test cases
from Alloy's XML dumps, it may be useful to examine a few
test cases constructed manually, as a way of thinking
about details of what the test cases should look like.</p>

<p>The
test case for m1a02 (described above at the end of
section <ptr target="m1" type="secnum"/>) begins with the following start-tag:
<eg><![CDATA[ <wrapper 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="abc.m1a02.xsd"
  >
]]></eg>
and continues as shown above, with the a, b, and c element all
unqualified (not in any declared namespace).  The test document 
instance for m1a03 looks similar, but points to a different 
schema document.</p>
<p>The schema for m1a03 reads, in its essentials, thus::<eg><![CDATA[<xsd:schema 
 xmlns:xsd ="http://www.w3.org/2001/XMLSchema" 
 >
 <xsd:annotation>
  <xsd:documentation>
   <div xmlns="http://www.w3.org/1999/xhtml"
   >
    <p>Sample schema for discussion of schema composition.
     CMSMcQ, 6 September 2007.</p>
    <p>This is test case m1a03:  0 NS, 1 SchemaDoc.</p>
    <ul>
     <li>SchemaDoc$0 includes: SchemaDoc$0.</li>
    </ul>
   </div>
  </xsd:documentation>
 </xsd:annotation>

 <xsd:include schemaLocation="abc.m1a03.xsd">
  <!--* self-inclusion *-->
 </xsd:include>

 <xsd:element name="a" type="a"/>
 <xsd:simpleType name="a">
  <xsd:restriction base="xsd:string">
   <xsd:pattern value=".*a.*">
   </xsd:pattern>
  </xsd:restriction>
 </xsd:simpleType>

 <xsd:element name="wrapper" type="lax"/>
 <xsd:complexType name="lax">
  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
   <xsd:any processContents="lax"/>
  </xsd:sequence>
 </xsd:complexType>

</xsd:schema>]]></eg>
</p>
<p>A quick check of several processors
<!--* Xerces C, Xerces J, and Saxon SA *-->
shows that they all do the 
same thing with test m1a03:  element a and type a are defined, and they have
no problem with the inclusion cycle.</p>
<p>The schema document for m1a02 is similar, but instead of the inclusion it
has a redefinition:
<eg><![CDATA[ <xsd:redefine schemaLocation="abc.m1a02.xsd">
  <!--* self-redefinition *-->
  <xsd:simpleType name="a">
   <xsd:restriction base="a">
    <xsd:pattern value=".*A.*"/>
   </xsd:restriction>
  </xsd:simpleType>
 </xsd:redefine>]]></eg></p>
<p>The test results for this case are suggestive.</p>
<p>One processor (processor C in the tables below in section
<ptr target="t0results" type="secnum"/>)
basically ignores the redefinition:  the schema used to
validate has the basic definition of type a, but not the redefinition,
as shown by the error messages (which have been reformatted here for
legibility):
<eg><![CDATA[$ ~/bin/runProcessorC abc.m1a02.xml

Warning at file /Library/SGML/Public/W3C/xhtml1-strict.dtd, line 239, char 8
  Message: Attribute 'xmlns' has already been declared for element 'html'

Warning at file http://www.w3.org/2001/XMLSchema.dtd, line 128, char 17
  Message: Attribute 'xmlns:xsd' has already been declared for element 'xsd:schema'

Error at file /Users/cmsmcq/2007/schema/exx/abc.m1a02.xml, line 8, char 16
  Message: Datatype error: Type:InvalidDatatypeValueException, 
  Message:Value '......' does not match regular expression facet '.*a.*'.

Error at file /Users/cmsmcq/2007/schema/exx/abc.m1a02.xml, line 9, char 16
  Message: Datatype error: Type:InvalidDatatypeValueException, 
  Message:Value '.....c' does not match regular expression facet '.*a.*'.

Error at file /Users/cmsmcq/2007/schema/exx/abc.m1a02.xml, line 10, char 16
  Message: Datatype error: Type:InvalidDatatypeValueException, 
  Message:Value '....Cc' does not match regular expression facet '.*a.*'.

Error at file /Users/cmsmcq/2007/schema/exx/abc.m1a02.xml, line 11, char 16
  Message: Datatype error: Type:InvalidDatatypeValueException, 
  Message:Value '...b..' does not match regular expression facet '.*a.*'.

Error at file /Users/cmsmcq/2007/schema/exx/abc.m1a02.xml, line 12, char 16
  Message: Datatype error: Type:InvalidDatatypeValueException, 
  Message:Value '...b.c' does not match regular expression facet '.*a.*'.

Error at file /Users/cmsmcq/2007/schema/exx/abc.m1a02.xml, line 13, char 16
  Message: Datatype error: Type:InvalidDatatypeValueException, 
  Message:Value '...bCc' does not match regular expression facet '.*a.*'.

Error at file /Users/cmsmcq/2007/schema/exx/abc.m1a02.xml, line 14, char 16
  Message: Datatype error: Type:InvalidDatatypeValueException, 
  Message:Value '..Bb..' does not match regular expression facet '.*a.*'.

Error at file /Users/cmsmcq/2007/schema/exx/abc.m1a02.xml, line 15, char 16
  Message: Datatype error: Type:InvalidDatatypeValueException, 
  Message:Value '..Bb.c' does not match regular expression facet '.*a.*'.

Error at file /Users/cmsmcq/2007/schema/exx/abc.m1a02.xml, line 16, char 16
  Message: Datatype error: Type:InvalidDatatypeValueException, 
  Message:Value '..BbCc' does not match regular expression facet '.*a.*'.
$
]]></eg></p>
<p>One processor (processor B in the tables below in section
<ptr target="t0results" type="secnum"/>)
<!--* Xerces J *--> 
issues some error messages I do not understand, and then
validates the document with a schema which apparently has a definition
for element a and type a, but does not enforce either of the patterns.
<eg>$ ~/bin/runProcessorB abc.m1a02.xml
[Error] abc.m1a02.xsd:46:27: sch-props-correct.2: A schema cannot contain 
  two global components with the same name; this schema contains two
  occurrences of ',a'.
[Error] abc.m1a02.xsd:39:30: src-resolve: Cannot resolve the name 'a_fn3dktizrknc9pi' 
  to a(n) 'type definition' component.
[Error] abc.m1a02.xsd:39:30: cos-applicable-facets: Facet 'pattern' is not 
  allowed by type a.
abc.m1a02.xml: 3208 ms (82 elems, 1 attrs, 0 spaces, 742 chars)
$</eg>
The PSVI output shows the result quite clearly (XML form in
<xref>abc.m1a02.xml.psvi.out.xml</xref>, an HTML
display form in <xref>abc.m1a02.xml.psvi.out.html</xref>.</p>
<p>A third processor (processor E in the tables below in section
<ptr target="t0results" type="secnum"/>)
<!--* Saxon *-->
notices the cycle of redefinitions, but appears to try to deal
with it anyway:<note place="foot">As shown below, a later
recent version of processor E eliminates this looping behavior.
</note>
<eg>$ ~/bin/runProcessorE abc.m1a02.xml
Error at xsd:redefine on line 36 of file:/Users/cmsmcq/2007/schema/exx/abc.m1a02.xsd:
  The schema document file:/Users/cmsmcq/2007/schema/exx/abc.m1a02.xsd includes or redefines
  itself recursively
Error at xsd:redefine on line 36 of file:/Users/cmsmcq/2007/schema/exx/abc.m1a02.xsd:
  The schema document file:/Users/cmsmcq/2007/schema/exx/abc.m1a02.xsd includes or redefines
  itself recursively
Error at xsd:redefine on line 36 of file:/Users/cmsmcq/2007/schema/exx/abc.m1a02.xsd:
  The schema document file:/Users/cmsmcq/2007/schema/exx/abc.m1a02.xsd includes or redefines
  itself recursively
Error at xsd:redefine on line 36 of file:/Users/cmsmcq/2007/schema/exx/abc.m1a02.xsd:
  The schema document file:/Users/cmsmcq/2007/schema/exx/abc.m1a02.xsd includes or redefines
  itself recursively
Error at xsd:redefine on line 36 of file:/Users/cmsmcq/2007/schema/exx/abc.m1a02.xsd:
  The schema document file:/Users/cmsmcq/2007/schema/exx/abc.m1a02.xsd includes or redefines
  itself recursively
$</eg>
At the point shown, I interrupted the program.</p>
<p>A fourth processor (processor A in the tables below in section
<ptr target="t0results" type="secnum"/>)
<!--* The <ident>xmllint</ident> program, 
which provides a command-line interface to the
Gnome libxml library,  *-->
produces this output:<note place="foot">I have elided
some uninformative messages about the DTDs, or lack of them, in the test case.</note>
<!--* 
<eg>$ xmllint  - - version - - valid - - schema \\
    abc.m1a02.xsd abc.m1a02.xml \\
    > abc.m1a02.xml.xmllint.out.xml
xmllint: using libxml version 20616
   compiled with: DTDValid FTP HTTP HTML C14N Catalog XPath XPointer 
                  XInclude Iconv Unicode Regexps Automata Schemas 
*-->
<eg>$ runProcessorA abc.m1a02.xsd abc.m1a02.xml \\
    > abc.m1a02.xml.procA.out.xml
...
abc.m1a02.xml:8: element a: Schemas validity error : 
  Element 'a' [ST 'a', facet 'pattern']: 
  The value '......' is not accepted by the pattern '.*a.*'.
abc.m1a02.xml:9: element a: Schemas validity error : 
  Element 'a' [ST 'a', facet 'pattern']: 
  The value '.....c' is not accepted by the pattern '.*a.*'.
abc.m1a02.xml:10: element a: Schemas validity error : 
  Element 'a' [ST 'a', facet 'pattern']: 
  The value '....Cc' is not accepted by the pattern '.*a.*'.
abc.m1a02.xml:11: element a: Schemas validity error : 
  Element 'a' [ST 'a', facet 'pattern']: 
  The value '...b..' is not accepted by the pattern '.*a.*'.
abc.m1a02.xml:12: element a: Schemas validity error : 
  Element 'a' [ST 'a', facet 'pattern']: 
  The value '...b.c' is not accepted by the pattern '.*a.*'.
abc.m1a02.xml:13: element a: Schemas validity error : 
  Element 'a' [ST 'a', facet 'pattern']: 
  The value '...bCc' is not accepted by the pattern '.*a.*'.
abc.m1a02.xml:14: element a: Schemas validity error : 
  Element 'a' [ST 'a', facet 'pattern']: 
  The value '..Bb..' is not accepted by the pattern '.*a.*'.
abc.m1a02.xml:15: element a: Schemas validity error : 
  Element 'a' [ST 'a', facet 'pattern']: 
  The value '..Bb.c' is not accepted by the pattern '.*a.*'.
abc.m1a02.xml:16: element a: Schemas validity error : 
  Element 'a' [ST 'a', facet 'pattern']: 
  The value '..BbCc' is not accepted by the pattern '.*a.*'.
abc.m1a02.xml fails to validate
diumaget-3:~/2007/schema/exx cmsmcq$ </eg>
That is, processor A does the same as processor C:  it ignores the
self-redefinition.</p>
<p>A variation on the test, in which the <ident>xsd:redefine</ident> element is
empty, produced the same results as the original test, from each of 
the four processors.</p>
<p>This manual test seems to me to illustrate the utility of the model
instances produced by Alloy, for both the goals outlined at the
beginning of this paper.  First, Alloy provides assistance with sanity
checking a design: even the simplest instances of this simplest Alloy
model of schema composition turn out to illustrate situations for
which an ideal definition of schema composition must be prepared, but
for which (judging by the evidence), the XSDL 1.0 spec does not
provide a clear result. And tests constructed from these simple
instances provide useful empirical data on the interoperability of
existing XSDL 1.0 implementations.</p>
</div>
<div id="t0">
<head>Test set t0</head>
<p>Those colleagues who had volunteered to run some test cases asked
for a small set of tests to try out first, so that they could
make sure the structure of the test set and so on were clear.  This
section describes that test set, called <ident>t0</ident>.</p>
<div id="t0tests">
<head>Tests</head>
<p>Set t0 contains tests constructed by hand (which I had on hand
when it became clear we needed a start-to-finish complete small
set of tests very soon).  A formal description is on the Web
at <xref>./t0/t0.testSet</xref>, formulated in the XML
Schema Test Suite vocabulary for test catalogs, and the
tests themselves may be browsed at <xref>./t0</xref>.
</p>
<p>The test groups are:
<list>
<item><p>Test group PVB:  tests created on the basis of a problem
described by Paul V. Biron in private email.</p>
<p>There are three schema documents:<list>
<item><label>standard.xsd</label> defines type cc in namespace
<code>http://www.example.com/standard</code> (which I'll
just call <q>standard</q>).</item>
<item><label>extensions.xsd</label> imports the standard
namespace (specifying standard.xsd as the schema location)
and defines element e1 for an <q>extensions</q> namespace
(prefix <q>ext</q>).
</item>
<item><label>top.xsd</label> imports the extensions
namespace (specifying extensions.xsd as the schema location)
and redefines type standard:cc from standard.xsd.</item>
</list>
In the catalog, these are given in the order top, extensions,
standard.  (This turns out to matter.)</p>
<p>
When difficulties arise here, they arise because
standard.xsd is reached both via a redefinition element
in top.xsd and via an import element in extensions.xsd.
</p>
<p>There are three XML test documents, which differ only 
in the schemaLocation attribute on the root element:
one points at top.xsd for the standard namespace
and extensions.xsd for the extensions namespace, in
that order, one points at them in the opposite order,
and one points only at top.xsd.</p></item>

<item><p>Test group abc:  tests following the test 
construction pattern described above, with a call graph
isomorphic to that in test group pvb.  (These tests
were created when I had trouble figuring out what was
actually going on in the pvb documents; the idea
was that these tests would be easier to interpret.)</p>
<p>Again, there are three schema documents:<list>
<item><label>a.xsd</label> (for namespace ns1)
corresponds to standard.xsd.</item>
<item><label>b.xsd</label> corresponds to extensions.xsd:
it imports ns1 (via a.xsd).</item>
<item><label>c.xsd</label> corresponds to top.xsd:
it imports ns2 (via b.xsd) and redefines a component
in ns1 (from a.xsd).</item>
</list>
</p>
<p>There are four XML test documents, which differ only 
in the schemaLocation attribute on the root element:
one points at b.xsd, then c.xsd, one points at them in
the other order, one points only at c.xsd, and one
has no schemaLocation hint.</p>
<p>The schemaTest element in the test catalog
lists the schema documents in the order c, a, b
(so the top-level schema document is first).</p>
</item>
<item><p>Test group abc-2 is identical to group abc,
except that the catalog lists the schema documents in 
the order b, a, c.</p>
<p>When processors pre-load the schema documents listed
in the catalog, in order, then either there is no
order dependency in the processor (in which case they
should produce the same results for abc and for abc-2)
or there is (in which case the difference in results
for abc and abc-2 should trigger the order
dependency).</p>
<p>For those processors which accept only a single
schema document on the command line, or which
accept several but ignore all but one, the difference
in order turns into a difference in initial schema
document point.</p></item>
<item>Test group cycle-include includes a test translated by hand
from the  Alloy instance labeled <label>m1a02</label> above
(section <ptr target="toyresults" type="secnum"/>):
schema document a.xsd includes itself.</item>
<item>Test group cycle-redefine-1 includes another test translated by hand
from an Alloy instance: <label>m1a03</label> in 
the discussion of section <ptr target="toyresults" type="secnum"/>:
schema document a.xsd redefines the type <ident>a</ident> from
schema document a.xsd.</item>
<item>Test group cycle-redefine-2 is a variation on the preceding:
again, schema document a.xsd includes a <code>redefine</code>
element pointing to schema document a.xsd, but this time the
redefine element is empty (so that it's semantically very
similar to an include &mdash; it may be identical, but I haven't
checked the fine print of the spec on that question).</item>
</list>
</p>
</div>
<div id="t0results">
<head>Test results</head>
<p>The tests of t0 have been run on several processors,
sometimes in different configurations.</p>

<p>The procesors for which we have data so far are anonymized here as
A, B, C, etc., at least until further research shows the license
agreements do not forbid dissemination of test results.  When the same
processor has been tested with multiple configurations, the same
processor letter is used and configurations are distinguished by
numbers:  A1, A2, A3, etc. are all the same executable, invoked with
different options and/or paramters.</p>

<p>Several processors allow schema documents to be supplied on the
command line.  In some cases, it's clear that all such schema
documents are pre-loaded before the document is validated; in others,
it appears that only one is pre-loaded.  In no case does the
documentation say what happens when multiple schema documents are
specified, or mention any sequence dependencies. Since order
dependencies are clearly important for some tests in t0, those
processors have been tested in several configurations:<list>
<item><label>all</label>:  all schema document names given for the
test group in the catalog are passed to the processor, in
order.</item>
<item><label>reverse</label>:  all schema document names given for the
test group in the catalog are passed to the processor, in
reverse order.</item>
<item><label>first</label>:  only the first schema document named
in the catalog is passed to the processor.</item>
<item><label>last</label>:  only the last schema document named
in the catalog is passed to the processor.</item>
<item><label>none</label>:  no schema document named
in the catalog is passed to the processor at invocation time;
the only information available to the processor is the
schema location hints in the test instance.</item>
</list>
</p>
<p>For example processor D can be invoked with zero or more
schema documents given on the command line.  It is represented
below by six rows in each table. Those labeled D1 through D5,
which represent different invocation patterns; D6 is a newer
version of the processor.  For test group
abc, where the test catalog (<xref>t0/t0.testSet</xref>)
lists the schema documents in the order 
<ident>c.xsd</ident>,
<ident>a.xsd</ident>,
<ident>b.xsd</ident>,
the codes mean:
<list>
<item><label>D1 (all)</label>:  invocation pattern
<q><code>$PROCESSORNAME $INSTANCENAME abc/c.xsd abc/a.xsd abc/b.xsd</code></q></item>
<item><label>D2 (first)</label>:  invocation pattern
<q><code>$PROCESSORNAME $INSTANCENAME abc/c.xsd</code></q></item>
<item><label>D3 (reverse)</label>:  invocation pattern
<q><code>$PROCESSORNAME $INSTANCENAME abc/b.xsd abc/a.xsd abc/c.xsd</code></q></item>
<item><label>D4 (last)</label>:  invocation pattern
<q><code>$PROCESSORNAME $INSTANCENAME abc/b.xsd</code></q></item>
<item><label>D5 (none)</label>:  invocation pattern
<q><code>$PROCESSORNAME $INSTANCENAME</code></q></item>
<item><label>D6 (all)</label>:  invocation pattern
<q><code>$PROCESSORNAME $INSTANCENAME abc/c.xsd abc/a.xsd abc/b.xsd</code></q></item>
</list>
Processor F does not accept multiple schema documents on its command line,
so it has been tested only with the <q>first</q> and <q>last</q>
configuration options.
</p>
<p>
In some cases, processors have other invocation options which
have been tested separately.</p>
<p>For example, processor B is a library which ships with several
sample applications.  Shells scripts B1, B2, B3, and B4 were
constructed to invoke different sample applications, to see
whether the choice of sample application made any difference
to validation behavior.  (As may be seen, B1 through B3 all
yield essentially the same validation results: although their error output
differs, the diferences reflect configuration issues unrelated
to schema validity assessment.  B4, on the other hand, provides
different results, because its sample application is written with
a different schema construction policy in mind.)  B1, B2, and B3
all follow the same invocation pattern (all the schema documents
listed in the catalog are passed on the command line); it is 
not yet know whether variations in the order of document names
on the command line matters.  (Configurations B6 through B9
will be constructed at some point to investigate this question.)
</p>
<p>Processor G has been tested in two versions:  G1-5 are 
different invocation patterns for the earlier version, G6-G10
for the later version.</p>

<div id="pvbresults">
<head>PVB group</head>
<p>The results so far for test group pvb are summarized in this table.
Note that
<list>
<item>The root element of each test document is ext:e1.</item>
<item>In extensions.xsd, the declaration of ext:e1 refers to
type standard:cc..</item>
<item>The catalog lists the schema documents in the order
top, extensions, standard.</item>
</list>
(In some forms of this paper, background colors have been
supplied for the cells of the table.  Similar results should
have similar background colors, but the colors themselves
are arbitrary and have no significance; sometimes the same
color is used in different tables for different results.)
<table>
<row role="label">
<cell cols="4">Test group pvb</cell>
</row>
<row>
<!--* <cell rows="2">&#160;</cell> *-->
<cell cols="2">Schema documents:<list>
<item><xref>t0/pvb/top.xsd</xref></item>
<item><xref>t0/pvb/extensions.xsd</xref></item>
<item><xref>t0/pvb/standard.xsd</xref></item>
</list></cell>
<cell cols="2"><figure rend="60%" entity="pvb"></figure></cell>
</row>
<row role="label">
<cell rows="2">Product</cell>
<cell>Test pvb / point-ext.top</cell>
<cell>Test pvb / point-top.ext</cell>
<cell>Test pvb / point-top</cell>
</row>
<row>
<!--* <cell rows="2">&#160;</cell> *-->
<cell><xref>t0/pvb/pt.ext.top.xml</xref></cell>
<cell><xref>t0/pvb/pt.top.ext.xml</xref></cell>
<cell><xref>t0/pvb/pt.top.xml</xref></cell>
</row>
<row><!--* tslx1 *-->
<cell role="label">A1 (all)</cell>
<cell rend="nf">No declaration found for ext:e1.</cell>
<cell rend="nf">No declaration found for ext:e1.</cell>
<cell rend="nf">No declaration found for ext:e1.</cell>
</row>
<row><!--* tslx2 *-->
<cell role="label">A2 (first)</cell>
<cell rend="err">Schema error in extensions.xsd: type standard:cc not found</cell>
<cell rend="err">Schema error in extensions.xsd: type standard:cc not found</cell>
<cell rend="err">Schema error in extensions.xsd: type standard:cc not found</cell>
</row>
<row><!--* tslx3 *-->
<cell role="label">A3 (reverse)</cell>
<cell rend="err">Schema error in extensions.xsd: type standard:cc not found</cell>
<cell rend="err">Schema error in extensions.xsd: type standard:cc not found</cell>
<cell rend="err">Schema error in extensions.xsd: type standard:cc not found</cell>
</row>
<row><!--* tslx4 *-->
<cell role="label">A4 (last)</cell>
<cell rend="nf">No declaration found for ext:e1.</cell>
<cell rend="nf">No declaration found for ext:e1.</cell>
<cell rend="nf">No declaration found for ext:e1.</cell>
</row>

&spacer4;

<row><!--* tslxj1 *-->
<cell role="label">B1 (all)</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
</row>
<row><!--* tslxj2 *-->
<cell role="label">B2 (all)</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
</row>
<row><!--* tslxj3 *-->
<cell role="label">B3 (all)</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
</row>
<row><!--* tslxj4 *-->
<cell role="label">B4 (none)</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
<cell rend="nf">No declaration found for ext:e1</cell>
</row>

&spacer4;

<row><!--* tslxc1 *-->
<cell role="label">C1 (none)</cell>
<cell rend="invalid">Invalid: e1 not allowed<note place="foot">The error message does
not mention the namespace, but it appears that the element objected
to is ext:e1, not standard:e1, and that the place it's objected
to is inside type standard:cc, where it was added by top.xsd's
redefinition of that type.</note></cell>
<cell rend="err">Error in extensions.xsd: type standard:cc not found.</cell>
<cell rend="err">Error in extensions.xsd: type standard:cc not found.</cell>
</row>

&spacer4;

<row><!--* tssx1 *-->
<cell role="label">D1 (all)</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
</row>
<row><!--* tssx1 *-->
<cell role="label">D2 (first)</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
</row>
<row><!--* tssx1 *-->
<cell role="label">D3 (reverse)</cell>
<cell rend="invalid">Invalid:  ext:e1 not allowed here (i.e. at end of
type standard:cc).</cell>
<cell rend="invalid">Invalid:  ext:e1 not allowed here (i.e. at end of
type standard:cc).</cell>
<cell rend="invalid">Invalid:  ext:e1 not allowed here (i.e. at end of
type standard:cc).</cell>
</row>
<row><!--* tssx1 *-->
<cell role="label">D4 (last)</cell>
<cell rend="invalid">Invalid:  ext:e1 not allowed here (i.e. at end of
type standard:cc).</cell>
<cell rend="invalid">Invalid:  ext:e1 not allowed here (i.e. at end of
type standard:cc).</cell>
<cell rend="invalid">Invalid:  ext:e1 not allowed here (i.e. at end of
type standard:cc).</cell>
</row>
<row><!--* tssx1 *-->
<cell role="label">D5 (none)</cell>
<cell rend="invalid">Invalid:  ext:e1 not allowed here (i.e. at end of
type standard:cc).</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
</row>
<row><!--* tssx (external) *-->
<cell role="label">D6 (all)</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
</row>

&spacer4;

<row><!--* tsxsv1..5 *-->
<cell role="label">E1 (all)</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
</row>
<row><!--* tsxsv1..5 *-->
<cell role="label">E2 (first)</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
</row>
<row><!--* tsxsv1..5 *-->
<cell role="label">E3 (reverse)</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
</row>
<row><!--* tsxsv1..5 *-->
<cell role="label">E4 (last)</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
</row>
<row><!--* tsxsv1..5 *-->
<cell role="label">E5 (none)</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
</row>

&spacer4;

<row><!--* tsmsv1 *-->
<cell role="label">F1 (first)</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
</row>
<row><!--* tsmsv1 *-->
<cell role="label">F2 (last)</cell>
<cell rend="invalid">Invalid:  outer ext:e1 in error (probably should
be standard:e1)</cell>
<cell rend="invalid">Invalid:  outer ext:e1 in error (probably should
be standard:e1)</cell>
<cell rend="invalid">Invalid:  outer ext:e1 in error (probably should
be standard:e1)</cell>
</row>

&spacer4;

<row><!--* msxml1..5 *-->
<cell role="label">G1 (all)</cell>
<cell rend="err">Error in top.xsd: no ext:cc (sic) exists to be redefined</cell>
<cell rend="err">Error in top.xsd: no ext:cc (sic) exists to be redefined</cell>
<cell rend="err">Error in top.xsd: no ext:cc (sic) exists to be redefined</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G2 (first)</cell>
<cell rend="err">Error in top.xsd: no ext:cc (sic) exists to be redefined</cell>
<cell rend="err">Error in top.xsd: no ext:cc (sic) exists to be redefined</cell>
<cell rend="err">Error in top.xsd: no ext:cc (sic) exists to be redefined</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G3 (reverse)</cell>
<cell rend="err">Error in standard.xsd: duplicate standard:cc</cell>
<cell rend="err">Error in standard.xsd: duplicate standard:cc</cell>
<cell rend="err">Error in standard.xsd: duplicate standard:cc</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G4 (last)</cell>
<cell rend="invalid">root element had no schema</cell>
<cell rend="invalid">element content invalid</cell>
<cell rend="invalid">element content invalid</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G5 (none)</cell>
<cell rend="invalid">std:e1 used by not declared in schema</cell>
<cell rend="invalid">element content invalid</cell>
<cell rend="invalid">element content invalid</cell>
</row>

<row><!--* msxml1..5 *-->
<cell role="label">G6 (all)</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G7 (first)</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G8 (reverse)</cell>
<cell rend="err">Error in top.xsd: schema component already present cannot be redefined (cc)</cell>
<cell rend="err">Error in top.xsd: schema component already present cannot be redefined (cc)</cell>
<cell rend="err">Error in top.xsd: schema component already present cannot be redefined (cc)</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G9 (last)</cell>
<cell rend="err">Error: schema component already present cannot be redefined (cc)</cell>
<cell rend="err">Error: schema component already present cannot be redefined (cc)</cell>
<cell rend="err">Error: schema component already present cannot be redefined (cc)</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G10 (none)</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
<cell rend="ok">no errors</cell>
</row>
</table>
</p>
<p>For each test, five different behaviors are exhibited.</p>
</div>
<div id="abcresults">
<head>Groups abc and abc-2</head>
<p>The results so far for test groups abc and abc-2 are these.
Some of the notations may need glosses:
<list>
<item><label>-,b,c</label>: the error message shows that the 
basic pattern facets for types b and c are enforced; 
there are no error messages relating to type a.</item>
<item><label>aC,b,c</label>: the error message shows that the 
basic pattern facets for types a, b, and c are enforced; 
additionally, type a has been redefined by schema document
C, and the added facet (pattern <q><code>.*C.*</code></q>) is
enforced.</item>
<item><label>aC*,b,c</label>: the error message shows that the 
basic pattern facets for types a, b, and c are enforced;
additionally, type a has been redefined by schema document
C, and the added facet (pattern <q><code>.*C.*</code></q> is
enforced.  However, some facets appear either to be enforced
irregularly:  they produce fewer error messages than expected.
Specifically: 
<q><code>.*a.*</code></q> (one error message not nine),
<q><code>.*C.*</code></q> (five error messages not nine or twelve),
<q><code>.*b.*</code></q> (three error message not nine).
(The pattern <q><code>.*c.*</code></q> does produce
nine error messages.)</item>
<item><label>a,b,-</label>: the error message shows that the 
basic pattern facets for types a and b are enforced; 
no error messages reflect the pattern facet for type c.
</item>
</list>
<table>
<row role="label">
<cell cols="5">Test group abc</cell>
</row>
<row>
<!--* <cell rows="2">&#160;</cell> *-->
<cell cols="2">Schema documents:<list>
<item><xref>t0/abc/c.xsd</xref></item>
<item><xref>t0/abc/a.xsd</xref></item>
<item><xref>t0/abc/b.xsd</xref></item>
</list></cell>
<cell cols="3"><figure rend="60%" entity="abc"/></cell>
</row>
<row role="label">
<cell rows="2">Processor</cell>
<cell>Test abc / point-c-only</cell>
<cell>Test abc / point-cb</cell>
<cell>Test abc / point-bc</cell>
<cell>Test abc / point-none</cell>
</row>
<row>
<!--* <cell rows="2">Processor</cell> *-->
<cell><xref>t0/abc/abc1.xml</xref></cell>
<cell><xref>t0/abc/abc2.xml</xref></cell>
<cell><xref>t0/abc/abc3.xml</xref></cell>
<cell><xref>t0/abc/abc4.xml</xref></cell>
</row>
<row><!--* tslx1 *-->
<cell role="label">A1 (all)</cell>
<cell rend="nf">No declaration found for ns1:wrapper.</cell>
<cell rend="nf">No declaration found for ns1:wrapper.</cell>
<cell rend="nf">No declaration found for ns1:wrapper.</cell>
<cell rend="nf">No declaration found for ns1:wrapper.</cell>
</row>
<row><!--* tslx2 *-->
<cell role="label">A2 (first)</cell>
<cell rend="bc">-,b,c</cell>
<cell rend="bc">-,b,c</cell>
<cell rend="bc">-,b,c</cell>
<cell rend="bc">-,b,c</cell>
</row>
<row><!--* tslx3 *-->
<cell role="label">A3 (reverse)</cell>
<cell rend="bc">-,b,c</cell>
<cell rend="bc">-,b,c</cell>
<cell rend="bc">-,b,c</cell>
<cell rend="bc">-,b,c</cell>
</row>
<row><!--* tslx4 *-->
<cell role="label">A4 (last)</cell>
<cell rend="nf">No declaration found for ns1:wrapper.</cell>
<cell rend="nf">No declaration found for ns1:wrapper.</cell>
<cell rend="nf">No declaration found for ns1:wrapper.</cell>
<cell rend="nf">No declaration found for ns1:wrapper.</cell>
</row>

&spacer5;

<row><!--* tslxj1 *-->
<cell role="label">B1 (all)</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell>
</row>
<row><!--* tslxj2 *-->
<cell role="label">B2 (all)</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell>
</row>
<row><!--* tslxj3 *-->
<cell role="label">B3 (all)</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell></row>
<row><!--* tslxj4 *-->
<cell role="label">B4 (none)</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="nf">No declaration found for ns1:wrapper</cell>
</row>

&spacer5;

<row><!--* tslxc1 *-->
<cell role="label">C1 (none)</cell><cell rend="ab">a,b,-</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="nf">No declaration found for
ns1:wrapper, ns1:a, ns2:b, ns1:c</cell>
</row>

&spacer5;

<row><!--* tssx1 *-->
<cell role="label">D1 (all)</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell>
</row>
<row><!--* tssx1 *-->
<cell role="label">D2 (first)</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell>
</row>
<row><!--* tssx1 *-->
<cell role="label">D3 (reverse)</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
</row>
<row><!--* tssx1 *-->
<cell role="label">D4 (last)</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
</row>
<row><!--* tssx1 *-->
<cell role="label">D5 (none)</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
<cell rend="aCbc">aC,b,c</cell>
<cell rend="aCbc">aC,b,c</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
</row>
<row><!--* tssx1 *-->
<cell role="label">D6 (all)</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell>
</row>

&spacer5;

<row><!--* tsxsv1 *-->
<cell role="label">E1 (all)</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell>
</row>
<row><!--* tsxsv1 *-->
<cell role="label">E2 (first)</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell>
</row>
<row><!--* tsxsv1 *-->
<cell role="label">E3 (reverse)</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell>
</row>
<row><!--* tsxsv1 *-->
<cell role="label">E4 (last)</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="ab">a,b,-</cell>
</row>
<row><!--* tsxsv1 *-->
<cell role="label">E5 (none)</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="ok">no errors (lax validation)</cell>
</row>

&spacer5;

<row><!--* tsmsv1 *-->
<cell role="label">F1 (first)</cell>
<cell rend="aCbc">aC*,b,c</cell>
<cell rend="aCbc">aC*,b,c</cell>
<cell rend="aCbc">aC*,b,c</cell>
<cell rend="aCbc">aC*,b,c</cell>
</row>
<row><!--* tsmsv1 *-->
<cell role="label">F2 (last)</cell>
<cell rend="invalid">Invalid: ns1:wrapper not allowed.</cell>
<cell rend="invalid">Invalid: ns1:wrapper not allowed.</cell>
<cell rend="invalid">Invalid: ns1:wrapper not allowed.</cell>
<cell rend="invalid">Invalid: ns1:wrapper not allowed.</cell>
</row>

&spacer5; 


<row><!--* msxml1..5 *-->
<cell role="label">G1 (all)</cell>
<cell rend="err">Error in c.xsd: no ns2:a (sic) exists to be redefined</cell>
<cell rend="err">Error in c.xsd: no ns2:a (sic) exists to be redefined</cell>
<cell rend="err">Error in c.xsd: no ns2:a (sic) exists to be redefined</cell>
<cell rend="err">Error in c.xsd: no ns2:a (sic) exists to be redefined</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G2 (first)</cell>
<cell rend="err">Error in c.xsd: no ns2:a (sic) exists to be redefined</cell>
<cell rend="err">Error in c.xsd: no ns2:a (sic) exists to be redefined</cell>
<cell rend="err">Error in c.xsd: no ns2:a (sic) exists to be redefined</cell>
<cell rend="err">Error in c.xsd: no ns2:a (sic) exists to be redefined</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G3 (reverse)</cell>
<cell rend="err">Error in a.xsd: duplicate ns1:a</cell>
<cell rend="err">Error in a.xsd: duplicate ns1:a</cell>
<cell rend="err">Error in a.xsd: duplicate ns1:a</cell>
<cell rend="err">Error in a.xsd: duplicate ns1:a</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G4 (last)</cell>
<cell rend="ab">a,b,-</cell>
<cell rend="ab">a,b,-</cell>
<cell rend="ab">a,b,-</cell>
<cell rend="ab">a,b,-</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G5 (none)</cell>
<cell rend="nf">ns1:a not declared, ns2:b has no schema, ns1:c not declared</cell>
<cell rend="ab">a,b,-</cell>
<cell rend="ab">a,b,-</cell>
<cell rend="nf">ns1:a not declared, ns2:b has no schema, ns1:c not declared</cell>
</row>

<row><!--* msxml1..5 *-->
<cell role="label">G6 (all)</cell>
<cell rend="aCbc">aC,b,c</cell>
<cell rend="aCbc">aC,b,c</cell>
<cell rend="aCbc">aC,b,c</cell>
<cell rend="aCbc">aC,b,c</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G7 (first)</cell>
<cell rend="aCbc">aC,b,c</cell>
<cell rend="aCbc">aC,b,c</cell>
<cell rend="aCbc">aC,b,c</cell>
<cell rend="aCbc">aC,b,c</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G8 (reverse)</cell>
<cell rend="err">Error in c.xsd:  schema component already present cannot be redefined (a)</cell>
<cell rend="err">Error in c.xsd:  schema component already present cannot be redefined (a)</cell>
<cell rend="err">Error in c.xsd:  schema component already present cannot be redefined (a)</cell>
<cell rend="err">Error in c.xsd:  schema component already present cannot be redefined (a)</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G9 (last)</cell>
<cell rend="err">Error in c.xsd:  schema component already present cannot be redefined (a)</cell>
<cell rend="err">Error in c.xsd:  schema component already present cannot be redefined (a)</cell>
<cell rend="err">Error in c.xsd:  schema component already present cannot be redefined (a)</cell>
<cell rend="ab">a,b,-</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G10 (none)</cell>
<cell rend="aCbc">aC,b,c</cell>
<cell rend="aCbc">aC,b,c</cell>
<cell rend="aCbc">aC,b,c</cell>
<cell rend="nf">neither valid nor invalid: no declaration found</cell>
</row>

&spacer5; 

<row><!--* ml *-->
<cell role="label">H1 (all)</cell>
<cell rend="b">-,b,-</cell>
<cell rend="b">-,b,-</cell>
<cell rend="b">-,b,-</cell>
<cell rend="b">-,b,-</cell>
</row>
</table>
</p>

<p>We don't currently have reliable results for these tests run on processor G.</p>

<p>The results for group abc-2 are similar in some ways.

<table>
<row role="label">
<cell cols="5">Test group abc-2</cell>
</row>
<row>
<!--* <cell rows="2">&#160;</cell> *-->
<cell cols="2">Schema documents:<list>
<item><xref>t0/abc/b.xsd</xref></item>
<item><xref>t0/abc/a.xsd</xref></item>
<item><xref>t0/abc/c.xsd</xref></item>
</list></cell>
<cell cols="3"><figure rend="60%" entity="abc"/></cell>
</row>
<row role="label">
<cell>Processor</cell>
<cell>Test abc-2 / point-c-only (<xref>t0/abc/abc1.xml</xref>)</cell>
<cell>Test abc-2 / point-cb (<xref>t0/abc/abc2.xml</xref>)</cell>
<cell>Test abc-2 / point-bc (<xref>t0/abc/abc3.xml</xref>)</cell>
<cell>Test abc-2 / point-none (<xref>t0/abc/abc4.xml</xref>)</cell>
</row>
<row><!--* tslx1 *-->
<cell role="label">A1 (all)</cell><cell rend="bc">-,b,c</cell><cell rend="bc">-,b,c</cell><cell rend="bc">-,b,c</cell><cell rend="bc">-,b,c</cell>
</row>
<row><!--* tslx2 *-->
<cell role="label">A2 (first)</cell>
<cell rend="nf">No declaration found for ns1:wrapper.</cell>
<cell rend="nf">No declaration found for ns1:wrapper.</cell>
<cell rend="nf">No declaration found for ns1:wrapper.</cell>
<cell rend="nf">No declaration found for ns1:wrapper.</cell>
</row>
<row><!--* tslx3 *-->
<cell role="label">A3 (reverse)</cell>
<cell rend="nf">No declaration found for ns1:wrapper.</cell>
<cell rend="nf">No declaration found for ns1:wrapper.</cell>
<cell rend="nf">No declaration found for ns1:wrapper.</cell>
<cell rend="nf">No declaration found for ns1:wrapper.</cell>
</row>
<row><!--* tslx4 *-->
<cell role="label">A4 (last)</cell>
<cell rend="bc">-,b,c</cell>
<cell rend="bc">-,b,c</cell>
<cell rend="bc">-,b,c</cell>
<cell rend="bc">-,b,c</cell>
</row>

&spacer5;

<row><!--* tslxj1 *-->
<cell role="label">B1 (all)</cell><cell rend="ab">a,b,-</cell><cell rend="ab">a,b,-</cell><cell rend="ab">a,b,-</cell><cell rend="ab">a,b,-</cell>
</row>
<row><!--* tslxj2 *-->
<cell role="label">B2 (all)</cell><cell rend="ab">a,b,-</cell><cell rend="ab">a,b,-</cell><cell rend="ab">a,b,-</cell><cell rend="ab">a,b,-</cell>
</row>
<row><!--* tslxj3 *-->
<cell role="label">B3 (all)</cell><cell rend="ab">a,b,-</cell><cell rend="ab">a,b,-</cell><cell rend="ab">a,b,-</cell><cell rend="ab">a,b,-</cell></row>
<row><!--* tslxj4 *-->
<cell role="label">B4 (none)</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="nf">No declaration found for ns1:wrapper</cell>
</row>

&spacer5;

<row><!--* tslxc1 *-->
<cell role="label">C1 (none)</cell><cell rend="ab">a,b,-</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="nf">No declaration found for
ns1:wrapper, ns1:a, ns2:b, ns1:c</cell>
</row>

&spacer5;

<row><!--* tssx1 *-->
<cell role="label">D1 (all)</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
</row>
<row><!--* tssx1 *-->
<cell role="label">D2 (first)</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
</row>
<row><!--* tssx1 *-->
<cell role="label">D3 (reverse)</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell>
</row>
<row><!--* tssx1 *-->
<cell role="label">D4 (last)</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell>
</row>
<row><!--* tssx1 *-->
<cell role="label">D5 (none)</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
<cell rend="aCbc">aC,b,c</cell>
<cell rend="aCbc">aC,b,c</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
</row>
<row><!--* tssx1 *-->
<cell role="label">D6 (all)</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
<cell rend="nf">No declaration found for ns1:wrapper</cell>
</row>

&spacer5;

<row><!--* tsxsv1 *-->
<cell role="label">E1 (all)</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell>
</row>
<row><!--* tsxsv1 *-->
<cell role="label">E2 (first)</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="ab">a,b,-</cell>
</row>
<row><!--* tsxsv1 *-->
<cell role="label">E3 (reverse)</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell>
</row>
<row><!--* tsxsv1 *-->
<cell role="label">E4 (last)</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell>
</row>
<row><!--* tsxsv1 *-->
<cell role="label">E5 (none)</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="aCbc">aC,b,c</cell><cell rend="ok">no errors (lax validation)</cell>
</row>


&spacer5;

<row><!--* tsmsv1 *-->
<cell role="label">F1 (first)</cell>
<cell rend="invalid">Invalid: ns1:wrapper not allowed.</cell>
<cell rend="invalid">Invalid: ns1:wrapper not allowed.</cell>
<cell rend="invalid">Invalid: ns1:wrapper not allowed.</cell>
<cell rend="invalid">Invalid: ns1:wrapper not allowed.</cell>
</row>
<row><!--* tsmsv1 *-->
<cell role="label">F2 (last)</cell>
<cell rend="aCbc">aC*,b,c</cell>
<cell rend="aCbc">aC*,b,c</cell>
<cell rend="aCbc">aC*,b,c</cell>
<cell rend="aCbc">aC*,b,c</cell>
</row>

&spacer5; 

<row><!--* msxml1..5 *-->
<cell role="label">G1 (all)</cell>
<cell rend="err">Error in a.xsd: duplicate ns1:a</cell>
<cell rend="err">Error in a.xsd: duplicate ns1:a</cell>
<cell rend="err">Error in a.xsd: duplicate ns1:a</cell>
<cell rend="err">Error in a.xsd: duplicate ns1:a</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G2 (first)</cell>
<cell rend="ab">a,b,-</cell>
<cell rend="ab">a,b,-</cell>
<cell rend="ab">a,b,-</cell>
<cell rend="ab">a,b,-</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G3 (reverse)</cell>
<cell rend="err">Error in c.xsd: no ns2:a (sic) exists to be redefined</cell>
<cell rend="err">Error in c.xsd: no ns2:a (sic) exists to be redefined</cell>
<cell rend="err">Error in c.xsd: no ns2:a (sic) exists to be redefined</cell>
<cell rend="err">Error in c.xsd: no ns2:a (sic) exists to be redefined</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G4 (last)</cell>
<cell rend="err">Error in c.xsd: no ns2:a (sic) exists to be redefined</cell>
<cell rend="err">Error in c.xsd: no ns2:a (sic) exists to be redefined</cell>
<cell rend="err">Error in c.xsd: no ns2:a (sic) exists to be redefined</cell>
<cell rend="err">Error in c.xsd: no ns2:a (sic) exists to be redefined</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G5 (none)</cell>
<cell rend="nf">ns1:a not declared, ns2:b has no schema, ns1:c not declared</cell>
<cell rend="ab">a,b,-</cell>
<cell rend="ab">a,b,-</cell>
<cell rend="nf">ns1:a not declared, ns2:b has no schema, ns1:c not declared</cell>
</row>

<row><!--* msxml1..5 *-->
<cell role="label">G6 (all)</cell>
<cell rend="err">Error in c.xsd:  schema component already present cannot be redefined (a)</cell>
<cell rend="err">Error in c.xsd:  schema component already present cannot be redefined (a)</cell>
<cell rend="err">Error in c.xsd:  schema component already present cannot be redefined (a)</cell>
<cell rend="err">Error in c.xsd:  schema component already present cannot be redefined (a)</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G7 (first)</cell>
<cell rend="err">Error in c.xsd:  schema component already present cannot be redefined (a)</cell>
<cell rend="err">Error in c.xsd:  schema component already present cannot be redefined (a)</cell>
<cell rend="err">Error in c.xsd:  schema component already present cannot be redefined (a)</cell>
<cell rend="ab">a,b,-</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G8 (reverse)</cell>
<cell rend="aCbc">aC,b,c</cell>
<cell rend="aCbc">aC,b,c</cell>
<cell rend="aCbc">aC,b,c</cell>
<cell rend="aCbc">aC,b,c</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G9 (last)</cell>
<cell rend="aCbc">aC,b,c</cell>
<cell rend="aCbc">aC,b,c</cell>
<cell rend="aCbc">aC,b,c</cell>
<cell rend="aCbc">aC,b,c</cell>
</row>
<row><!--* msxml1..5 *-->
<cell role="label">G10 (none)</cell>
<cell rend="aCbc">aC,b,c</cell>
<cell rend="aCbc">aC,b,c</cell>
<cell rend="aCbc">aC,b,c</cell>
<cell rend="nf">neither valid nor invalid: no declaration found</cell>
</row>

&spacer5; 

<row><!--* ml *-->
<cell role="label">H1 (all)</cell>
<cell rend="b">-,b,-</cell>
<cell rend="b">-,b,-</cell>
<cell rend="b">-,b,-</cell>
<cell rend="b">-,b,-</cell>
</row>
</table>
For each test, there again appear to be several different behaviors.</p>
</div>
<div id="cycleresults">
<head>Cyclic include and redefine groups</head>
<p>The final three test groups are the cyclic inclusion and the two cyclic redefinitions.
The results use the following code:<list>
<item><label>a,-</label> For elements of type a, the facet <q><code>.*a.*</code></q> is
enforced, but not the facet <q><code>.*A.*</code></q>.</item>
<item><label>a,A</label> For elements of type a, both the facet <q><code>.*a.*</code></q> 
and the facet <q><code>.*A.*</code></q> are enforced.</item>
<item><label>loop</label> The processor repeatedly issued the same error message,
until the job was terminated.</item>
<item><label>dup</label> The processor issued an error message complaining that
the schema contained multiple.</item>
</list>
<table>
<row role="label">
<cell rows="4">Processor</cell>
<cell>Test cycle-include</cell>
<cell>Test cycle-redefine-1</cell>
<cell>Test cycle-redefine-2</cell>
</row>
<row>
<!--* <cell rows="3">Processor</cell> *-->
<cell>Schema: <xref>t0/ci/a.xsd</xref></cell>
<cell>Schema: <xref>t0/cr1/a.xsd</xref></cell>
<cell>Schema: <xref>t0/cr2/a.xsd</xref></cell>
</row>
<row>
<!--* <cell rows="3">Processor</cell> *-->
<cell>Instance: <xref>t0/ci/abc.xml</xref></cell>
<cell>Instance: <xref>t0/cr1/abc.xml</xref></cell>
<cell>Instance: <xref>t0/cr2/abc.xml</xref></cell>
</row>
<row>
<!--* <cell rows="3">Processor</cell> *-->
<cell><figure rend="90%" entity="m1a03"/></cell>
<cell><figure rend="90%" entity="m1a02"/></cell>
<cell><figure rend="90%" entity="m1a02"/></cell>
</row>
<row><!--* tslx1 *-->
<cell role="label">A1 (all)</cell><cell rend="loop">loop</cell><cell rend="a">a,-</cell><cell rend="a">a,-</cell>
</row>
<!--* <row> tslx2 
<cell role="label">A2 (first)</cell><cell rend="loop">loop</cell><cell rend="a">a,-</cell><cell rend="a">a,-</cell>
</row>
<row> < ! - - * tslx3 * - - >
<cell role="label">A3 (reverse)</cell><cell rend="loop">loop</cell><cell rend="a">a,-</cell><cell rend="a">a,-</cell>
</row>
<row>< ! - - * tslx4 * - - >
<cell role="label">A4 (last)</cell><cell rend="loop">loop</cell><cell rend="a">a,-</cell><cell rend="a">a,-</cell>
</row>*-->

&spacer4;

<row><!--* tslxj1 *-->
<cell role="label">B1 (all)</cell><cell rend="err">dups</cell><cell rend="err">dups</cell><cell rend="a">a,-</cell>
</row>
<!--*
<row>
<cell role="label">B2 (all)</cell><cell rend="err">dups</cell><cell rend="err">dups</cell><cell rend="a">a,-</cell>
</row>
<row>
<cell role="label">B3 (all)</cell><cell rend="err">dups</cell><cell rend="err">dups</cell><cell rend="a">a,-</cell>
</row> *-->
<row>
<cell role="label">B4 (none)</cell><cell rend="a">a,-</cell><cell rend="err">dups</cell><cell rend="a">a,-</cell>
</row>

&spacer4;

<row><!--* tslxc1 *-->
<cell role="label">C1 (none)</cell><cell rend="a">a,-</cell><cell rend="a">a,-</cell><cell rend="a">a,-</cell>
</row>

&spacer4;

<row><!--* tssx1 *-->
<cell role="label">D1 (all)</cell><cell rend="a">a,-</cell><cell rend="loop">loop</cell><cell rend="loop">loop</cell>
</row>
<!--* <row>
<cell role="label">D2 (first)</cell><cell rend="a">a,-</cell><cell rend="loop">loop</cell><cell rend="loop">loop</cell>
</row>
<row>
<cell role="label">D3 (reverse)</cell><cell rend="a">a,-</cell><cell rend="loop">loop</cell><cell rend="loop">loop</cell>
</row>
<row>
<cell role="label">D4 (last)</cell><cell rend="a">a,-</cell><cell rend="loop">loop</cell><cell rend="loop">loop</cell>
</row>
<row>
<cell role="label">D5 (none)</cell><cell rend="a">a,-</cell><cell rend="loop">loop</cell><cell rend="loop">loop</cell>
</row> *-->
<row><!--* tssx1 *-->
<cell role="label">D6 (all)</cell><cell rend="a">a,-</cell><cell rend="err">no schema<note place="foot">The processor notes the recursion and reports
<q>Warning: No schema could be loaded at location a.xsd.
Warning: Validation will continue without the schema at a.xsd.
</q>
The validation of the instance then proceeds in strict wildcard mode
and no declaration for the wrapper element is found.  This
is true for both cr1 and cr2.</note></cell><cell rend="err">no schema</cell>
</row>

&spacer4;

<row><!--* tsxsv1 *-->
<cell role="label">E1 (all)</cell><cell rend="a">a,-</cell><cell rend="undeftype">undefined type</cell><cell rend="a">a,-</cell>
</row>
<!--* <row>
<cell role="label">E2 (first)</cell><cell rend="a">a,-</cell><cell rend="undeftype">undefined type</cell><cell rend="a">a,-</cell>
</row>
<row>
<cell role="label">E3 (reverse)</cell><cell rend="a">a,-</cell><cell rend="undeftype">undefined type</cell><cell rend="a">a,-</cell>
</row>
<row>
<cell role="label">E4 (last)</cell><cell rend="a">a,-</cell><cell rend="undeftype">undefined type</cell><cell rend="a">a,-</cell>
</row>
<row>
<cell role="label">E5 (none)</cell><cell rend="a">a,-</cell><cell rend="undeftype">undefined type</cell><cell rend="a">a,-</cell>
</row> *-->

&spacer4;

<row><!--* tsmsv1 *-->
<cell role="label">F1 (first)</cell><cell rend="err">dups</cell><cell rend="err">dup (and exception)</cell><cell rend="err">dups</cell>
</row>
<!--* <row>
<cell role="label">F2 (last)</cell><cell rend="err">dups</cell><cell rend="err">dup (and exception)</cell><cell rend="err">dups</cell>
</row> *-->

&spacer4;

<row><!--* msxml *-->
<cell role="label">G1 (all)</cell><cell rend="err">duplicate a</cell><cell rend="err">no a to redefine</cell><cell rend="err">duplicate a</cell>
</row>
<row><!--* msxml *-->
<cell role="label">G6 (all)</cell><cell rend="a">a,-</cell><cell rend="aA">a,A</cell><cell rend="a">a,-</cell>
</row>

&spacer4;

<row><!--* tslxj1 *-->
<cell role="label">H1 (all)</cell><cell rend="err">no schema</cell><cell rend="err">no schema</cell><cell rend="err">no schema</cell>
</row>
</table>
</p>
</div>
</div>

<div id="t0lessons">
<head>Analysis and evaluation</head>
<p>The results shown above, of running the t0 tests on several processors,
suggest a number of tentative conclusions and questions:
<list>
<item><p>Most processors exhibit different behavior for the same set
of schema documents and instances, depending on the order in which
schema documents are given on the command line or listed in
schemaLocation hints in the instances.  (A third source of variation
in sequence is the order in which includes, imports, and redefines
occur in a schem adocument; test set t0 includes no examples of such
variation.)</p>
<p>Some processors (E, B1-B3) exhibit no such sequence dependencies in
this set of tests.</p>
<p>We might achieve better interoperability if the specification said
explicitly either that sequence is or should be significant in lists
of schema documents given at invocation time, in calls from one schema
document to another, and in schemaLocation hints (and if so, describe
what effect variations in order are to have), or that sequence is not
significant in the contexts defined by the spec, and should not be
significatn elsewhere (e.g. in command line interfaces).
</p></item>
<item><p>None of the documentation for the processors tested describes
in any obvious place whether the construction of the schema depends on
the order in which multiple schema documents are named.</p>
</item>
<item><p>Some processors appear (further tests are probably required
to tell for certain) to perform a sort of depth-first processing
of schema documents:  if documents A, B, and C are named on the 
command line, and A calls D and E, these processors will
read and process D and E before B.  A 'breadth-first' approach
is also possible, in which D and E will be processed only after
B and C.</p>
<p>The difference between depth- and breadth-first handling of
schema documents will affect the results when multiple schema
documents are available for the same namespace and the processor
choose to include only components from the first schema 
document encountered (plus schema documents included by that
one).</p>
</item>
<item><p>Processors vary in their (command-line or library)
interfaces. Some processors allow zero or more schema documents to be
specified on the command line, others require exactly one. Processor A
allows arbitrarily many, but appears to ignore all but the last; the
tests of set t0 are not suitable for proving this conclusively.
Processor F requires exactly one schema document on the command line.
Processors B4 and C1 don't accept schema document names on the command
line at all.
</p><p>
It is difficult to see how to construct a consistent testing 
discipline for such disparate interfaces.</p>
<p>One can factor out the interface variability by providing, 
for each test case, a single 'driver' schema document, which 
does nothing at all but include the other schema documents.
The name of this single driver document can be passed as a
command-line parameter both to processors which accept multiple
schema document arguments and to processors which allow t
most one, or exactly one.  If the driver is also pointed to
from a single schemaLocation hint on the document root element,
variability in the treatment of schemaLocation hints can also
be factored out (and processors which don't support specification
of schemas on the command line can be tested).</p>
<p>On the other hand, it's not clear that a set of 
interoperability tests <emph>should</emph> factor out these
sources of variation:  a collection of tests which does not
exercise the full interface of a processor is unlikely to
provide a full picture of its interoperability with other
processors.</p>
</item>
<item><p>Do processors behave the same way when multiple
schema documents for the same namespace are mentioned to
the processor (via invocation options or references in other
schema documents or hints in the XML document instance)?</p>
</item>
<item><p>Not all processors are indefatigable.  Some,
that is, do not issue more than one error message for
the style of test document described above:  once the
first <ident>a</ident> element with content <q>......</q>
is recognized as invalid, no further error messages are
emitted.  This makes their results difficult to interpret.</p>
<p>Further test sets should therefore generate not a
single test instance for a given call graph, but eighty-one
(one for each of the twenty-seven <ident>a</ident>,
<ident>b</ident>, and <ident>c</ident> elements in the 
test document described above.</p>
</item>
<item>
<p>The XML Schema Test Suite vocabulary 
describes the expected results of a test as the
document element being valid, invalid, or having
validity=<code>notKnown</code>; other items and properties
in the PSVI cannot be specified.
As a result, some test harnesses for schema tests stop
processing (as noted above) as soon as the validity result is known.</p>
<p>Another result is that the test catalog cannot describe
all of the relevant properties of a conforming result.
</p>
</item>
</list>
</p>
<p>Some practical observations may also be worth recording:
<list>
<item><p>The schema for the test suite vocabulary reports that
the official namespace name is 
<q><code>http://www.w3.org/2003/XMLSchema/TestSuite/PLACEHOLDER</code></q>
&mdash; but in fact uses the namespace name 
<q><code>TestSuite</code></q> (which is not
namespace-well-formed).</p>
<p>At least one tester reports that his test setup had problems
with <xref>t0/t0.testSet</xref>; either there is more than
one version of the schema floating around, or there are unwritten
conventions I have omitted to follow.</p>
</item>
<item><p>When an invalid element is encountered, some processors
but not all mention the names of the element and its type; several
mention only the location in the input stream, in line and
character number.  Reliable interpretation of the results
requires that one know for certain whether the element on line
78 is one of the final 'b' elements, or one of the early 'c'
elements in the test document.</p>
<p>
When, however, the constraint violated is a fact of a
simple type, then
virtually all processors mention the literal representation
of the value in their error messages.</p>
<p>It would simplify automatic analysis of error messages
if the literals contained clear information on their parent element
and its type.  Inserting the names 'a', 'b', 'c' would
interfere with the pattern constraints; perhaps the generic
identifier should be rot13-encoded, so that all instances
of ns1:a begin <q><code>ns1:n</code></q> or 
<q><code>ns1:rot13(n)</code></q>.</p></item>
<item><p>It is a mistake to place DTDs, stylesheets, and other
auxiliary materials in a directory called <ident>aux</ident>:
this name is reserved in MS-Windows systems and no directory
of this name can be created.</p>
</item>
<item><p>The use of DTDs appears to cause complications for
some XML tools; use of the tests is simpler if DTDs are not
used at all.</p></item>
<item><p>It's helpful to supply explicit XML declarations on
all XML documents in the test set.</p></item>
</list>
</p>
</div>

</div>
</div>

<div id="testcasegeneration">
<head>Generating test cases</head>
<p>[Description here of dumping instances from Alloy, the XML format
for instances, the XML format for test cases, and the XSLT to go from
the one to the other. The test cases should be described by a catalog
following the schema agreed on by the XML Schema Working Group, with
the possible exception that in some cases, I do not know what the
expected result should be.  I'll either leave it out, or claim that
the expected result is that the schema is valid and the document
invalid. This section also needs a description of the test cases, and
pointers to them on the server.]</p>

<div id="alloy-dump-format">
<head>Dumping Alloy instances in XML</head>
<p>The Java API for Alloy makes it possible to load an Alloy model and
then loop through the commands (predicates and assertions) in the
model, generating instances for each command.  Each instance can be
written out to disk in XML form, using the <ident>writeXML</ident>
method of the <ident>A4Solution</ident> class.  (I won't go into
further details of the Java here; consult the Alloy documentation
or discussion list, or the author, for more information.)</p>
<p>The XML dump format currently used by Alloy 4 is straightforward
and reasonably self-explanatory.  For example, the command 
<q><code>run all_clean for 3</code></q> generates a number of
instances, including this one:<eg><![CDATA[]]></eg></p>
</div>



</div>

<div id="testresults">
<head>Test results</head>
<p>[Description here of test results for specific processors 
for the test cases described above.]</p>

</div>
<div id="the_future_lies_ahead">
<head>Conclusion and further work</head>
<p>This paper has demonstrated that even a simple Alloy model of
schema composition can be useful, both in sanity checking
designs for this part of the schema spec and in generating
test cases for interoperability testing (and, once the
required behaviors are more clearly specifid, also for
conformance testing).</p>
<p>The first item of further work is to complete this paper
by automating
<list>
<item>the generation of test cases from Alloy instances</item>
<item>the tabulation of results (for t0, manual inspection of the
output has sufficed, but this has proven time-consuming even for
t0; for larger test sets it will be impracticable)</item>
</list>
and then by generating test cases, using them to test
as many XSDL 1.0 processors as is feasible, and studying
the results.</p>
<p>
Further models should also be developed (to be reported in separate
papers, not this one), to capture more of the details of
schema composition and allow the formulation of 
assertions to test possibly interesting propositions
(e.g. <q>for two schema documents in the same namespace,
the order in which they are imported or included or
redefined by other schema documents is immaterial;
both orders produce the same result</q> &mdash; as
formulated, I expect this proposition to be false, but
it expresses a central idea which I believe is true; getting
the formulation accurate is a challenge with which
light-weight formal methods like Alloy can assist.<note place="foot">
<p>Thanks are due to Daniel M. Jackson and the 
Alloy team for the tool itself and for assistance
with questions and problems; to Liam Quin, for
discussion of the issues raised in this paper; to David Ezell
and Michael Kay for helpful discussions and
<!--* , Sandy Gao, Mary Holstege, and Ashok Malhotra, *-->
for assistance in gathering test results.</p></note>
</p>
</div>

</body>
<back>
<div id="refs">
<head>References</head>
<listBibl>

<bibl id="Jackson" n="Jackson 2006">
Jackson, Daniel.  
<title level="m">Software abstractions: Logic, language, and
analysis</title>.  Cambridge: MIT Press, 2006.
</bibl>

<bibl id="norq151" n="Sperberg-McQueen 2004">
Sperberg-McQueen, C. M.  
<title level="u">Notes on RQ-151: Schema composition</title>.  
Working paper prepared for the W3C XML Schema Working Group.
[Cambridge,
Sophia-Antipolis, Tokyo]:  World Wide Web Consortium, 2004.
Available on the Web at 
<xref>http://www.w3.org/2004/07/msm/rq-151.notes.xml</xref>;
the discussion of missing information is in appendix A,
<xref>http://www.w3.org/2004/07/msm/rq-151.notes.xml#missinginfo</xref>.
(Accessible to W3C members only.)
</bibl>
<bibl id="xsdl10" n="W3C 2001">
W3C (World Wide Web Consortium).
<title level="m">XML Schema Part 1: Structures</title>.
W3C Recommendation 2 May 2001.
Second edition, W3C Recommendation 28 October 2004.
Ed. Henry S. Thompson et al.
[Cambridge,
Sophia-Antipolis, Tokyo]:  World Wide Web Consortium, 2001, 2004.
Available on the Web at 
<xref>http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/</xref>.
Latest version at
<xref>http://www.w3.org/TR/xmlschema-1/</xref>.
</bibl>
<bibl id="xsdl11" n="W3C 2007">
W3C (World Wide Web Consortium).
<title level="m">W3C XML Schema Definition Language (XSDL) 1.1 Part 1: Structures</title>.
W3C Working Draft 30 August 2007,
ed. Sandy Gao et al.
[Cambridge,
Sophia-Antipolis, Tokyo]:  World Wide Web Consortium, 2007.
Available on the Web at 
<xref>http://www.w3.org/TR/2007/WD-xmlschema11-1-20070830/</xref>.
Latest version at
<xref>http://www.w3.org/TR/xmlschema11-1/</xref>.
</bibl>
</listBibl>
</div>
<div id="todo">
<head>To do</head>

<list>
<item>Define and use a concise XML representation for instances of the model.<list>
<item>Define the vocabulary; call it m1.  Document it, or at least
illustrate it.</item>
<item>Write XSLT to go from Alloy dump format to m1 format.
Point to the stylesheet.</item>
<item>Write XSLT to go from m1 format to a set of test cases:<list>
<item>schema documents as specified</item>
<item>single test instance document (wrapper with 81 children)</item>
<item>(if necessary) 81 small test instances<note place="foot"><p>The schema
for the XML Schema test suite allows only the values <q><code>valid</code></q>,
<q><code>invalid</code></q>, and
<q><code>notKnown</code></q> as expected results.  There is no facility
as the test suite is currently specified, for describing a more complicated
result (like the valid / invalid / notKnown pattern expected among the
81 children of the root, for the single-document test).</p>
<p>To avoid pointless redundancy, it may be better not to generate
distinct test instances for each test set; instead, one could generate
all four possible flavors (no namespace, namespace ns0, ns1, ns2) of
the twenty-seven copies of each of the three element types a, b, and c.
That's 324 single-element test cases (assuming the test instances don't
need schemaLocation information), which can be held in a common directory.</p>
<p>In that case, the appropriate selection of the eighty-one elements
to validate will be reflected only in the <ident>instanceTest</ident> 
elements of the test set catalog, not in the file system.</p>
<p>The wrapper-plus-children test can also be held in common (again,
assuming no schemaLocation hints are required); there are sixty-four
such documents.  (If we required document a always to have namespace
ns0 or no namespace, b to have no namespace, ns0, or ns2, and allow
only c to have ns1, ns2, ns3, or none, then there would be only twelve
82-element test documents needed.  But I don't know a good way to
enforce that without either ugly ad-hoc rules in the model or
more work in the XSLT to go from m1 to test cases.)</p></note></item>
<item>catalog entry for the test set, describing the schema documents 
and test instances (either one of them, or eighty-two of them)</item>
</list>
</item>
<item>Write XSLT to translate m1 format to an HTML description of 
a set of test cases; add it to the stylesheet for this document.</item>
</list>
</item>
<item><p>Define a model to explore some issues of sequencing:  
<eg>abstract sig Call {
  target : SchemaDoc
}
sig Include extends Call {}
sig Import extends Call {}
sig Redefine extends Call {}
  
sig SchemaDoc {
  tns : lone NS,
  calls : seq Call
}</eg>
</p>
<p>
Note that you may need to override the default bounds on sequences
to get sequences long enough to cover cases where the same 
schema document is called more than once.</p>
</item>
<item><p>Extend the sequence-based model to include set-valued properties
analogous to those in model m1, something like this:
<eg>abstract sig Call {
  target : SchemaDoc
}
sig Include extends Call {}
sig Import extends Call {}
sig Redefine extends Call {}
  
sig SchemaDoc {
  tns : lone NS,
  calls : seq Call,
  includes : set SchemaDoc,
  imports : set SchemaDoc,
  redefines : set SchemaDoc
}{
  includes  = (calls.elems &amp;  Include).target,
  imports   = (calls.elems &amp;   Import).target,
  redefines = (calls.elems &amp; Redefine).target
}</eg></p>

<p>This may allow formulation of useful assertions about
the equivalence of the sequence-based model and the
set-based model.  (Perhaps not, as we still don't actually
say in the model what inclusion, import, or redefinition
mean.)</p></item>
<item>Automate the running of tests, from the catalog, for 
various validators, and produce standard test-report
XML.</item>
<item>Write more tools to simplify the interpretation
of the verbose output (along the lines of 
<ident>rdsx.sh</ident>).</item>
</list>
<p>Lessons learned from work with manually constructed
test set; things to do differently next time.
<list>
<item>Do not use <q><code>aux</code></q> as the name of a
directory with auxiliary information.  It clashes with
a legacy restriction on Windows machines (AUX was or
is a device driver on those machines and nothing in
the file system is allowed to use that name).
So call it something else.</item>
<item>The use of DTDs clearly causes problems for
some testers; strip them out before putting things
on the server.</item>
<item>Supply XML declarations on all documents.</item>
<item>Make a variant of the current abc tests, in which
C redefines from A first, and then imports B; in
some cases, this is order-sensitive.</item>
</list>
</p>

</div>
</back>
</text>
</TEI.2>
<!-- Keep this comment at the end of the file
Local variables:
mode: xml
sgml-default-dtd-file:"/Library/SGML/Public/Emacs/sweb.ced"
sgml-omittag:t
sgml-shorttag:t
End:
-->

