Re: redefine: extending a group

"Biron,Paul V" <Paul.V.Biron@kp.org> writes:

> Clause 6 of Schema Representation Constraint: Redefinition Constraints and Semantics [1] says:
> 
> 	6 Within the [children], for each <group> the appropriate case among
> 	the following must be true:
> 	  6.1 If it has a <group> among its contents at some level the ·actual value·
> 	  of whose ref [attribute] is the same as the ·actual value· of its own name
> 	  attribute plus target namespace, then all of the following must be true:
> 	    6.1.1 It must have exactly one such group.
> 	    6.1.2 The ·actual value· of both that group's minOccurs and maxOccurs
> 	    [attribute] must be 1 (or ·absent·).
> 	  6.2 If it has no such self-reference, then all of the following must be true:
> 	    6.2.1 The ·actual value· of its own name attribute plus target namespace
> 	    must successfully ·resolve· to a model group definition in I.
> 	    6.2.2 The {model group} of the model group definition which corresponds
> 	    to it per XML Representation of Model Group Definition Schema Components
> 	    (§3.7.2) must be a ·valid restriction· of the {model group} of that model group
> 	    definition in I, as defined in Particle Valid (Restriction) (§3.9.6).
> 
> I read this as saying that the following is allowed:
> 
> <!-- in a.xsd -->
> <xs:schema ...>
> 	<xs:group name='grp'>
> 		<xs:sequence>
> 			<xs:element name='test'/>
> 			<xs:element name='again' minOccurs='0' maxOccurs='unbounded'/>
> 		</xs:sequence>
> 	</xs:group>
> </xs:schema>
> 
> <!-- in b.xsd -->
> <xs:schema ...>
> 	<xs:redefine schemaLocation='a.xsd'>
> 		<xs:group name='grp'>
> 			<xs:sequence>
> <!-- i.e., a restriction of grp -->
> 				<xs:element name='test'/>
> 				<xs:element name='again' maxOccurs='0'/>
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Or leave this out altogether -- I find that less confusing, myself.

> 			</xs:sequence>
> 		</xs:group>
> 	</xs:redefine>
> </xs:sequence>
> 
> <!-- in c.xsd -->
> <xs:schema ...>
> 	<xs:redefine schemaLocation='a.xsd'>
> 		<xs:group name='grp'>
> 			<xs:sequence>
> <!-- i.e., an extension of grp -->
> 				<xs:group ref='grp'/>
> 				<xs:element name='anotherTest'/>
> 			</xs:sequence>
> 		</xs:group>
> 	</xs:redefine>
> </xs:sequence>
> 
> but that the following isn't allowed:
> 
> <!-- in d.xsd -->
> <xs:schema ...>
> 	<xs:redefine schemaLocation='a.xsd'>
> 		<xs:group name='grp'>
> 			<xs:sequence>
> <!-- i.e., an extension of grp that explicitly duplicates the original content model -->
> 				<xs:element name='test'/>
> 				<xs:element name='again' minOccurs='0' maxOccurs='unbounded'/>
> 				<xs:element name='anotherTest'/>
> 			</xs:sequence>
> 		</xs:group>
> 	</xs:redefine>
> </xs:sequence>

> My question: why is it not allowed to "inline" the group that is
> being redefined via extension?  Was this just an oversight or is
> there some reason that I'm missing on first examination?  This same
> basic situtation exists with redefining attribute groups as well if
> I'm not mistaken.

I guess it was just to make this kind of redefinition as parallel as
possible to type definition by extension.  Also, it's much easier to
check for the 'ref' than to check for the group's content.

> If the schema contraint is correct, then the prose preceding it
> should be corrected because it reads:
> 
> 	The definitions within the <redefine> element itself are restricted to
> 	be redefinitions of components from the <redefine>d schema document,
> 	in terms of themselves. That is,
> 
> 		* Type definitions must use themselves as their base
> 		type definition;

> 		* Attribute group definitions and model group
> 		definitions must be supersets or subsets of their
> 		original definitions, either by including exactly one
> 		reference to themselves or by containing only
> 		(possibly restricted) components which appear in a
> 		corresponding way in their <redefine>d selves.
> 
> which implies that d.xsd should be legal.

I don't think it implies that -- d doesn't include a reference, nor
does it consist only of components in the original (it has
<anotherTest>).

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2002, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
 [mail really from me _always_ has this .sig -- mail without it is forged spam]

Received on Wednesday, 20 November 2002 08:37:08 UTC