<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet href="homepage.xsl" type="text/xsl"?>

<!-- Written by David Hirtle -->

<homepage>

  <title>Schema Specification of RuleML 0.89</title>

	<opening>
		<center>
			<br/>
			<br/>
			<h1>Schema Specification of RuleML 0.89</h1>
			<h2>
				David Hirtle,
				<a href="http://www.cs.unb.ca/~boley/">Harold Boley</a>, 
				<a href="http://ebusiness.mit.edu/bgrosof/">Benjamin Grosof</a>,
				<a href="http://www.cs.sunysb.edu/~kifer">Michael Kifer</a>,<br />
				<a href="http://www.dfki.uni-kl.de/~sintek/">Michael Sintek</a>,
				<a href="http://home.comcast.net/~stabet/">Said Tabet</a>,
				<a href="http://tmitwww.tm.tue.nl/staff/gwagner/">Gerd Wagner</a>			
			</h2>
			
			<table border="0" align="center">
			<tr><td colspan="2" align="center"><h2>Version history:</h2></td></tr>
			<tr><td align="right">2001-01-25 - </td><td><a href="http://www.ruleml.org/indtd.html">Version 0.7</a></td></tr>
			<tr><td align="right">2001-07-11 - </td><td><a href="http://www.ruleml.org/indtd0.8.html">Version 0.8</a></td></tr>
			<tr><td align="right">2003-12-09 - </td><td><a href="http://www.ruleml.org/0.85/">Version 0.85</a></td></tr>
			<tr><td align="right">2004-06-23 - </td><td><a href="http://www.ruleml.org/0.86/">Version 0.86</a></td></tr>
			<tr><td align="right">2004-08-12 - </td><td><a href="http://www.ruleml.org/0.87/">Version 0.87</a></td></tr>
			<tr><td align="right">2005-03-01 - </td><td><a href="http://www.ruleml.org/0.88/">Version 0.88</a></td></tr>
			<tr><td align="right"><h3>2005-05-27 - </h3></td><td><h3><a href="http://www.ruleml.org/0.89/">Version 0.89</a></h3></td></tr>
			</table>			

			<h2>Latest version: <a href="http://www.ruleml.org/spec/">www.ruleml.org/spec</a></h2>
			<p/>
			<h2>Quick links:</h2>
			<h2><a href="http://www.ruleml.org/0.89/xsd/content_models.pdf">Content Models</a>,
			<a href="http://www.ruleml.org/0.89/xsd">Schemas</a> <small>(<a href="http://www.ruleml.org/0.85/dtd">Archived DTDs</a>)</small>,
			<a href="http://www.ruleml.org/0.89/xslt/normalizer">Normalizer</a>,
			<a href="http://www.ruleml.org/0.89/xslt/upgrader">Upgrader</a>, <a href="http://www.ruleml.org/0.89/exa">Examples</a>
			</h2>
		</center>
		<br/>
		
		<p>This is a revised XML Schema specification for RuleML, version 0.89. This release incorporates long-envisaged new expressiveness building upon the validation
			stable <a href="http://www.ruleml.org/0.88">RuleML 0.88</a>.
		 </p>
		 <p>
		   Each XML Schema Definition (XSD) in the evolving hierarchy corresponds to a specific RuleML
		   sublanguage. The implementation uses a
		   <a href="http://www.w3.org/TR/xhtml-modularization/">modularization approach similar to the one in XHTML</a>
		   in order to offer appropriate flexibility and accomodate different implementations and approaches.
		   Note that the Document Type Definition (DTD) specification of RuleML is no longer being maintained,
		   but will continue to be <a href="http://www.ruleml.org/0.85/dtd">available as an archive</a>.  Tools
		   capable of converting between XML Schema and DTDs such as <a href="http://www.altova.com/products_ide.html">XMLSpy</a>
		   are always available.
		</p>
		
	</opening>

<section>
	<header>Overview</header>
   <p>
   An introduction to RuleML is given in our <a href="http://www.ruleml.org/papers/tutorial-ruleml.html">tutorial</a>.
    Also, the main page's <a href="http://www.ruleml.org/index.html#Design">design section</a>
   discusses the upper layer of the RuleML hierarchy of rules.
   In that terminology, the system of RuleML XSDs presented here only covers
   derivation rules, not reaction rules.
   </p>
   <p>
   This is because we think it is important to start with a subset of
   simple rules, test and refine our principal strategy using these,
   and then work 'up' to the more general categories of rules in the hierarchy.
   For this we choose
   <a href="http://www-lp.doc.ic.ac.uk/UserPages/staff/ft/alp/net/dbs/datalog.html">Datalog</a>,
   a language corresponding to relational databases
   (ground facts without complex domains or 'constructors')
   augmented by views (possibly recursive rules),
   and work a few steps upwards to further declarative rules
   as allowed in (equational) Horn logic.
   <!--We also introduce a URL/URI module corresponding to
   webizing. The 'UR'-Datalog join of both of these classes then permits
   inferences over RDF-like 'resources' and can be re-specialized to
   RDF triples.-->
   </p>	

	<p>Below is a summary of the changes in version 0.89:</p>
	
	<itemize>
		<item>new sublanguages providing the modular specification of <a href="http://www.ruleml.org/fol">FOL RuleML</a> as submitted to W3C:
			<itemize><item><a href="xsd/folog.xsd">folog</a></item>
				<item><a href="xsd/fologeq.xsd">fologeq</a></item>
				<item><a href="xsd/naffolog.xsd">naffolog</a></item>
				<item><a href="xsd/naffologeq.xsd">naffologeq</a></item>
			</itemize>
		</item>
		<item>new sublanguages providing the serialization of <a href="http://www.daml.org/services/swsl/report/swsl/#sec-markup">SWSL</a>:
			<itemize>
				<item>HiLog Layer: <a href="xsd/hohornlog.xsd">hohornlog</a></item>
				<item>Explicit Equality: <a href="xsd/hohornlogeq.xsd">hohornlogeq</a></item>
				<item>Frames Layer: <a href="xsd/framehohornlogeq.xsd">framehohornlogeq</a></item>
			</itemize>
		</item>
		<item>new tag &lt;Reify&gt; introduced to support reification (a kind of instantiation or quasi-quotation)</item>		
		<item>new attributes 'minCard' and 'maxCard' introduced to allow cardinality constraints</item>
		<item>new tag &lt;Data&gt; introduced, besides &lt;Ind&gt;, optionally specifying an <a href="http://www.w3.org/TR/xmlschema-2/#built-in-datatypes">XML Schema built-in datatype</a> for checking during validation</item>
		<item>new tag &lt;Mutex&gt; introduced to support mutual exclusion</item>
		<item>'innerclose' renamed to 'mapClosure', and analogous 'mapDirection' introduced</item>
		<item>optional positional rest role &lt;repo&gt; and slotted rest role &lt;resl&gt; introduced</item>
		<item>RDF blank nodes as Skolem individual constants</item>
		<item>oid's are now permitted in all atoms, connectives and quantifiers</item>
		<item>webizing is optionally included in all sublanguages, eliminating the need for the entire 'ur' branch of the family of languages</item>
	</itemize>

	<p>For more information, see the <a href="#Changes">Changes</a> section.</p>

<p>The grammar of RuleML 0.89 (i.e. the content
	model of each individual tag) is available as a single document called 
	<a href="xsd/content_models.pdf">Content Models for RuleML</a> in addition to being encoded within
	the <a href="xsd/">XML Schemas</a>.  Issues relevant to RuleML 0.89 were already discussed in the <a href="http://www.ruleml.org/fol/#Issues">Issues List of 
	FOL RuleML</a>, in particular issues 1. and 9.
	</p>
<p>A presentation entitled <a href="http://www.ruleml.org/0.89/RuleML-schema-spec-2005-06-08.ppt">From RuleML 0.88 to 0.89: Sublanguages Beyond Horn Logic - Validation and Translation</a> is also available.</p>
<p>See also a recent publication accepted for the <a href="http://www.w3.org/2004/12/rules-ws/">W3C Rules Workshop</a> in Washington: <a href="http://www.ruleml.org/w3c-ws-rules/implementing-ruleml-w3c-ws.html">Implementing RuleML Using Schemas, Translators, and Bidirectional Interpreters</a>.</p>

</section>   

<section>
	<header>Changes</header>
<p>RuleML 0.89 consists of the following changes relative to the previous version <a href="http://www.ruleml.org/0.88/">0.88</a>.
</p>

<p>Four new sublanguages providing the modular specification of <a href="http://www.ruleml.org/fol">FOL RuleML</a> have been added to the family:</p>
			<itemize><item><a href="xsd/folog.xsd">folog</a>: FOL RuleML as submitted to W3C</item>
				<item><a href="xsd/fologeq.xsd">fologeq</a>: FOL RuleML with Equal</item>
				<item><a href="xsd/naffolog.xsd">naffolog</a>: FOL RuleML with Naf (negation-as-failure)</item>
				<item><a href="xsd/naffologeq.xsd">naffologeq</a>: FOL RuleML with both Equal and Naf</item>
			</itemize>
<p>Another three new sublanguages are also added to provide the serialization of the
<a href="http://www.daml.org/services/swsl/report/swsl/#sec-markup">Semantic Web Services Language (SWSL)</a>:</p>
			<itemize>
				<item>HiLog Layer: <a href="xsd/hohornlog.xsd">hohornlog</a></item>
				<item>Explicit Equality: <a href="xsd/hohornlogeq.xsd">hohornlogeq</a></item>
				<item>Frames Layer: <a href="xsd/framehohornlogeq.xsd">framehohornlogeq</a></item>
			</itemize>
<p>A new tag &lt;Reify&gt; is introduced to support reification, a kind of instantiation or quasi-quotation.  It
is permitted anywhere a regular term (e.g. Ind or Var) is, in all sublanguages, and allows any RuleML tag
available within the current sublanguage as content, treating it as a term for performing reasoning on.  For example,
the following is a reification of the <a href="http://www.ruleml.org/0.8/#Context">'own' rule</a>:</p>
<p><code><![CDATA[
 <Reify>
   <Implies>
     <And>
       <Atom>
         <Rel>buy</Rel>
         <Var>person</Var>
         <Var>merchant</Var>
         <Var>object</Var>
       </Atom>
       <Atom>
         <Rel>keep</Rel>
         <Var>person</Var>
         <Var>object</Var>
       </Atom>
     </And>
     <Atom>
       <Rel>own</Rel>
       <Var>person</Var>
       <Var>object</Var>
     </Atom>
   </Implies>
 </Reify>]]></code></p>

<p>See the <a href="http://www.daml.org/services/swsl/report/swsl/#ruleml-reification">SWSL report</a> for more details on &lt;Reify&gt;.</p>
<p>Two new attributes 'minCard' and 'maxCard' are introduced to allow cardinality constraints on slots.  For example,
the following specifies that the cardinality of a slot is no less than 1 and no more than 2:</p>
<p><code><![CDATA[
 <slot mincard="1" maxcard="2">...</slot>
]]></code></p>

<p>Another important addition is &lt;Data&gt; that may optionally specify an
<a href="http://www.w3.org/TR/xmlschema-2/#built-in-datatypes">XML Schema built-in datatype</a> (e.g. date, integer, string) for checking during validation using the 'xsi:type' attribute.
For example, the following are all correctly enforced during validation:</p>
<p><code><![CDATA[
 <Data xsi:type="xs:string">test</Data>
 <Data xsi:type="xs:nonNegativeInteger">12</Data>
 <Data xsi:type="xs:dateTime">2002-10-10T17:00:00Z</Data>]]></code></p>
<p>And, as expected,</p>
<p><code><![CDATA[
 <Data xsi:type="xs:short">10000000</Data>
]]></code></p>
<p>fails, where <a href="http://www.w3.org/2001/03/webdata/xsv">XSV</a> returns the following:</p>
<p><code><![CDATA[
 <invalid char="1" code="cvc-complex-type.1.2.2" line="61" resource="file:///datalog.ruleml">
  element content failed type check: 10000000>32767
 </invalid>]]></code></p>
<p>Note that &lt;Data&gt; without an xsi:type attribute allows unrestricted text, as in <a href="http://www.ruleml.org/submission/ruleslite/concretesyntax.html">RuleML Lite</a>, and also that the following namespace
declaration must be included to refer to XSD's built-in datatypes (as present in <a href="http://www.ruleml.org/0.89/exa/datalog.ruleml">datalog.ruleml</a>):</p>
<p><code><![CDATA[
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
]]></code></p>
<p>Finally, note that other terms (e.g. Ind and Var) may only have <i>user-defined</i> types via the existing 'type' attribute.  Ind roughly corresponds to resources in RDF, while Data corresponds with RDF literals.</p>

<p>Mutual exclusion is possible with the new &lt;Mutex&gt; tag, allowable as the first child of the new &lt;Protect&gt; performative (optionally
wrapped by the &lt;warden&gt; role introduced to maintain RuleML's <a href="#Striped Syntax">striped syntax</a>).  A &lt;Mutex&gt; states that it is a
contradiction for a particular pair of literals (known as the "opposers" and denoted by "oppo")
to be inferred, given another optional particular condition (known as the "given", marked up as "mgiv").  For example:</p>
<p><code><![CDATA[
 <Mutex>
   <oppo>
     <And>
       <Hterm>
         <Con>pricediscount</Con>
         <Var>CUST</Var>
         <Var>Y</Var>
       </Hterm>
       <Hterm>
         <Con>pricediscount</Con>
         <Var>CUST</Var>
         <Var>Z</Var>
       </Hterm>
     </And>
   </oppo>
   <mgiv>
     <Neg>
       <Equal>
         <Var>Y</Var>
         <Var>Z</Var>
       </Equal>
     </Neg>
   </mgiv>
 </Mutex>]]></code></p>
<p>See Benjamin Grosof's <a href="http://ebusiness.mit.edu/bgrosof/#gclp-rr-99k">Courteous Logic Programming</a> for more details.</p>

<p>Introduced to Atoms (at hornlog), Cterms and Plex's are an optional positional rest role &lt;repo&gt; and
a slotted rest role &lt;resl&gt;, both of which may only contain a Var or a Plex.  For example:</p>
<p><code><![CDATA[
 <Cterm>
   <Ctor>person</Ctor>
   <Var>who</Var>
   <repo><Var/></repo>
 </Cterm>

 <Cterm>
   <Ctor>person</Ctor>
   <slot><Ind>age</Ind><Var>age</Var></slot>
   <resl><Var>X</Var></resl>
 </Cterm>]]></code></p>
<p>With the new &lt;Skolem&gt; term (available in all sublanguages), RDF blank nodes can be captured as
Skolem individual constants.  For example, POSL's _PeterMillerPC becomes</p>
<p><code><![CDATA[
 <Skolem>PeterMillerPC</Skolem>
]]></code></p>
<p>and Skolem generator '_' becomes</p>
<p><code><![CDATA[
 <Skolem/>
]]></code></p>

<p>Object identifiers (&lt;oid&gt;) are now permitted in all atoms, connectives and quantifiers, now available for the first time
in all instances of And (not just directly under Assert), Or, Naf and Neg.</p>

<p>The 'innerclose' attribute is renamed to 'mapClosure', and an analogous 'mapDirection' attribute is introduced.  The
new naming convention reflects attribute 'mapping' through XML trees as with</p>
<p><code><![CDATA[
 <TypeTag mapAttribute="..."><c1>. . .</c1>. . .<cN>. . .</cN></TypeTag>
]]></code></p>
<p>basically acting like</p>
<p><code><![CDATA[
 <TypeTag><c1 attribute="...">. . .</c1>. . .<cN attribute="...">. . .</cN></TypeTag>
]]></code></p>

<p>Webizing is optionally included in all sublanguages, eliminating the need for the entire 'ur' branch of
the family of languages.  However, bindatalog, bindatagroundlog and bindatagroundfact remain for the time being.  See
the <a href="#Modularization">updated modularization model</a> for a clearer picture.</p>

</section>

<!-- This section will only be introduced as necessary:
<section>
	<header>Revisions</header>
<p>The following revisions have been made:</p>

<p>To precisely reflect the closure conventions of LP, top-level And (directly below Assert), corresponding to "Rulebase" from
previous versions, may no longer have an innerclose attribute with a value of "existential" (only "universal").</p>

<p>New connective "Equivalent" is now permitted below top-level And, as well as within Forall, as syntactic sugar for two converse Implies expressing equivalence. However, to avoid conjunctions etc. in the head, only atomic equivalence is permitted. The  accompanying "torso" role
tag (neutralizing head and body) is also introduced. Equivalent is disallowed in the urcbindatagroundfact sublanguage (along with, as before, Implies).</p>

<p>Under Query, And &amp; Or may now have a closure attribute with a value of "existential" (but not "universal"), reflecting LP's querying closure conventions.</p>

<p>New explicit quantifier "Exists", usable only directly below Query, is introduced.  In addition to the quantified variables, it may contain an And, Or, Atom or a nested Exists.  Exists is disallowed in bindatagroundlog and, by inheritance, urcbindatagroundlog (along with Forall, as before).</p>

</section>
-->

<section>
<header>Striped Syntax</header>
<p>There are two kinds tags in RuleML: method-like 'role' tags and class-like 'type' tags.  The two are easily
distinguished by their initial letter, much like the convention used in Java: role tags start with a lower-case
letter, whereas type tags start with an upper-case letter.  For example, &lt;head&gt; is a role tag and
&lt;Ind&gt; is a type tag.</p>
<p>Furthermore, type and role tags alternate in RuleML.  For example, notice the alternation in this a fact
asserting that John sells XMLBible to Mary:</p>
<p><code><![CDATA[
 <Atom>
   <opr>
     <Rel>sell</Rel>
   </opr>
   <arg index="1">
     <Ind>John</Ind>
   </arg>
   <arg index="2">
     <Ind>Mary</Ind>
   </arg>
   <arg index="3">
     <Ind>XMLBible</Ind>
   </arg>
 </Atom>
]]></code></p>
<p>This is known as the "striped syntax" of RuleML, and is important for compatibility with RDF.
Because this is quite verbose, all role tags can also be skipped (in the spirit of Sandro Hawke's 
<a href="http://esw.w3.org/topic/StripeSkipping">StripeSkipping</a>), leaving a more compact form. 
For example, the above fact can be shortened to:</p>

<p><code><![CDATA[
 <Atom>
   <Rel>sell</Rel>
   <Ind>John</Ind>
   <Ind>Mary</Ind>
   <Ind>XMLBible</Ind>
 </Atom>
]]></code></p>

<p>Note that there is no loss of information, because all role tags can be reconstructed based on the
remaining type tags.  In fact, this reconstruction (from the latter positional form to the former slotted form) can be done automatically via XSLT, as with the
<a href="http://www.ruleml.org/0.88/#XSLT-Based%20Normalizer">Normalizer</a> in 0.88.</p>
<p>This gives the syntax of RuleML a lot of flexibility because it allows either a compact or expanded form 
(or any combination thereof), where the compact form is more user-friendly and the expanded (normalized)
form is more compatible with other languages.</p>
</section>


<section>
		<header>Modularization</header>
		<p>The most current model of the modularization of RuleML is available at <a href="http://www.ruleml.org/modularization/#Model">http://www.ruleml.org/modularization/#Model</a>.</p>
		<p>The <a href="http://www.ruleml.org/ruleml-krdtd/sld012.htm">modularization used for
		   Versions 0.7 and 0.8</a> was inverted in <a href="../0.85/Inheritance_diagram.gif">RuleML 0.85</a>
		   to be more intuitive.  The motivating factors behind this switch were
		   simplicity (a single root with two distinct branches), consistency (inheritance in a single
		   direction, for obvious super/subclass relationships) and efficiency (non-redundant
		   implementation).</p>
		   		   
       <p>However, a
		   <a href="http://www.ruleml.org/modularization/#Motivation">limitation within XML Schema</a>
		   prevented this approach from being easily implemented (resulting in the unstable XSDs in
		   0.85), so the modularization was <a href="http://www.ruleml.org/modularization">re-analyzed</a>.  This
		   updated model reflects both the -- now <a href="#Validation">fully-validating</a> -- (XSD)
		   implementation and expressiveness layering of RuleML, simultaneously capturing both the abstract and concrete.
		</p>
	</section>

	<section>
		<header>Content Model-Based Approach</header>
		<p>DTDs have limited support for modularity, but it can be achieved in a roundabout
		   way using macro-like parameter entities. In particular, the contents of an external
		   file can be included using an externally-linked parameter entity. For example, the
		   following includes the contents of
		   <a href="http://www.ruleml.org/0.85/dtd/datalog.dtd">datalog.dtd</a>:</p>
		
		<p>
<code>
<![CDATA[<!ENTITY % datalog_include SYSTEM "datalog.dtd">
%datalog_include;]]>
</code>
		</p>
		
		<p>Simple inclusion is not enough, though: overriding is also necessary. Previously,
		   this was managed using INCLUDE/IGNORE sections: the section that declared the element
		   which had to be changed was simply IGNOREd, then the element was re-declared.</p>
		
		<p>In version 0.85, this clumsy method of overriding was replaced with a much more elegent solution
		wherein every element's content model was explicitly defined by a parameter entity. The rulebase label
		   '_rbaselab' (now 'oid'), for example, became declared as follows:</p>
		<p>
<code><![CDATA[<!ENTITY % _rbaselab.content "(ind)"> 
<!ELEMENT _rbaselab %_rbaselab.content;>]]>
</code>

		</p>
		<p>Since parameter entities can overwrite one another (even across files), this
		   content model could be easily replaced with another specified in a different DTD altogether,
		   much like re-assigning a global variable in traditional programming languages. For example,
		   the content model of the rulebase label '_rbaselab' is just "(ind)" in
		   <a href="http://www.ruleml.org/0.85/dtd/urcbindatagroundfact.dtd">urcbindatagroundfact.dtd</a>
		   (as above), but was extended to permit a complex term (thus, becoming "(ind | cterm)") in
		   <a href="http://www.ruleml.org/0.85/dtd/hornlog.dtd">hornlog.dtd</a>:</p>
		<p>
<code><![CDATA[<!ENTITY % _rbaselab.content "(ind | cterm)">]]></code>
		</p>
		<p>(Note that this overriding entity must be defined before the inclusion of other files.)</p>
		<p>A visual demonstration of this process can be found on slide 25 of the
		   <a href="../0.85/ooruleml-remodularized_schematized.ppt">Object-Oriented RuleML: Re-Modularized
		      and XML Schematized via Content Models</a> presentation.</p>
		<p>The content model-based approach to modularization also works for XML Schema, using groups
		   (and attributeGroups) instead of parameter entities. For example (now using 0.88 syntax, where '_rbaselab' is now 'oid'),</p>
		<p>
<code><![CDATA[<!ENTITY % oid.content "(ind)"> 
<!ELEMENT oid % oid.content;>]]>
</code>
		</p>
		<p>becomes</p>
		<p>
<code><![CDATA[<xs:attributeGroup name="oid.attlist"/>
<xs:group name="oid.content">
  <xs:choice>
    <xs:element name="Ind" type="Ind-oid.type"/>
  </xs:choice>
</xs:group>
<xs:complexType name="oid.type">
  <xs:group ref="oid.content"/>
  <xs:attributeGroup ref="oid.attlist"/>
</xs:complexType>
<xs:element name="oid" type="oid.type"/>]]>
</code>
		</p>
		<p>There is no need for workarounds in XSD: <tt>&lt;redefine&gt;</tt> makes the specified
		changes and includes everything else.  For example,</p>
		<p>
<code><![CDATA[<!ENTITY % oid.content "(ind | cterm)">

<!ENTITY % include SYSTEM "datalog.dtd">
%include;]]>
</code>
		</p>
		<p>becomes</p>
		<p>
<code><![CDATA[<xs:redefine schemaLocation="datalog.xsd">
  <xs:group name="oid.content">
    <xs:choice>
      <xs:group ref="oid.content"/>
      <xs:element ref="Cterm"/>
    </xs:choice>
  </xs:group>
</xs:redefine>]]>
</code>
		</p>
	</section>

<section>
	<header>XSDs</header>
	<p>A stable <a href="xsd/">XML Schema representation</a> of RuleML version 0.89 has been created using an
	<a href="#Content Model-Based Approach">approach</a> that is consistent with that used in the (version
	0.85) <a href="http://www.ruleml.org/0.85/dtd">DTDs</a>.</p>
</section>

<section>
	<header>Examples</header>
	<p>Numerous sample RuleML documents have been prepared and maintained as examples and for testing purposes.  They
	are stored in the <a href="exa/">Examples directory</a>.  (Examples from previous versions of RuleML are also maintained, e.g.
	<a href="http://www.ruleml.org/0.88/exa/">0.88 examples</a>).  <!--Note that additional examples taken from the
	<a href="http://www.ruleml.org/fol/">First-Order Logic RuleML</a> document have been added in 0.88: 
	<a href="exa/appendix1a.ruleml">appendix1a.ruleml</a>, <a href="exa/appendix1b.ruleml">appendix1b.ruleml</a> and 
	<a href="exa/appendix2b.ruleml">appendix2b.ruleml</a>.--></p>
</section>

<section>
	<header>XSLT-Based Upgrader</header>
	<p>Continuing the practice begun in <a href="http://www.ruleml.org/0.86">0.86</a>, an XSLT stylesheet named
	<a href="xslt/upgrader/088-to-089.xslt">088-to-089.xslt</a> has been created to
	automatically update RuleML 0.88 documents to 0.89.  For instance,
	taking the <a href="xslt/upgrader/own-088.ruleml">own example from 0.88</a> as input, the stylesheet outputs
	the following: <a href="xslt/upgrader/own-089.ruleml">own-089.ruleml</a>. 
	(See a <a href="xslt/upgrader/own-diff.htm">comparison of these two files</a> generated using
	<a href="http://www.componentsoftware.com/products/htmldiff/">HTML Diff</a>, noting that the differences are minor since
0.89 mostly builds on top of 0.88.)  Additional translation
	output samples are found in the <a href="xslt/upgrader/">Upgrader</a> directory.</p>
	<p>An XSLT processor which may be used to perform these transformations on a whole directory at once is 
	<a href="http://www.saxonica.com/">Saxon</a>, using the following command:</p>
<p><code><![CDATA[   $ java net.sf.saxon.Transform -o 0.89/exa/ 0.88/exa/ 088-to-0.89.xslt]]></code></p>
	
	<p>The stylesheet has also been tested
	using <a href="http://www.altova.com/products_ide.html">XML Spy</a> (version 2005 sp3).</p>
</section>

<section>
	<header>XSLT-Based Normalizer</header>
	<p>An XSLT stylesheet has been developed (<a href="http://www.ruleml.org/0.89/xslt/normalizer/089_normalizer.xslt">089_normalizer.xslt</a>) for normalizing the syntax used in a given RuleML 0.89 instance, reconstructing
	all skipped role tags to be in a fully-expanded, normal form.  For example, the <a href="xslt/normalizer/own_compact.ruleml">compact version of the 'own' example</a>,</p>

<p><code><![CDATA[
<Assert>
  <And mapClosure="universal">
    <Implies>
      <And>
        <Atom>
          <Rel>buy</Rel>
          <Var>person</Var>
          <Var>merchant</Var>
          <Var>object</Var>
        </Atom>
        <Atom>
          <Rel>keep</Rel>
          <Var>person</Var>
          <Var>object</Var>
        </Atom>
      </And>
      <Atom>
        <Rel>own</Rel>
        <Var>person</Var>
        <Var>object</Var>
      </Atom>
    </Implies>
    ...
    <Atom>
      <Rel>keep</Rel>
      <Ind>Mary</Ind>
      <Ind>XMLBible</Ind>
    </Atom>
  </And>
</Assert>]]></code></p>
<p>is normalized to the <a href="xslt/normalizer/own_compact-normalized.ruleml">expanded version</a>:</p>
<p><code><![CDATA[
<Assert>
  <content>
    <And innerclose="universal">
      <formula>
        <Implies>
          <body>
            <And>
              <formula>
                <Atom>
                  <opr><Rel>buy</Rel></opr>
                  <arg index="1"><Var>person</Var></arg>
                  <arg index="2"><Var>merchant</Var>	</arg>
                  <arg index="3"><Var>object</Var></arg>
                </Atom>
              </formula>
              <formula>
                <Atom>
                  <opr><Rel>keep</Rel></opr>
                  <arg index="1"><Var>person</Var></arg>
                  <arg index="2"><Var>object</Var></arg>
                </Atom>
              </formula>
            </And>
          </body>
          <head>
            <Atom>
              <opr><Rel>own</Rel></opr>
              <arg index="1"><Var>person</Var></arg>
              <arg index="2"><Var>object</Var></arg>
            </Atom>
          </head>
        </Implies>
      </formula>
      ...
      <formula>
        <Atom>
          <opr><Rel>keep</Rel></opr>
          <arg index="1"><Ind>Mary</Ind></arg>
          <arg index="2"><Ind>XMLBible</Ind></arg>
        </Atom>
      </formula>
    </And>
  </content>
</Assert>]]></code></p>
<p>(See a <a href="xslt/normalizer/own_compact-diff.htm">comparison of these two files</a> generated using
	<a href="http://www.componentsoftware.com/products/htmldiff/">HTML Diff</a>.)</p>
<p>Additional examples are located in the <a href="xslt/normalizer/">Normalizer</a> directory.</p>

</section>

<section>
	<header>Validation</header>
	<p>To ensure validation stability, the <a href="xsd/">0.89 XSDs</a> are
	tested (using corresponding <a href="exa/">instance documents/examples</a>)
	with a selection of the most reliable validators. A summary of these validation results follows:</p>
	
	<p><a href="http://www.w3.org/2001/03/webdata/xsv">W3C XML Schema Validator (XSV)</a> <small>v 2.10-1</small><br />
	All examples and schemas validate perfectly except for the binary sublanguages due to a <a href="http://lists.w3.org/Archives/Public/xmlschema-dev/2005Feb/0046.html">known bug</a> introduced since 2.7-1.  <!-- See <a href="#Appendix 3">Appendix 3</a> for instructions on validating an example against its XML Schema and the corresponding output.--></p>

	<!--<p><a href="http://www.altova.com/products_ide.html">Altova XMLSpy</a> <small>v 2005 sp2</small><br />
	All examples and schemas validate perfectly.</p>-->
   
   <p><a href="http://www.saxonica.com">Saxon</a> <small>v SA 8.4</small><br />
   All examples and schemas validate perfectly. Sample output:</p>
	<p><code><![CDATA[ java com.saxonica.Validate -t http://www.ruleml.org/0.89/exa/own.ruleml
 Saxon-SA 8.4 from Saxonica
 Java version 1.5.0_03
 Processing http://www.ruleml.org/0.89/exa/own.ruleml
 Loading schema document http://www.ruleml.org/0.89/xsd/datalog.xsd
 Loading schema document http://www.ruleml.org/0.89/xsd/modules/performative_module.xsd
 Finished loading schema document http://www.ruleml.org/0.89/xsd/modules/performative_module.xsd
 Loading schema document http://www.ruleml.org/0.89/xsd/modules/desc_module.xsd
 Finished loading schema document http://www.ruleml.org/0.89/xsd/modules/desc_module.xsd
 Loading schema document http://www.ruleml.org/0.89/xsd/modules/quantifier_module.xsd
 Finished loading schema document http://www.ruleml.org/0.89/xsd/modules/quantifier_module.xsd
 Loading schema document http://www.ruleml.org/0.89/xsd/modules/connective_module.xsd
 Finished loading schema document http://www.ruleml.org/0.89/xsd/modules/connective_module.xsd
 Loading schema document http://www.ruleml.org/0.89/xsd/modules/atom_module.xsd
 Finished loading schema document http://www.ruleml.org/0.89/xsd/modules/atom_module.xsd
 Loading schema document http://www.ruleml.org/0.89/xsd/modules/slot_module.xsd
 Finished loading schema document http://www.ruleml.org/0.89/xsd/modules/slot_module.xsd
 Loading schema document http://www.ruleml.org/0.89/xsd/modules/term_module.xsd
 Finished loading schema document http://www.ruleml.org/0.89/xsd/modules/term_module.xsd
 Loading schema document http://www.ruleml.org/0.89/xsd/modules/ur_module.xsd
 Finished loading schema document http://www.ruleml.org/0.89/xsd/modules/ur_module.xsd
 Finished loading schema document http://www.ruleml.org/0.89/xsd/datalog.xsd
 Execution time: 1022 milliseconds]]></code></p>
</section>

<!-- TBD:
<section>
	<header>Future Work</header>
	<itemize>
		<item>production rules, reaction rules, transformation rules, ... (see the <a href="http://www.ruleml.org/indesign.html">Design</a> section)</item>
		<item>abstract syntax</item>
		<item>glossary of terms</item>
		<item>normal form of Slots used after positional arguments in Atoms</item>
		<item>CLP (Corteous Logic Programs) <tt>overrides</tt> facts (work by Benjamin Grosof, MIT)</item>
	</itemize>
</section>

-->

<section>
<header>Appendix</header>
<p>
Appended below is the XML Schema (version 0.89) for the Datalog
sublanguage of RuleML (<a href="#Appendix 1">Appendix 1</a>).  Also appended
below is a simple example rulebase that conforms to that XSD (<a href="#Appendix 2">Appendix 2</a>), 
and instructions for how to validate the example against the schema 
(<a href="#Appendix 3">Appendix 3</a>).
</p>
<p>
The entire family of 0.89 XSDs, specified in a modular fashion, are available here:
<a href="http://www.ruleml.org/0.89/xsd">http://www.ruleml.org/0.89/xsd</a>.
The XSD files in the main directory represent actual sublanguages of RuleML, whereas
those in the <a href="http://www.ruleml.org/0.89/xsd/modules">modules subdirectory</a>
are elementary components included in the main XSDs.  For more information, see the
<a href="http://www.ruleml.org/modularization/#Model">Modularization</a> section.
</p>
<p>
More sample files -- each referring to the most specific XSD which validates it -- can be
found at <a href="http://www.ruleml.org/0.89/exa">http://www.ruleml.org/0.89/exa</a>.
</p>
</section>

<section label="Appendix 1">
<header>Appendix 1: XSD for a Datalog subset of RuleML</header>
<p>Source: <a href="xsd/datalog.xsd">datalog.xsd</a></p>

<box bgcolor="#FFFFFF"><code><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>

<xs:schema 
xmlns="http://www.ruleml.org/0.89/xsd" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
targetNamespace="http://www.ruleml.org/0.89/xsd"
>

	<xs:annotation>
		<xs:documentation xml:lang="en">
			XML Schema for a Datalog RuleML sublanguage
			File: datalog.xsd
			Version: 0.89
			Last Modification: 2005-05-26
		</xs:documentation>
	</xs:annotation>

	<!--
		Note that datalog is entirely composed of modules and that all other
		schema drivers rely on it, making it the root of the sublanguage family tree.
	-->

	<!--
		Datalog includes the following modules:
		* performative
		* desc
		* quantifier
		* connective
		* atom
		* slot
		* term
		* mutex
		* ur

		For details on each module, including what element and/or attribute declarations
		they contain, please refer to them individually.
	-->

	<xs:include schemaLocation="modules/performative_module.xsd"/>
	<xs:include schemaLocation="modules/desc_module.xsd"/>
	<xs:include schemaLocation="modules/quantifier_module.xsd"/>
	<xs:include schemaLocation="modules/connective_module.xsd"/>
	<xs:include schemaLocation="modules/atom_module.xsd"/>
	<xs:include schemaLocation="modules/slot_module.xsd"/>
	<xs:include schemaLocation="modules/term_module.xsd"/>
	<xs:include schemaLocation="modules/mutex_module.xsd"/>
	<xs:include schemaLocation="modules/ur_module.xsd"/>

</xs:schema>]]></code></box>
</section>

<section label="Appendix 2">
<header>Appendix 2:  Example rulebase in RuleML</header>
<p>Source: <a href="exa/own.ruleml">own.ruleml</a></p>
<box bgcolor="#FFFFFF"><code><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>

<Assert
xmlns="http://www.ruleml.org/0.89/xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ruleml.org/0.89/xsd http://www.ruleml.org/0.89/xsd/datalog.xsd">

<!-- start XML comment ...

This example rulebase contains four rules.
The first and second rules are implications; the third and fourth ones are facts.

In English:

The first rule implies that a person owns an object
if that person buys the object from a merchant and the person keeps the object.

As an OrdLab Tree:

Implies~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          *                         *
     head *                    body *
          *                         *
        Atom~~~~~~~~~~~~~~~~~~     And~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                 *     |     |           |                                   |
             opr *     |     |           |                                   |
                 *     |     |           |                                   |        
                Rel   Var   Var        Atom~~~~~~~~~~~~~~~~~~~~~~~~~~~     Atom~~~~~~~~~~~~~~~~~~
                 .     .     .                  *     |      |       |              *     |     |
                 .     .     .              opr *     |      |       |          opr *     |     |
                 .     .     .                  *     |      |       |              *     |     |
                own  person object             Rel   Var    Var     Var            Rel   Var   Var
                                                .     .      .       .              .     .     . 
                                                .     .      .       .              .     .     .
                                                .     .      .       .              .     .     .
                                               buy  person merchant object        keep  person object

... end XML comment -->

<And mapClosure="universal">

<Implies>
  <head>
    <Atom>
      <opr><Rel>own</Rel></opr>
      <Var>person</Var>
      <Var>object</Var>
    </Atom>
  </head>
  <body>
    <!-- explicit 'And' -->
    <And>
      <Atom>
        <opr><Rel>buy</Rel></opr>
        <Var>person</Var>
        <Var>merchant</Var>
        <Var>object</Var>
      </Atom>
      <Atom>
        <opr><Rel>keep</Rel></opr>
        <Var>person</Var>
        <Var>object</Var>
      </Atom>
    </And>
  </body>
</Implies>

<!-- The second rule implies that a person buys an object from a merchant
if the merchant sells the object to the person. -->

<Implies>
  <head>
    <Atom>
      <opr><Rel>buy</Rel></opr>
      <Var>person</Var>
      <Var>merchant</Var>
      <Var>object</Var>
    </Atom>
  </head>
  <body>
    <Atom>
      <opr><Rel>sell</Rel></opr>
      <Var>merchant</Var>
      <Var>person</Var>
      <Var>object</Var>
    </Atom>
  </body>
</Implies>
 
<!-- The third rule is a fact that asserts that
John sells XMLBible to Mary. -->
 
    <Atom>
      <opr><Rel>sell</Rel></opr>
      <Ind>John</Ind>
      <Ind>Mary</Ind>
      <Ind>XMLBible</Ind>
    </Atom>

<!-- The fourth rule is a fact that asserts that
Mary keeps XMLBible.
 
Observe that this fact is binary - i.e., there are two arguments
for the relation. RDF viewed as a logical knowledge representation
is, likewise, binary, although its arguments have type restrictions,
e.g., the first must be a resource (basically, a URI). Some of the
DTD's on the RuleML website handle URL's/URI's (UR's); see especially
urc-datalog.dtd for inferencing with RDF-like facts -->
 
    <Atom>
      <opr><Rel>keep</Rel></opr>
      <Ind>Mary</Ind>
      <Ind>XMLBible</Ind>
    </Atom>

</And>
  
</Assert>]]></code></box>
</section>

<section label="Appendix 3">
<header>Appendix 3:  Instructions on validating the example against the XSD</header>
<box bgcolor="#FFFFFF"><code><![CDATA[
Validating a RuleML 0.88 Sample Document: own.ruleml
====================================================

1. Direct your browser to ]]></code><a href="http://www.w3.org/2001/03/webdata/xsv">http://www.w3.org/2001/03/webdata/xsv</a>
<code><![CDATA[(Validator for XML Schema REC (20010502) version, as amended).

2. Enter the following URL of our example RuleML file (or any other) into the textfield
preceded by "Address(es)": http://www.ruleml.org/0.89/exa/own.ruleml

3. If desired, check the "Show Warnings" box.

4. Click the "Get Results" button.

Note: The validation may take a while, and may require a full
refresh when re-validating to avoid caching.

Also note: Depending on your browser, you may want to select a different
output using the radio buttons just above the "Get Results" button.

***
 
You should get the following output (using the default output):]]></code>

		<h3>Schema validating with XSV 2.10-1 of 2005/04/22 13:10:49</h3>
		<ul>
			<li><b>Target</b>: <tt>http://www.ruleml.org/0.89/exa/own.ruleml</tt><br/>   (Real name: http://www.ruleml.org/0.89/exa/own.ruleml<br/>    Length: 3817 bytes
 <br/>    Last Modified: Wed, 25 May 2005 18:42:42 GMT<br/>    Server: Apache/1.3.27 (Unix)  (Red-Hat/Linux) mod_fastcgi/2.4.2 mod_ssl/2.8.12 OpenSSL/0.9.6b DAV/1.0.3 PHP/4.1.2 mod_perl/1.26)</li>
			<li><b>docElt</b>: <tt>{http://www.ruleml.org/0.89/xsd}Assert</tt></li>
			<li>Validation was strict, starting with type <tt>{http://www.ruleml.org/0.89/xsd}:Assert.type</tt></li>
			<li><b>schemaLocs</b>: http://www.ruleml.org/0.89/xsd -&gt; http://www.ruleml.org/0.89/xsd/datalog.xsd</li>
			<li>The schema(s) used for schema-validation had no errors</li>
			<li>No schema-validity problems were found in the target </li>
		</ul>
		<hr/>
		<h3>Schema resources involved</h3>
		<p style="margin-bottom: 0px">Attempt to load a schema document from
<tt>http://www.ruleml.org/0.89/xsd/datalog.xsd</tt>
 (source: <tt>schemaLoc</tt>) for
   <tt>http://www.ruleml.org/0.89/xsd</tt>,
    succeeded</p>
		<p style="margin-bottom: 0px">Attempt to load a schema document from
<tt>http://www.ruleml.org/0.89/xsd/modules/performative_module.xsd</tt>
 (source: <tt>include</tt>) for
   <tt>http://www.ruleml.org/0.89/xsd</tt>,
    succeeded</p>
		<p style="margin-bottom: 0px">Attempt to load a schema document from
<tt>http://www.ruleml.org/0.89/xsd/modules/desc_module.xsd</tt>
 (source: <tt>include</tt>) for
   <tt>http://www.ruleml.org/0.89/xsd</tt>,
    succeeded</p>
		<p style="margin-bottom: 0px">Attempt to load a schema document from
<tt>http://www.ruleml.org/0.89/xsd/modules/quantifier_module.xsd</tt>
 (source: <tt>include</tt>) for
   <tt>http://www.ruleml.org/0.89/xsd</tt>,
    succeeded</p>
		<p style="margin-bottom: 0px">Attempt to load a schema document from
<tt>http://www.ruleml.org/0.89/xsd/modules/connective_module.xsd</tt>
 (source: <tt>include</tt>) for
   <tt>http://www.ruleml.org/0.89/xsd</tt>,
    succeeded</p>
		<p style="margin-bottom: 0px">Attempt to load a schema document from
<tt>http://www.ruleml.org/0.89/xsd/modules/atom_module.xsd</tt>
 (source: <tt>include</tt>) for
   <tt>http://www.ruleml.org/0.89/xsd</tt>,
    succeeded</p>
		<p style="margin-bottom: 0px">Attempt to load a schema document from
<tt>http://www.ruleml.org/0.89/xsd/modules/slot_module.xsd</tt>
 (source: <tt>include</tt>) for
   <tt>http://www.ruleml.org/0.89/xsd</tt>,
    succeeded</p>
		<p style="margin-bottom: 0px">Attempt to load a schema document from
<tt>http://www.ruleml.org/0.89/xsd/modules/term_module.xsd</tt>
 (source: <tt>include</tt>) for
   <tt>http://www.ruleml.org/0.89/xsd</tt>,
    succeeded</p>
		<p style="margin-bottom: 0px">Attempt to load a schema document from
<tt>http://www.ruleml.org/0.89/xsd/modules/mutex_module.xsd</tt>
 (source: <tt>include</tt>) for
   <tt>http://www.ruleml.org/0.89/xsd</tt>,
    succeeded</p>
		<p style="margin-bottom: 0px">Attempt to load a schema document from
<tt>http://www.ruleml.org/0.89/xsd/modules/ur_module.xsd</tt>
 (source: <tt>include</tt>) for
   <tt>http://www.ruleml.org/0.89/xsd</tt>,
    succeeded</p>      
		<hr/>
</box>
</section>

	<closing>
		<p>
		Site Contact:
		<a href="http://www.cs.unb.ca/~boley/">Harold Boley</a>.
		Page Version: 2005-07-14
		
		<br/>
		<br/>
		<br/>
		<a name="Practice-Preach"/>
		<small>"Practice what you preach": XML source of this homepage at <a href="index.xml">index.xml</a> (<a href="index.xml.txt">index.xml.txt</a>);
	      <br/>
	      transformed to HTML via the adaptation of <a href="http://www.dfki.uni-kl.de/~sintek/">Michael Sintek</a>'s SliML <a href="http://www.w3.org/TR/xslt">XSLT</a> stylesheet at <a href="http://www.dfki.uni-kl.de/~boley/xslt/homepage.xsl">homepage.xsl</a> (View | Page Source)
	   </small>
		</p>
	</closing>

</homepage>

