XSD-Errata0.91

From RuleML Wiki
Jump to: navigation, search

some text

1 RuleML 0.91 XSD Errata

Here we document errata in the hand-written XSD schemas for RuleML 0.91, as well as the history of their resolution.

1.1 Err1

  • Reported By: Athant, (~2011/03/01)

In connective_module.xsd, the declaration of the formula element for Rulebase has a bug. The following code has missing type declarations.

 <xs:group name="formula-rulebase.content">
   <xs:choice>
     <xs:element name="Atom"  type="Atom.type"/>
     <xs:element name="Implies"/>
     <xs:element name="Equivalent"/>
     <xs:element name="Forall"/>
   </xs:choice>
 </xs:group>

The omission of the type declarations causes these elements to be typed as xs:any, allowing arbitrary content. The bug was discovered after translating the official schema into simplified Relax NG compact syntax, illustrating the value of this approach for verification.

  • Verified By: Boleyh (~2011/04/01)
  • Fix Submitted By: Athant (~2011/03/01)

In connective_module.xsd,

          WAS:
     <xs:element name="Implies"/>
     <xs:element name="Equivalent"/>
     <xs:element name="Forall"/>
 -->
     <xs:element name="Implies" type="Implies.type"/>
     <xs:element name="Equivalent" type="Equivalent.type"/>
     <xs:element name="Forall" type="Forall.type"/>

  • Fix Implemented By: Athant (2011/05/14)
  • Status: Closed

1.2 Err2

  • Reported By: Athant, (~2011/03/01) There are extraneous slotted rest variables. resl can appear twice in Atom and Expr (incorrect), and many times in Plex within resl (incorrect).
  • Verified By: Boleyh (~2011/04/01)
  • Fix Submitted By: Athant (2011/04/27)

In atom_module.xsd,

      (Tara Athan, 2011/04/27) Correction: slot sequence in front of positional arguments should not accept a rest variable 
     Therefore it is necessary to have two different groups, extend1 and extend2  
       WAS: 
	<xs:group name="Atom-slots.extend">
 		<xs:sequence>  
 			<xs:element name="slot" type="slot.type" minOccurs="0" maxOccurs="unbounded"/> 
 		</xs:sequence> 
	</xs:group>
 	<xs:group name="Atom.content"> 
		<xs:sequence>
 			<xs:element ref="oid" minOccurs="0"/>
 			<xs:element ref="degree" minOccurs="0"/>
 			<xs:choice>
 				<xs:element name="op" type="op-atom.type"/>
 				<xs:group ref="op-atom.content"/>
 			</xs:choice>
 			<xs:group ref="Atom-slots.extend"/>
 			<xs:sequence minOccurs="0">
 				<xs:group ref="Atom-repo.extend"/>
 				<xs:group ref="Atom-slots.extend"/>
     -->
	<xs:group name="Atom-slots.extend1">
 		<xs:sequence>
 			<xs:element name="slot" type="slot.type" minOccurs="0" maxOccurs="unbounded"/>
 		</xs:sequence>
 	</xs:group>
 	<xs:group name="Atom-slots.extend2">
 		<xs:sequence>
 			<xs:element name="slot" type="slot.type" minOccurs="0" maxOccurs="unbounded"/>
 		</xs:sequence>
 	</xs:group>
 	<xs:group name="Atom.content">
 		<xs:sequence>
 			<xs:element ref="oid" minOccurs="0"/>
 			<xs:element ref="degree" minOccurs="0"/>
 			<xs:choice>
 				<xs:element name="op" type="op-atom.type"/>
 				<xs:group ref="op-atom.content"/>
 			</xs:choice>
 			<xs:group ref="Atom-slots.extend1"/>
 			<xs:sequence minOccurs="0">
 				<xs:group ref="Atom-repo.extend"/>
 				<xs:group ref="Atom-slots.extend2"/>
 

and in hornlog.xsd

            (Tara Athan, 2011/04/27) Correction: resl added only to slot sequence occurring after positional arguments 
            WAS:
        <xs:group name="Atom-slots.extend">
			<xs:sequence>
				<xs:group ref="Atom-slots.extend"/>
        -->
		<xs:group name="Atom-slots.extend2">
			<xs:sequence>
				<xs:group ref="Atom-slots.extend2"/>

and in expr_module.xsd, starting at line 76

               (Tara Athan, 2011/04/27) Correction: removed extraneous 'resl' 
                WAS:
			<xs:element ref="resl" minOccurs="0"/>
            -->

and at (new) line 239

              (Tara Athan, 2011/04/27) 
                Correction: changed from choice of slot and resl to sequence of slot*, resl? 
                WAS:
			<xs:choice minOccurs="0" maxOccurs="unbounded">
				<xs:element name="slot" type="slot.type"/>
				<xs:element ref="resl"/>
			</xs:choice>
             -->
			<xs:element name="slot" type="slot.type" minOccurs="0" maxOccurs="unbounded"/>
			<xs:element ref="resl" minOccurs="0"/>

  • Fix Implemented By: Athant (2011/05/14)
  • Status: Closed
  • Reopened: By: Athant (2011/09/17)

The patch submitted earlier was 1. not successfully uploaded on (2011/05/14) and 2. not quite correct. New patch is

In atom_module.xsd,

	<xs:group name="Atom-slots.extend1">
		<xs:sequence>
			<xs:element name="slot" type="slot.type" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:group>
	<xs:group name="Atom-slots.extend2">
		<xs:sequence>
		</xs:sequence>
	</xs:group>
	<xs:group name="Atom.content">
		<xs:sequence>
			<xs:element ref="oid" minOccurs="0"/>
			<xs:element ref="degree" minOccurs="0"/>
			<xs:choice>
				<xs:element name="op" type="op-atom.type"/>
				<xs:group ref="op-atom.content"/>
			</xs:choice>
		  <xs:group ref="Atom-slots.extend1"/>
		  <xs:sequence minOccurs="0">
		    <xs:group ref="Atom-repo.extend"/>
		    <xs:group ref="Atom-slots.extend1"/>
		  </xs:sequence>
	    <xs:group ref="Atom-slots.extend2"/>
		</xs:sequence>
	</xs:group>

  • Status: Closed

1.3 Err3

  • Reported By: Athant, (~2011/03/01) repo can appear many times in Plex within repo (incorrect), but only once elsewhere (correct).
  • Verified By: Boleyh (~2011/04/01)
  • Fix Submitted By: Athant (2011/04/27)

In expr_module.xsd at (new) line 225

               (Tara Athan, 2011/04/27) 
               Corrections: moved repo out of the choice and made it optional 
               WAS:
				<xs:element ref="repo"/>
			</xs:choice>
             -->
			</xs:choice>
			<xs:element ref="repo" minOccurs="0"/>

  • Fix Implemented By: Athant (2011/05/14)
  • Status: Closed

1.4 Err4

  • Reported By: Athant, (~2011/03/01)

In holog, and up, as well as bindatagroundlog, and down, the old declarations, such as Atom, Plex, Expr, etc. in the Hilog languages, and Forall, etc. in the binary languages, are still floating around as global elements. The only place they can appear is at the root level (since they are global elements), and in Reify. These are both minor issues, as a validator may not catch errors from an incorrect root element or in the contents of Reify. It also causes problems for testing, as the auto-generated Reify elements are full of spurious elements.

  • Verified By: Boleyh (~2011/04/01)
  • Comment By: Athant, (2011/05/13)

I don't know of a way to fix this issue within the modularization system of the hand-written XSDs. It is caused by the implementation of content-model restriction by redefining the content model to, say, remove Var from the choice group for arguments of Atom without actually getting rid of the globally-defined element Var. So this element is still around in this language, and can appear as a child of elements that use xs:any, as Reify does, or it can appear as document root. Neither of these is conformant with the abstract specifications. As a work-around, I have translated the XSD into Relax NG, made the correction there and translated back into (monolithic) XSD. Instances were automatically generated from these monolithic corrected XSDs to assist in testing of the Relax NG schema.

  • Status: Work-Around Available

1.5 Err5

  • Reported By: Athant, (~2011/03/01) The RuleML 0.91 hand-written XSD schemas use the following pattern for modularization:

<xs:redefine schemaLocation="datalog.xsd">
  <xs:group name="head.content">
    <xs:choice>
      <xs:group ref="head.content"/>
      <xs:element ref="Neg"/>
    </xs:choice>
  </xs:group>
</xs:redefine>

(The equivalent structure in Relax NG is the choice combine, "head.content |= Neg" .) This method of extending model groups is allowed under some interpretations of the XSD specifications. The problem arises because the group head.content does not appear explicitly in datalog.xsd, as it is defined in the included module neg_module.xsd. Therefore, some validators report this construction as not allowed according to the XML specifications because it is considered a circular definition.

"Circular groups are disallowed. That is, within the {particles} of a group 
there must not be at any depth a particle whose {term} is the group itself."

(see Section 3.8.6 Schema Component Constraint: Model Group Correct, Item #2 in W3C04).

Validators are inconsistent on this interpretation. The entire modularization approach of the RuleML 0.91 hand-written XSD schemas depends on the use of this ambiguous construct. In particular it is used in:

  • hornlog: arg.content, slot-name.extend, oid.content, Atom-repo.extend, Atom-arg.extend, Atom-slots.extend
  • negdatalog: head.content, body.content, formula-assert.content, formula-rulebase.content, formula-query.content, formula-and-or.content

and so on.

It is possible to use most validation engines with schemas that have these constructions, but other tools that use XML may fail. In particular, the oXygen instance generator fails with these schema, and it was necessary to flatten the schemas first, which removes the circular redefinitions.

  • Status: Fix Proposed Athant 2012-05-24

If all "includes" that are affected by this issue are changed to "redefines", and the groups that need to be modified at higher levels of the tree are trivially redefined, e.g.

   <xs:group name="formula-and-or.content">
     <xs:choice>
       <xs:group ref="formula-and-or.content"/>
     </xs:choice>
   </xs:group>

then most of these errors/warning messages will disappear (Xerces, Saxon, JAXP).

The one case that is not solved by this approach is the redefinition of the attribute @per. In the transition where equality is added (such as folog to fologeq), the attribute group per.attrib is first restricted to be empty, then extended to contain a more generous definition of the @per content model. Several schemas have problems with this.

An approach that is acceptable across many validators, including the most commonly used ones mentioned above, is to redefine the complex types Fun.type and Expr.type. Again, this must be done in two stages, one to restrict and two to extend. However, the syntax for complex type redefintion includes attributes to specify a restriction or extension, allowing these operations to be concatenated.

The fix has been tested locally for fologeq.xsd, and it validates in Xerces. Warning messages no longer appear in Saxon-EE, and all validation engines produce success, without warnings, except from MSXML.NET. Based on some readings of email lists, this is due to my having an old version of .NET installed, and should be fixed for .NET 2.0. Therefore, I would say this is a reliable cross-validator fix, although it makes the neat(-ish) system of redefinitions a horrendous nightmare.

1.6 Err6

(Athant, Boleyh) In the higher-order sublanguages, the content of resl includes Plex, but the Plex element has been unified with Hterm in the higher-order languages. Similarly for repo. There needs to be restricted types of Hterm, having only slotted or only positional arguments, to correspond to the restricted Plex types in the first-order languages. However, to act as a Plex, Hterm needs to be allowed to have an optional operator. Therefore in the languages that allow positional arguments, the operator element (as striping) is not optional - it is needed to distinguish between a function and a list, because in the higher-order languages any term can act as an operator.

1.7 Err7

(Athant) Withdrawn as Erratum, Resubmit as Proposal In the frame sublanguage, there are two kinds of slots. The new one allows attributes to specify minimum and maximum cardinality, and has an optional role filler. The new slot type is used for Signature and Atom. In Hterm, the old slot type is used (required filler, no min/max cardinality). An Atom element with only slotted arguments is required because there is a need for an atom syntax that allows the operator to be optional. Uniterm cannot be used because stripe-skipping is allowed on the operator, which is assumed to be the first term after the (optional) oid. If the operator was allowed to be optional, then stripe-skipping on the operator would not be allowed. Syntax unification could be obtained with one unified slot and one unified Uniterm if the operator stripe was not allowed to be skipped. This would also allow more order-insensitivity, including infix and postfix operators. At the same time, this would allow <degree> to be added to Uniterm, completing the fuzzification of atomic sentences.

1.8 Err8

  • Reported By: Athant, (2011/09/27)

In the "naffologeq.xsd" schema, the code to add <Equal> to the content model of <Rulebase> was omitted. The necessary code, to be added to "naffologeq.xsd", is

 <xs:group name="formula-rulebase.content">
   <xs:choice>
     <xs:group ref="formula-rulebase.content"/>
     <xs:element ref="Equal"/>
   </xs:choice>	
 </xs:group>

  • Fix Implemented By: Athant (2011/10/06)
  • Status: Closed

1.9 Err9

  • Reported By: Athant, (2011/12/12)

In the "bindatagroundlog.xsd" schema, the code to remove <Var/> from the content model of <oid/> was omitted. The necessary code, to be added to "bindatagroundlog.xsd", is

 <xs:group name="oid.content">
   <xs:choice>
     <xs:element ref="Ind"/>
     <xs:element ref="Data"/>
     <xs:element ref="Skolem"/>
     <xs:element ref="Reify"/>					
   </xs:choice>
 </xs:group>

Similarly in "framehohornlogeq.xsd", the code to add <Get/> and <Set/> to the content model of <oid/> was omitted. The necessary code, to be added to "framehohornlogeq.xsd", is

 <xs:group name="oid.content">
   <xs:choice>
     <xs:group ref="oid.content"/>
     <xs:element ref="Get"/>
     <xs:element ref="Set"/>
   </xs:choice>
 </xs:group>


  • Fix Implemented By: Athant (2011/12/12)
  • Status: Closed