<?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.87</title>

	<opening>
		<center>
			<br/>
			<br/>
			<h1>Schema Specification of RuleML 0.87</h1>
			<h2>
				David Hirtle,
				<a href="http://www.cs.unb.ca/~boley/">Harold Boley</a>, 
				<a href="http://centria.di.fct.unl.pt/~cd/index.en.html">Carlos Damasio</a>,
				<a href="http://ebusiness.mit.edu/bgrosof/">Benjamin Grosof</a>,<br />
				<a href="http://www.cs.sunysb.edu/~kifer">Michael Kifer</a>,
				<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>
			<h4>Version History, 2001-01-25: <a href="http://www.ruleml.org/indtd.html">Version 0.7</a></h4>
			<br/>
			<h4>Version History, 2001-07-11: <a href="http://www.ruleml.org/indtd0.8.html">Version 0.8</a></h4>
			<br/>
			<h4>Version History, 2003-12-09: <a href="http://www.ruleml.org/0.85/">Version 0.85</a></h4>
			<br />
			<h4>Version History, 2004-06-23: <a href="http://www.ruleml.org/0.86/">Version 0.86</a></h4>
			<br />
			<h3>Version History, 2004-08-12: <a href="http://www.ruleml.org/0.87/">Version 0.87</a></h3>			
			<h2>Latest version: <a href="http://www.ruleml.org/spec/">www.ruleml.org/spec</a></h2>
			<h4>Archived DTDs: <a href="http://www.ruleml.org/0.85/dtd">0.85 DTD Directory</a></h4>
			<h2>All Schemas: <a href="http://www.ruleml.org/0.87/xsd">XSD Directory</a></h2>
			<h2>Some Examples: <a href="http://www.ruleml.org/0.87/exa">Examples Directory</a></h2>
			<h2>Stylesheet: <a href="http://www.ruleml.org/0.87/xslt">XSLT Directory</a></h2>
		</center>
		<br/>
		
		<p>This is a revised XML Schema specification for RuleML version 0.87. Building upon the validation
		   stable <a href="http://www.ruleml.org/0.86">RuleML 0.86</a>, this release incorporates several
		   design changes in preparation for envisioned extensions such as the accommodation of Frame Logic
		   (F-logic) slot-name variables and <a href="http://www.ruleml.org/fol/">First-Order-Logic RuleML</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 will no longer be maintained,
		   but will continue to be <a href="http://www.ruleml.org/0.85/dtd">available as an archive</a>.
		</p>
	</opening>

<section>
	<header>Overview</header>
   <p>
   The upper layer of the RuleML hierarchy of rules is discussed in our
   main page's <a href="http://www.ruleml.org/index.html#Design">design section</a>.
   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
   simple objects. 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>Version 0.87 incorporates the following changes:</p>
	
	<itemize>
		<item>Java-style case-distinguished Type/role tags (instead of an underscore prefix for roles)</item>
		<item>slot name as a subelement instead of an attribute (with slot changed to a type, hence 'Slot')</item>
		<item>variables and complex terms as slot names</item>
		<item>"reconstructable role tags" simultaneously permitting both compact and expansion to RDF-like syntax</item>
	</itemize>
	
	<p>For more information, see the <a href="#Changes">Changes</a> section.  A presentation summarizing this
release is also available: <a href="ruleml_087.ppt">PPT</a>, <a href="ruleml_087.pdf">PDF</a>.</p>
	<p>Note that there are currently no plans to continue maintaining a DTD specification of RuleML,
	   and as such the <a href="http://www.ruleml.org/0.85/dtd">0.85 DTDs</a> are expected to
	   be the last. As always, the DTDs etc. of previous versions (including 0.85) will remain
	   untouched, and can be considered as languages by themselves.  (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>

</section>     

	<section>
		<header>Changes</header>		
<p>
Since <a href="http://www.ruleml.org/indtd0.8.html#Overview">RuleML 0.8</a> we have marked up 'role' tags
via a "<tt>_</tt>"-prefix and have left 'type' tags unprefixed.
Already at that time we also considered the convention Java uses for a similar distinction:
having method-like 'role' tags start with a lower-case letter,
and having class-like 'type' tags start with an upper-case letter.
Such a Java convention is now proposed for RuleML 0.9 and so is being introduced now in version 0.87.
</p>
<p>
Specifically, the type/role tag syntax is changed as follows:
<br/> <br/>

        <table border="1" cellpadding="3">
            <tr align="center">
                <td>
                    <b>Old (Principle)</b>
                </td>
                <td>
                    <b>New (Principle)</b>
                </td>
            </tr>
            <tr align="center">
                <td>type</td>
                <td>Type</td>
            </tr>
	    <tr align="center">
                <td>_role</td>
                <td>role</td>
            </tr>
            <tr align="center">
                <td>
                    <b>Old (Examples)</b>
                </td>
                <td>
                    <b>New (Examples)</b>
                </td>
            </tr>
            <tr align="center">
                <td>imp</td>
                <td>Imp</td>
            </tr>
	    <tr align="center">
                <td>_head</td>
                <td>head</td>
            </tr>
	    <tr align="center">
                <td>...</td>
                <td>...</td>
            </tr>
        </table>
</p>

   <p>Another change is that slot names are now subelements instead of attributes to accommodate F-logic.  This means that slot is now a type tag (so, with the new naming convention, capitalized 'Slot') to accommodate the alternating type/role "striped syntax" (see below).  A non-positional metarole tag, 'role', is introduced as a substitute (see role tag reconstruction discussion below).  For example,</p>
	<p>
<code><![CDATA[<Atom>
   ...
   <slot name="color"><Ind>blue</Ind></slot>
   ...
</Atom>]]></code></p>
	<p>becomes</p>
	<p>
<code><![CDATA[<Atom>
   ...
   <role>
      <Slot>
         <name><Ind>color</Ind></name>
         <filler><Ind>blue</Ind></filler>
      </Slot>
   </role>
   ...
</Atom>]]></code></p>
	<p>where the role tags ('role', 'name' and 'filler') may be omitted, leaving just the type tags:</p>
	<p>
<code><![CDATA[<Atom>
   ...
   <Slot><Ind>color</Ind><Ind>blue</Ind></Slot>
   ...
</Atom>]]></code></p>
	<p>Note that these roles can always be reconstructed if the shorter, type-only syntax is used.</p>
	<p>In fact, in the spirit of Sandro Hawke's <a href="http://esw.w3.org/topic/StripeSkipping">StripeSkipping</a>, such "reconstructable role tags" are now 	systematically incorporated into the syntax, thus allowing either compact or expanded forms (or any combination thereof) as introduced with Slots above
	and further exemplified below.</p>
	
	 <p>Compact (from <a href="exa/own_compact.ruleml">own_compact.ruleml)</a>:</p>
	<p>
<code><![CDATA[<Rulebase>
   ...
   <Fact>
     <Atom>
       <Rel>keep</Rel>
       <Ind>Mary</Ind>
       <Ind>XMLBible</Ind>
     </Atom>
   </Fact>
   ...
</Rulebase>]]></code></p>	 

	 <p>Expanded (from <a href="exa/own_expanded.ruleml">own_expanded.ruleml)</a>:</p>
	<p>
<code><![CDATA[<Rulebase>
   ...
   <clause>
      <Fact>
         <head>
	     <Atom>
	        <opr><Rel>keep</Rel></opr>
	        <arg index="1"><Ind>Mary</Ind></arg>
	        <arg index="2"><Ind>XMLBible</Ind></arg>
	     </Atom>
	  </head>
      </Fact>
   </clause>
   ...
</Rulebase>]]></code></p>

<p>Note the introduction of the optional 'clause' role (for Facts, Imps and Queries under a Rulebase) and the optional 'arg' role (for positional arguments within an Atom).  Also optionally introduced are 'role', as shown previously for Slots; 'side' for Eqs; 'wff' (well-formed formula) for And and Or; and 'strong' and 'weak' for Neg and Naf, respectively.  These additional tags make the striped syntax of RuleML fully consistent (which is important for compatibility with RDF), while maintaining (even increasing) the level of user friendliness of the syntax by encouraging a more compact (type-only) form.</p>
	
<p>To further accommodate F-Logic, variables and complex terms may now also be used as slot names (in addition to the usual 'ind').</p>
<p>All <a href="exa/">examples</a> from previous versions of RuleML have been updated to reflect these design changes 
using Extensible Stylesheet Language Transformations (XSLT).  (See the <a href="#XSLT">XSLT</a> section
for more information.)  The <a href="xsd/">XSDs</a> have also been updated based on these changes.
</p>
 
	</section>

	<section>
		<header>Modularization</header>
		
		<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>
		   and a <a href="http://www.ruleml.org/modularization/#Model">new model</a> resulted.  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 is explicitly defined by a parameter entity. The metarole
		   '_slot', for example became declared as follows:</p>
		<p>
<code><![CDATA[<!ENTITY % _slot.content "(ind)"> 
<!ELEMENT _slot %_slot.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 metarole '_slot' is just "(ind)" in
		   <a href="http://www.ruleml.org/0.85/dtd/urcbindatagroundfact.dtd">urcbindatagroundfact.dtd</a>
		   (as above), but is extended to permit a  variable (thus, becoming "(ind | var)") in
		   <a href="http://www.ruleml.org/0.85/dtd/urcbindatalog.dtd">urcbindatalog.dtd</a>:</p>
		<p>
<code><![CDATA[<!ENTITY % _slot.content "(ind | var)">]]></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.87 syntax),</p>
		<p>
<code><![CDATA[<!ENTITY % slot.content "(Ind)"> 
<!ELEMENT slot %slot.content;>]]>
</code>
		</p>
		<p>becomes</p>
		<p>
<code><![CDATA[<xs:attributeGroup name="slot.attlist"/>
<xs:group name="slot.content">
   <xs:sequence>
      <xs:element ref="Ind"/>
   </xs:sequence>
</xs:group>
<xs:complexType name="slot.type" mixed="true">
   <xs:group ref="slot.content"/>
   <xs:attributeGroup ref="slot.attlist"/>
</xs:complexType>
<xs:element name="slot" type="slot.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 % slot.content "(Ind | Var)">

<!ENTITY % include SYSTEM "urcbindatagroundlog.dtd">
%include;]]>
</code>
		</p>
		<p>becomes</p>
		<p>
<code><![CDATA[<xs:redefine schemaLocation="urcbindatagroundlog.xsd">
   <xs:group name="slot.content">
      <xs:choice>
         <xs:group ref="slot.content"/>
         <xs:element ref="Var"/>
      </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.87 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>XSLT</header>
	<p>An XSLT stylesheet named <a href="xslt/086-to-087.xslt">086-to-087.xslt</a> has been created to
	automatically update RuleML 0.86 documents to 0.87.  This stylesheet has already been used to update all <a href="exa/">examples</a>.  For instance,
	taking the <a href="xslt/own-086.ruleml">own example from 0.86</a> as input, the stylesheet outputs
	the following: <a href="xslt/own-087.ruleml">own-087.ruleml</a>. 
	(See a <a href="xslt/own-diff.htm">comparison of these two files</a> generated using
	<a href="http://www.componentsoftware.com/products/htmldiff/">HTML Diff</a>.)</p>
	<p>The XSLT processor used to perform these transformations is 
	<a href="http://www.saxonica.com/">Saxon</a> version SA 8.0 using the following command (affecting
	the whole directory at once):</p>
<p><code><![CDATA[   $ java net.sf.saxon.Transform -o 0.87/exa/ 0.86/exa/ 086-to-0.87.xslt]]></code></p>
	
	<p>The stylesheet has also been tested
	using <a href="http://xml.apache.org/xalan-j/index.html">Xalan-Java</a> (version 2.2).</p>
</section>

<section>
	<header>Validation</header>
	<p>To ensure validation stability, the <a href="xsd/">0.87 XSDs</a> have been
	tested (using corresponding <a href="exa/">instance documents/examples</a>)
	with numerous validators/tools. 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.7-1</small><br />
	All examples and schemas validate perfectly. 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 2004 rel. 4</small><br />
	XMLSpy actually uses two validators: one available in the text/grid view and
	another exclusively in the schema view. The two validators currently may produce different
	results, as happens to be the case with the RuleML 0.87 XSDs.  The "schema" view is preferred
	for validating RuleML schemas; they validate perfectly with the slight modification of commenting
	out self-references as follows:</p>
	<p><code><![CDATA[   <xs:attributeGroup name="Rel.attlist">
      <!-- <xs:attributeGroup ref="Rel.attlist"/> -->
      <xs:attributeGroup ref="href.attrib"/>
   </xs:attributeGroup>]]></code></p>
   
   <p><a href="http://www.saxonica.com">Saxon</a> <small>v SA 8.0</small><br />
   All examples and schemas validate perfectly
   (see <a href="http://lists.w3.org/Archives/Public/xmlschema-dev/2004Jul/0001.html">Michael Kay's confirmation</a>). Sample output:</p>
	<p><code><![CDATA[   $ java com.saxonica.Validate -t http://www.ruleml.org/0.87/exa/own.ruleml
   Saxon-SA 8.0 from Saxonica
   Java version 1.4.1_02
   Processing http://www.ruleml.org/0.87/exa/own.ruleml
   Execution time: 1132 milliseconds]]></code></p>
   
   <p>
   <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=3144b72b-b4f2-46da-b4b6-c5d7485f2b42">MSXML</a>
   <small>v 4.0 DOM &amp; SAX via <a href="http://www.stylusstudio.com/open_xsd_validation.html">Stylus Studio</a> 5.3</small><br />
   All examples validate perfectly.</p>

<p>
<a href="http://xml.apache.org/xerces2-j/index.html">Xerces-J</a> <small>v 2.5.1 via 
   <a href="http://www.stylusstudio.com/open_xsd_validation.html">Stylus Studio</a> 5.3</small><br />
      All examples validate perfectly with the exception of the binary sublanguages.  This is believed to be a bug -- an 
   <a href="http://issues.apache.org/eyebrowse/ReadMsg?listName=xerces-j-dev@xml.apache.org&amp;msgNo=4467">inquiry</a>
   has been sent to the developer mailing list (<a href="http://issues.apache.org/eyebrowse/SummarizeList?listName=xerces-j-dev@xml.apache.org">xerces-j-dev@xml.apache.org</a>).
   </p>

   
</section>

<section>
	<header>Future Work</header>
	<itemize>
		<item>fully compact and fully expanded role tag normal forms (possibly XSLTs between these and earlier "mixed" form)</item>
		<item>normal form of Slots used after positional arguments in Atoms</item>
		<item>first-order logic extensions</item>
		<item>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>possibly merge UR and non-UR sublanguages and omit certain ones</item>
		<item>CLP (Corteous Logic Programs) <tt>overrides</tt> facts (work by Benjamin Grosof, MIT)</item>
		<item>guarded Horn Logic (suggestion of Wolfgang Nejdl, U Hannover)</item>
	</itemize>
</section>

<section>
<header>Appendix</header>
<p>
Appended below is the XML Schema (version 0.87) for a Datalog
subset 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.87 XSDs, specified in a modular fashion, are available here:
<a href="http://www.ruleml.org/0.87/xsd">http://www.ruleml.org/0.87/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.87/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.87/exa">http://www.ruleml.org/0.87/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 
targetNamespace="http://www.ruleml.org/0.87/xsd" 
xmlns="http://www.ruleml.org/0.87/xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>

	<xs:annotation>
		<xs:documentation xml:lang="en">
			XML Schema for a Datalog RuleML sublanguage
			File: datalog.xsd
			Version: 0.87
			Last Modification: 2004-07-23
		</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:
		* toplevel
		* desc
		* clause
		* boole
		* atom
		* role
		* term

		For details on each module, including what element and/or attribute declarations
		they contain, please refer to them individually.
	-->
	<xs:include schemaLocation="modules/toplevel_module.xsd"/>

	<xs:include schemaLocation="modules/desc_module.xsd"/>

	<xs:include schemaLocation="modules/clause_module.xsd"/>

	<xs:include schemaLocation="modules/boole_module.xsd"/>

	<xs:include schemaLocation="modules/atom_module.xsd"/>

	<xs:include schemaLocation="modules/role_module.xsd"/>

	<xs:include schemaLocation="modules/term_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"?>

<Rulebase
 xmlns="http://www.ruleml.org/0.87/xsd"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.ruleml.org/0.87/xsd http://www.ruleml.org/0.87/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:

 imp~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          *                         *
     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 -->

<Imp>
  <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>
</Imp>

<!-- The second rule implies that a person buys an object from a merchant
if the merchant sells the object to the person. -->

<Imp>
  <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>
</Imp> 
 
<!-- The third rule is a fact that asserts that
John sells XMLBible to Mary. -->
 
<Fact>
  <head>
    <Atom>
      <opr><Rel>sell</Rel></opr>
      <Ind>John</Ind>
      <Ind>Mary</Ind>
      <Ind>XMLBible</Ind>
    </Atom>
  </head>
</Fact>
 
<!-- 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 -->
 
<Fact>
  <head>
    <Atom>
      <opr><Rel>keep</Rel></opr>
      <Ind>Mary</Ind>
      <Ind>XMLBible</Ind>
    </Atom>
  </head>
</Fact>
  
</Rulebase>]]></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.87 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).

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.87/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.7-1 of 2004/04/01 13:40:50</h3>
		<ul>
			<li><b>Target</b>: <tt>http://www.ruleml.org/0.87/exa/own.ruleml</tt><br/>   (Real name: http://www.ruleml.org/0.87/exa/own.ruleml<br/>    Length: 3850 bytes
 <br/>    Last Modified: Thu, 24 Jun 2004 18:24:59 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.87/xsd}rulebase</tt></li>
			<li>Validation was strict, starting with type <tt>{http://www.ruleml.org/0.87/xsd}:rulebase.type</tt></li>
			<li><b>schemaLocs</b>: http://www.ruleml.org/0.87/xsd -&gt; http://www.ruleml.org/0.87/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.87/xsd/datalog.xsd</tt>
 (source: <tt>schemaLoc</tt>) for
   <tt>http://www.ruleml.org/0.87/xsd</tt>,
    succeeded</p>
		<p style="margin-bottom: 0px">Attempt to load a schema document from
<tt>http://www.ruleml.org/0.87/xsd/modules/toplevel_module.xsd</tt>
 (source: <tt>include</tt>) for
   <tt>http://www.ruleml.org/0.87/xsd</tt>,
    succeeded</p>
		<p style="margin-bottom: 0px">Attempt to load a schema document from
<tt>http://www.ruleml.org/0.87/xsd/modules/desc_module.xsd</tt>
 (source: <tt>include</tt>) for
   <tt>http://www.ruleml.org/0.87/xsd</tt>,
    succeeded</p>
		<p style="margin-bottom: 0px">Attempt to load a schema document from
<tt>http://www.ruleml.org/0.87/xsd/modules/clause_module.xsd</tt>
 (source: <tt>include</tt>) for
   <tt>http://www.ruleml.org/0.87/xsd</tt>,
    succeeded</p>
		<p style="margin-bottom: 0px">Attempt to load a schema document from
<tt>http://www.ruleml.org/0.87/xsd/modules/boole_module.xsd</tt>
 (source: <tt>include</tt>) for
   <tt>http://www.ruleml.org/0.87/xsd</tt>,
    succeeded</p>
		<p style="margin-bottom: 0px">Attempt to load a schema document from
<tt>http://www.ruleml.org/0.87/xsd/modules/atom_module.xsd</tt>
 (source: <tt>include</tt>) for
   <tt>http://www.ruleml.org/0.87/xsd</tt>,
    succeeded</p>
		<p style="margin-bottom: 0px">Attempt to load a schema document from
<tt>http://www.ruleml.org/0.87/xsd/modules/role_module.xsd</tt>
 (source: <tt>include</tt>) for
   <tt>http://www.ruleml.org/0.87/xsd</tt>,
    succeeded</p>
		<p style="margin-bottom: 0px">Attempt to load a schema document from
<tt>http://www.ruleml.org/0.87/xsd/modules/term_module.xsd</tt>
 (source: <tt>include</tt>) for
   <tt>http://www.ruleml.org/0.87/xsd</tt>,
    succeeded</p>
		<hr/>
</box>
</section>

	<closing>
		<p>
		Site Contact:
		<a href="http://www.cs.unb.ca/~boley/">Harold Boley</a>.
		Page Version: 2004-08-12
		
		<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>

