You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by bu...@apache.org on 2014/07/30 14:24:37 UTC

svn commit: r917936 - in /websites/staging/jena/trunk/content: ./ documentation/inference/index.html

Author: buildbot
Date: Wed Jul 30 12:24:36 2014
New Revision: 917936

Log:
Staging update by buildbot for jena

Modified:
    websites/staging/jena/trunk/content/   (props changed)
    websites/staging/jena/trunk/content/documentation/inference/index.html

Propchange: websites/staging/jena/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Wed Jul 30 12:24:36 2014
@@ -1 +1 @@
-1614627
+1614632

Modified: websites/staging/jena/trunk/content/documentation/inference/index.html
==============================================================================
--- websites/staging/jena/trunk/content/documentation/inference/index.html (original)
+++ websites/staging/jena/trunk/content/documentation/inference/index.html Wed Jul 30 12:24:36 2014
@@ -242,7 +242,7 @@
     - <a href="#tracing">Tracing</a> <br>
   </li>
 </ol></p>
-<h3 id="wzxhzdk161wzxhzdk162generic-reasoner-api"><a name="reasonerAPI"></a>Generic reasoner API</h3>
+<h3 id="reasonerAPI">Generic reasoner API</h3>
 <h4 id="finding-a-reasoner">Finding a reasoner</h4>
 <p><p>For each type of reasoner there is a factory class (which conforms to the interface
   <code><a href="/documentation/javadoc/jena/com/hp/hpl/jena/reasoner/ReasonerFactory.html">ReasonerFactory</a></code>)
@@ -310,37 +310,45 @@
   and <code>Reasoner.supportsProperty</code> are used to access this descriptive
   metadata.</p>
 <p>[<a href="#api">API index</a>] [<a href="#index">main index</a>]</p></p>
-<h3 id="wzxhzdk257wzxhzdk258some-small-examples"><a name="generalExamples"></a>Some small examples</h3>
+<h3 id="generalExamples">Some small examples</h3>
 <p><p>These initial examples are not designed to illustrate the power of the reasoners
   but to illustrate the code required to set one up.</p>
 <p>Let us first create a Jena model containing the statements that some property
   &quot;p&quot; is a subproperty of another property &quot;q&quot; and that we
   have a resource &quot;a&quot; with value &quot;foo&quot; for &quot;p&quot;.
   This could be done by writing an RDF/XML or N3 file and reading that in but
-  we have chosen to use the RDF API:</p>
-<pre>    String NS = "urn:x-hp-jena:eg/";</p>
-<div class="codehilite"><pre><span class="c1">// Build a trivial example data set</span>
-<span class="n">Model</span> <span class="n">rdfsExample</span> <span class="o">=</span> <span class="n">ModelFactory</span><span class="p">.</span><span class="n">createDefaultModel</span><span class="p">();</span>
-<span class="n">Property</span> <span class="n">p</span> <span class="o">=</span> <span class="n">rdfsExample</span><span class="p">.</span><span class="n">createProperty</span><span class="p">(</span><span class="no">NS</span><span class="p">,</span> <span class="s">&quot;p&quot;</span><span class="p">);</span>
-<span class="n">Property</span> <span class="n">q</span> <span class="o">=</span> <span class="n">rdfsExample</span><span class="p">.</span><span class="n">createProperty</span><span class="p">(</span><span class="no">NS</span><span class="p">,</span> <span class="s">&quot;q&quot;</span><span class="p">);</span>
-<span class="n">rdfsExample</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="no">RDFS</span><span class="p">.</span><span class="n">subPropertyOf</span><span class="p">,</span> <span class="n">q</span><span class="p">);</span>
-<span class="n">rdfsExample</span><span class="p">.</span><span class="n">createResource</span><span class="p">(</span><span class="no">NS</span><span class="o">+</span><span class="s">&quot;a&quot;</span><span class="p">).</span><span class="n">addProperty</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="s">&quot;foo&quot;</span><span class="p">);</span>
+  we have chosen to use the RDF API:</p></p>
+<div class="codehilite"><pre><span class="n">String</span> <span class="n">NS</span> <span class="p">=</span> &quot;<span class="n">urn</span><span class="p">:</span><span class="n">x</span><span class="o">-</span><span class="n">hp</span><span class="o">-</span><span class="n">jena</span><span class="p">:</span><span class="n">eg</span><span class="o">/</span>&quot;<span class="p">;</span>
+
+<span class="o">//</span> <span class="n">Build</span> <span class="n">a</span> <span class="n">trivial</span> <span class="n">example</span> <span class="n">data</span> <span class="n">set</span>
+<span class="n">Model</span> <span class="n">rdfsExample</span> <span class="p">=</span> <span class="n">ModelFactory</span><span class="p">.</span><span class="n">createDefaultModel</span><span class="p">();</span>
+<span class="n">Property</span> <span class="n">p</span> <span class="p">=</span> <span class="n">rdfsExample</span><span class="p">.</span><span class="n">createProperty</span><span class="p">(</span><span class="n">NS</span><span class="p">,</span> &quot;<span class="n">p</span>&quot;<span class="p">);</span>
+<span class="n">Property</span> <span class="n">q</span> <span class="p">=</span> <span class="n">rdfsExample</span><span class="p">.</span><span class="n">createProperty</span><span class="p">(</span><span class="n">NS</span><span class="p">,</span> &quot;<span class="n">q</span>&quot;<span class="p">);</span>
+<span class="n">rdfsExample</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">RDFS</span><span class="p">.</span><span class="n">subPropertyOf</span><span class="p">,</span> <span class="n">q</span><span class="p">);</span>
+<span class="n">rdfsExample</span><span class="p">.</span><span class="n">createResource</span><span class="p">(</span><span class="n">NS</span><span class="o">+</span>&quot;<span class="n">a</span>&quot;<span class="p">).</span><span class="n">addProperty</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> &quot;<span class="n">foo</span>&quot;<span class="p">);</span>
 </pre></div>
 
 
-<p></pre>
 <p>Now we can create an inference model which performs RDFS inference over this
   data by using:</p>
-<pre>    InfModel inf = ModelFactory.createRDFSModel(rdfsExample);  // [1]
-</pre>
+
+<div class="codehilite"><pre><span class="n">InfModel</span> <span class="nb">inf</span> <span class="p">=</span> <span class="n">ModelFactory</span><span class="p">.</span><span class="n">createRDFSModel</span><span class="p">(</span><span class="n">rdfsExample</span><span class="p">);</span>  <span class="o">//</span> <span class="o">\</span><span class="p">[</span>1<span class="o">\</span><span class="p">]</span>
+</pre></div>
+
+
 <p>We can then check that resulting model shows that &quot;a&quot; also has property
   &quot;q&quot; of value &quot;foo&quot; by virtue of the subPropertyOf entailment:</p>
-<pre>    Resource a = inf.getResource(NS+"a");
-    System.out.println("Statement: " + a.getProperty(q));
-</pre>
+
+<div class="codehilite"><pre><span class="n">Resource</span> <span class="n">a</span> <span class="p">=</span> <span class="nb">inf</span><span class="p">.</span><span class="n">getResource</span><span class="p">(</span><span class="n">NS</span><span class="o">+</span>&quot;<span class="n">a</span>&quot;<span class="p">);</span>
+<span class="n">System</span><span class="p">.</span><span class="n">out</span><span class="p">.</span><span class="n">println</span><span class="p">(</span>&quot;<span class="n">Statement</span><span class="p">:</span> &quot; <span class="o">+</span> <span class="n">a</span><span class="p">.</span><span class="n">getProperty</span><span class="p">(</span><span class="n">q</span><span class="p">));</span>
+</pre></div>
+
+
 <p>Which prints the output:</p>
+
 <pre>   <i> Statement: [urn:x-hp-jena:eg/a, urn:x-hp-jena:eg/q, Literal&lt;foo&gt;]</i>
-</pre></p>
+</pre>
+
 <p>Alternatively we could have created an empty inference model and then added
   in the statements directly to that model.</p>
 
@@ -348,9 +356,10 @@
   method or wanted to configure one we would change line \[1\]. For example, to
   create the same set up manually we could replace \[1\] by:</p>
 
-<pre>    Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
+<div class="codehilite"><pre><span class="n">Reasoner</span> <span class="n">reasoner</span> <span class="p">=</span> <span class="n">ReasonerRegistry</span><span class="p">.</span><span class="n">getRDFSReasoner</span><span class="p">();</span>
+<span class="n">InfModel</span> <span class="nb">inf</span> <span class="p">=</span> <span class="n">ModelFactory</span><span class="p">.</span><span class="n">createInfModel</span><span class="p">(</span><span class="n">reasoner</span><span class="p">,</span> <span class="n">rdfsExample</span><span class="p">);</span>
+</pre></div>
 
-    InfModel inf = ModelFactory.createInfModel(reasoner, rdfsExample);</pre>
 
 <p>or even more manually by<br>
 </p>
@@ -402,13 +411,13 @@
 
 <p>[<a href="#api">API index</a>] [<a href="#index">main index</a>]</p>
 
-<h3 id="wzxhzdk297wzxhzdk298operations-on-inference-models"><a name="operationsOnInferenceModels"></a>Operations on inference models</h3>
+<h3 id="wzxhzdk279wzxhzdk280operations-on-inference-models"><a name="operationsOnInferenceModels"></a>Operations on inference models</h3>
 <p><p>For many applications one simply creates a model incorporating some inference
   step, using the <code>ModelFactory</code> methods, and then just works within
   the standard Jena Model API to access the entailed statements. However, sometimes
   it is necessary to gain more control over the processing or to access additional
   reasoner features not available as <i>virtual</i> triples.</p></p>
-<h4 id="wzxhzdk305wzxhzdk306validation"><a name="validation"></a>Validation</h4>
+<h4 id="wzxhzdk287wzxhzdk288validation"><a name="validation"></a>Validation</h4>
 <p><p>The most common reasoner operation which can't be exposed through additional
   triples in the inference model is that of validation. Typically the ontology
   languages used with the semantic web allow constraints to be expressed, the
@@ -473,7 +482,7 @@
   an additional method <code>Report.isClean()</code> which returns true if the
   ontology is both valid (logically consistent) and generated no warnings (such
   as inconsistent classes).</p></p>
-<h4 id="wzxhzdk367wzxhzdk368extended-list-statements"><a name="extendedListStatements"></a>Extended list statements</h4>
+<h4 id="wzxhzdk349wzxhzdk350extended-list-statements"><a name="extendedListStatements"></a>Extended list statements</h4>
 <p><p>The default API supports accessing all entailed information at the level of
   individual triples. This is surprisingly flexible but there are queries which
   cannot be easily supported this way. The first such is when the query needs
@@ -492,7 +501,7 @@
   preloading your data with expressions you might need to query over. However,
   for some external reasoners, especially description logic reasoners, we anticipate
   restricted uses of this form of listStatement will be important.</p></p>
-<h4 id="wzxhzdk379wzxhzdk380direct-and-indirect-relationships"><a name="directRelations"></a>Direct and indirect relationships</h4>
+<h4 id="wzxhzdk361wzxhzdk362direct-and-indirect-relationships"><a name="directRelations"></a>Direct and indirect relationships</h4>
 <p><p>The second type of operation that is not obviously convenient at the triple
   level involves distinguishing between direct and indirect relationships. If
   a relation is transitive, for example rdfs:subClassOf, then we can define the
@@ -513,7 +522,7 @@
 <p>Typically the easiest way to work with such indirect and direct relations is
   to use the <a href="../ontology/index.html">Ontology API</a> which hides the
   grubby details of these property aliases.</p></p>
-<h4 id="wzxhzdk406wzxhzdk407derivations"><a name="derivations"></a>Derivations</h4>
+<h4 id="wzxhzdk388wzxhzdk389derivations"><a name="derivations"></a>Derivations</h4>
 <p><p>It is sometimes useful to be able to trace where an inferred statement was
   generated from. This is achieved using the <code>InfModel.getDerivation(Statement)</code>
   method. This returns a iterator over a set <a href="/documentation/javadoc/jena/com/hp/hpl/jena/reasoner/Derivation.html"><code>Derviation</code></a>
@@ -559,7 +568,7 @@ Rule rule1 concluded (eg:A eg:p eg:D) &l
     Rule rule1 concluded (eg:B eg:p eg:D) &lt;-
         Fact (eg:B eg:p eg:C)
         Fact (eg:C eg:p eg:D)</i></pre></p>
-<h4 id="wzxhzdk449wzxhzdk450accessing-raw-data-and-deductions"><a name="rawAccess"></a>Accessing raw data and deductions</h4>
+<h4 id="wzxhzdk431wzxhzdk432accessing-raw-data-and-deductions"><a name="rawAccess"></a>Accessing raw data and deductions</h4>
 <p><p>From an <code>InfModel</code> it is easy to retrieve the original, unchanged,
   data over which the model has been computed using the <code>getRawModel()</code>
   call. This returns a model equivalent to the one used in the initial <code>bind</code>
@@ -568,7 +577,7 @@ Rule rule1 concluded (eg:A eg:p eg:D) &l
 <p>Some reasoners, notably the forward chaining rule engine, store the deduced
   statements in a concrete form and this set of deductions can be obtained separately
   by using the <code>getDeductionsModel()</code> call. </p></p>
-<h4 id="wzxhzdk463wzxhzdk464processing-control"><a name="processingControl"></a>Processing control</h4>
+<h4 id="wzxhzdk445wzxhzdk446processing-control"><a name="processingControl"></a>Processing control</h4>
 <p><p>Having bound a <code>Model</code> into an <code>InfModel</code> by using a
   <code>Reasoner</code> its content can still be changed by the normal <code>add</code>
   and <code>remove</code> calls to the <code>InfModel</code>. Any such change
@@ -595,7 +604,7 @@ Rule rule1 concluded (eg:A eg:p eg:D) &l
   call. It there are any outstanding queries (i.e. StmtIterators which have not
   been read to the end yet) then those will be aborted (the next hasNext() call
   will return false).</p></p>
-<h4 id="wzxhzdk493wzxhzdk494tracing"><a name="tracing"></a>Tracing</h4>
+<h4 id="wzxhzdk475wzxhzdk476tracing"><a name="tracing"></a>Tracing</h4>
 <p><p>When developing new reasoner configurations, especially new rule sets for the
   rule engines, it is sometimes useful to be able to trace the operations of the
   associated inference engine. Though, often this generates too much information
@@ -609,14 +618,14 @@ Rule rule1 concluded (eg:A eg:p eg:D) &l
   its underlying InfGraph and calling <code>setTraceOn()</code> call. If you need
   to make use of this see the full javadoc for the relevant InfGraph implementation.</p>
 <p>[<a href="#api">API index</a>] [<a href="#index">main index</a>]</p></p>
-<h2 id="wzxhzdk513wzxhzdk514the-rdfs-reasoner"><a name="rdfs"></a>The RDFS reasoner</h2>
+<h2 id="wzxhzdk495wzxhzdk496the-rdfs-reasoner"><a name="rdfs"></a>The RDFS reasoner</h2>
 <p><ol>
   <li><a href="#RDFSintro">RDFS reasoner - introduction and coverage</a></li>
   <li><a href="#RDFSconfiguration">RDFS Configuration</a></li>
   <li><a href="#RDFSexamples">RDFS Example</a></li>
   <li><a href="#RDFSnotes">RDFS implementation and performance notes</a></li>
 </ol></p>
-<h3 id="wzxhzdk533wzxhzdk534rdfs-reasoner-intro-and-coverage"><a name="RDFSintro"></a>RDFS reasoner - intro and coverage</h3>
+<h3 id="wzxhzdk515wzxhzdk516rdfs-reasoner-intro-and-coverage"><a name="RDFSintro"></a>RDFS reasoner - intro and coverage</h3>
 <p><p>Jena includes an RDFS reasoner (<code>RDFSRuleReasoner</code>) which supports
   almost all of the RDFS entailments described by the RDF Core working group [<a href="http://www.w3.org/TR/rdf-mt/">RDF
   Semantics</a>]. The only omissions are deliberate and are described below.</p>
@@ -642,7 +651,7 @@ Rule rule1 concluded (eg:A eg:p eg:D) &l
   additional bNode triples, even in <i>virtual</i> triple form, is negligible
   and so this has been deliberately omitted from the reasoner. </p>
 <p>[<a href="#rdfs">RDFS index</a>] [<a href="#index">main index</a>]</p></p>
-<h3 id="wzxhzdk569wzxhzdk570rdfs-configuration"><a name="RDFSconfiguration"></a>RDFS configuration</h3>
+<h3 id="wzxhzdk551wzxhzdk552rdfs-configuration"><a name="RDFSconfiguration"></a>RDFS configuration</h3>
 <p><p>The RDFSRuleReasoner can be configured to work at three different compliance
   levels: </p>
 <dl>
@@ -730,7 +739,7 @@ Rule rule1 concluded (eg:A eg:p eg:D) &l
   </tr>
 </table>
 <p>[<a href="#rdfs">RDFS index</a>] [<a href="#index">main index</a>]</p></p>
-<h3 id="wzxhzdk686wzxhzdk687rdfs-example"><a name="RDFSexamples"></a>RDFS Example</h3>
+<h3 id="wzxhzdk668wzxhzdk669rdfs-example"><a name="RDFSexamples"></a>RDFS Example</h3>
 <p><p>As a complete worked example let us create a simple RDFS schema, some instance
   data and use an instance of the RDFS reasoner to query the two.</p>
 <p>We shall use a trivial schema:</p>
@@ -805,7 +814,7 @@ that is not compatible with 13</i></pre>
 <p>because the age was given using an RDF plain litera where as the schema requires
   it to be a datatyped literal which is compatible with xsd:integer.</p>
 <p>[<a href="#rdfs">RDFS index</a>] [<a href="#index">main index</a>]</p></p>
-<h3 id="wzxhzdk853wzxhzdk854rdfs-implementation-and-performance-notes"><a name="RDFSnotes"></a>RDFS implementation and performance notes</h3>
+<h3 id="wzxhzdk835wzxhzdk836rdfs-implementation-and-performance-notes"><a name="RDFSnotes"></a>RDFS implementation and performance notes</h3>
 <p><p>The RDFSRuleReasoner is a hybrid implementation. The subproperty and subclass
   lattices are eagerly computed and stored in a compact in-memory form using the
   TransitiveReasoner (see below). The identification of which container membership
@@ -863,7 +872,7 @@ that is not compatible with 13</i></pre>
   on adapting the rule engines to exploit the capabilities of the more sophisticated
   database backends will be considered.</p>
 <p>[<a href="#rdfs">RDFS index</a>] [<a href="#index">main index</a>]</p></p>
-<h2 id="wzxhzdk941wzxhzdk942the-owl-reasoner"><a name="owl"></a>The OWL reasoner</h2>
+<h2 id="wzxhzdk923wzxhzdk924the-owl-reasoner"><a name="owl"></a>The OWL reasoner</h2>
 <p><ol>
   <li><a href="#OWLintro">OWL reasoner introduction</a></li>
   <li><a href="#OWLcoverage">OWL coverage</a></li>
@@ -880,7 +889,7 @@ an external DL reasoner such as Pellet, 
 configuration still leaves something to be desired and will the subject of future work - time permitting.</p>
 <p>See also <a href="#OWLnotes">subsection 5</a> for notes on more specific limitations
   of the current implementation. </p></p>
-<h3 id="wzxhzdk975wzxhzdk976owl-coverage"><a name="OWLcoverage"></a>OWL coverage</h3>
+<h3 id="wzxhzdk957wzxhzdk958owl-coverage"><a name="OWLcoverage"></a>OWL coverage</h3>
 <p><p>The Jena OWL reasoners could be described as instance-based reasoners. That
   is, they work by using rules to propagate the if- and only-if- implications of
   the OWL constructs on instance data. Reasoning about classes is done indirectly
@@ -1099,7 +1108,7 @@ configuration still leaves something to 
     restriction.</li>
 </ul>
 <p>[<a href="#owl">OWL index</a>] [<a href="#index">main index</a>]</p></p>
-<h3 id="wzxhzdk1225wzxhzdk1226owl-configuration"><a name="OWLconfiguration"></a>OWL Configuration</h3>
+<h3 id="wzxhzdk1207wzxhzdk1208owl-configuration"><a name="OWLconfiguration"></a>OWL Configuration</h3>
 <p><p>This reasoner is accessed using <code>ModelFactory.createOntologyModel</code>
   with the prebuilt <a href="/documentation/javadoc/jena/com/hp/hpl/jena/ontology/OntModelSpec.html"><code>OntModelSpec</code></a>
   <code>OWL_MEM_RULE_INF</code> or manually via <code>ReasonerRegistery.getOWLReasoner()</code>.</p>
@@ -1136,7 +1145,7 @@ configuration still leaves something to 
   of the rule-based approach we imagine useful subsets of functionality emerging
   - like that that supported by the RDFS reasoner in the form of the level settings.</p>
 <p>[<a href="#owl">OWL index</a>] [<a href="#index">main index</a>]</p></p>
-<h3 id="wzxhzdk1291wzxhzdk1292owl-example"><a name="OWLexamples"></a>OWL Example</h3>
+<h3 id="wzxhzdk1273wzxhzdk1274owl-example"><a name="OWLexamples"></a>OWL Example</h3>
 <p><p>As an example of using the OWL inference support, consider the sample schema
   and data file in the data directory - <a href="data/owlDemoSchema.xml">owlDemoSchema.xml</a>
   and <a href="data/owlDemoData.xml">owlDemoData.xml</a>. </p>
@@ -1225,7 +1234,7 @@ Implicated node: eg:bigNameSpecialMB</i>
   referencing two motherboards which are explicitly defined to be different resources
   and thus violate the FunctionProperty nature of <code>hasMotherBoard</code>.</p>
 <p>[<a href="#owl">OWL index</a>] [<a href="#index">main index</a>]</p></p>
-<h3 id="wzxhzdk1400wzxhzdk1401owl-notes-and-limitations"><a name="OWLnotes"></a>OWL notes and limitations</h3>
+<h3 id="wzxhzdk1382wzxhzdk1383owl-notes-and-limitations"><a name="OWLnotes"></a>OWL notes and limitations</h3>
 <h4 id="comprehension-axioms">Comprehension axioms</h4>
 <p><p>A critical implication of our variant of the instance-based approach is that
   the reasoner does not directly answer queries relating to dynamically introduced
@@ -1296,7 +1305,7 @@ class B = cardinality(P,1)</pre>
   should be valid) but not complete. </p></p>
 <p>[<a href="#owl">OWL index</a>] [<a href="#index">main index</a>]</p>
 
-<h2 id="wzxhzdk1439wzxhzdk1440the-transitive-reasoner"><a name="transitive"></a>The transitive reasoner</h2>
+<h2 id="wzxhzdk1421wzxhzdk1422the-transitive-reasoner"><a name="transitive"></a>The transitive reasoner</h2>
 <p><p>The TransitiveReasoner provides support for storing and traversing class and
   property lattices. This implements just the <i>transitive</i> and <i>symmetric</i>
   properties of <code>rdfs:subPropertyOf</code> and <code>rdfs:subClassOf</code>.
@@ -1312,7 +1321,7 @@ class B = cardinality(P,1)</pre>
   used in the default RDFS reasoner.</p>
 <p>It has no configuration options.</p>
 <p>[<a href="#index">Index</a>]</p></p>
-<h2 id="wzxhzdk1461wzxhzdk1462the-general-purpose-rule-engine"><a name="rules"></a>The general purpose rule engine</h2>
+<h2 id="wzxhzdk1443wzxhzdk1444the-general-purpose-rule-engine"><a name="rules"></a>The general purpose rule engine</h2>
 <p><ol>
   <li><a href="#RULEoverview">Overview of the rule engine(s)</a></li>
   <li><a href="#RULEsyntax">Rule syntax and structure</a></li>
@@ -1326,7 +1335,7 @@ class B = cardinality(P,1)</pre>
   <li><a href="#RULEnotes">Notes</a></li>
   <li><a href="#RULEextensions">Extensions</a></li>
 </ol></p>
-<h3 id="wzxhzdk1509wzxhzdk1510overview-of-the-rule-engines"><a name="RULEoverview"></a>Overview of the rule engine(s)</h3>
+<h3 id="wzxhzdk1491wzxhzdk1492overview-of-the-rule-engines"><a name="RULEoverview"></a>Overview of the rule engine(s)</h3>
 <p><p>Jena includes a general purpose rule-based reasoner which is used to implement
   both the RDFS and OWL reasoners but is also available for general use. This
   reasoner supports rule-based inference over RDF graphs and provides forward
@@ -1345,7 +1354,7 @@ class B = cardinality(P,1)</pre>
   The current release includes a starting set of primitives which are sufficient
   for the RDFS and OWL implementations but is easily extensible.</p>
 <p>[<a href="#rules">rule index</a>] [<a href="#index">main index</a>]</p></p>
-<h3 id="wzxhzdk1531wzxhzdk1532rule-syntax-and-structure"><a name="RULEsyntax"></a>Rule syntax and structure</h3>
+<h3 id="wzxhzdk1513wzxhzdk1514rule-syntax-and-structure"><a name="RULEsyntax"></a>Rule syntax and structure</h3>
 <p><p>A rule for the rule-based reasoner is defined by a Java <code><a href="/documentation/javadoc/jena/com/hp/hpl/jena/reasoner/rulesys/Rule.html">Rule</a></code>
   object with a list of body terms (premises), a list of head terms (conclusions)
   and an optional name and optional direction. Each term or <a href="/documentation/javadoc/jena/com/hp/hpl/jena/reasoner/rulesys/ClauseEntry.html"><code>ClauseEntry</code></a>
@@ -1445,16 +1454,18 @@ URL for a rule file use one of the keywo
 <p>
 So an example complete rule file which includes the RDFS rules and defines
 a single extra rule is:
+
     # Example rule file
     @prefix pre: &lt;http://jena.hpl.hp.com/prefix#&gt;.
     @include &lt;RDFS&gt;.
 
     [rule1: (?f pre:father ?a) (?u pre:brother ?f) -&gt; (?u pre:uncle ?a)]
+</p>
 
 <p>[<a href="#rules">Rule index</a>] [<a href="#index">main index</a>]</p>
 
-### <a name="RULEforward"></a>Forward chaining engine
-<p>If the rule reasoner is configured to run in forward mode then only the forward
+<h3 id="wzxhzdk1692wzxhzdk1693forward-chaining-engine"><a name="RULEforward"></a>Forward chaining engine</h3>
+<p><p>If the rule reasoner is configured to run in forward mode then only the forward
   chaining engine will be used. The first time the inference Model is queried
   (or when an explicit <code>prepare()</code> call is made, see <a href="#processingControl">above</a>)
   then all of the relevant data in the model will be submitted to the rule engine.
@@ -1489,12 +1500,11 @@ a single extra rule is:
   an earlier non-RETE implementation is retained for now because it can be more
   efficient in some circumstances but has identical external semantics. This alternative
   engine is likely to be eliminated in a future release once more tuning has been
-  done to the default RETE engine.</p>
-
+  done to the default RETE engine.</p></p>
 <p>[<a href="#rules">Rule index</a>] [<a href="#index">main index</a>]</p>
 
-###<a name="RULEbackward"></a>Backward chaining engine
-<p>If the rule reasoner is run in backward chaining mode it uses a logic programming
+<h3 id="wzxhzdk1725wzxhzdk1726backward-chaining-engine"><a name="RULEbackward"></a>Backward chaining engine</h3>
+<p><p>If the rule reasoner is run in backward chaining mode it uses a logic programming
   (LP) engine with a similar execution strategy to Prolog engines. When the inference
   Model is queried then the query is translated into a goal and the engine attempts
   to satisfy that goal by matching to any stored triples and by goal resolution
@@ -1521,10 +1531,9 @@ triple(s1, p1, o1) :- triple(sb1, pb1, o
   directly.</p>
 <p>Because the order of triples in a Model is not defined then this is one violation
   to strict top-to-bottom execution. Essentially all ground facts are consulted
-  before all rule clauses but the ordering of ground facts is arbitrary.</p>
-
-#### Tabling
-<p>The LP engine supports tabling. When a goal is tabled then all previously computed
+  before all rule clauses but the ordering of ground facts is arbitrary.</p></p>
+<h4 id="tabling">Tabling</h4>
+<p><p>The LP engine supports tabling. When a goal is tabled then all previously computed
   matches to that goal are recorded (memoized) and used when satisfying future
   similar goals. When such a tabled goal is called and all known answers have
   been consumed then the goal will suspend until some other execution branch has
@@ -1543,7 +1552,7 @@ triple(s1, p1, o1) :- triple(sb1, pb1, o
 -&gt; table(rdfs:subClassOf).
 [r1: (?A rdfs:subClassOf ?C) &lt;- (?A rdfs:subClassOf ?B) (?B rdfs:subClassOf ?C)]</pre>
 <p>will successfully compute the transitive closure of the subClassOf relation.
-  Any query of the form (*, rdfs:subClassOf, *) will be satisfied by a mixture
+  Any query of the form (<em>, rdfs:subClassOf, </em>) will be satisfied by a mixture
   of ground facts and resolution of rule r1. Without the first line this rule
   would be an infinite loop. </p>
 <p>The tabled results of each query are kept indefinitely. This means that queries
@@ -1559,10 +1568,9 @@ triple(s1, p1, o1) :- triple(sb1, pb1, o
 <p>Note that backward rules can only have one consequent so that if writing rules that
 might be run in either backward or forward mode then they should be limited to a single consequent each.
 </p>
-<p>[<a href="#rules">Rule index</a>] [<a href="#index">main index</a>]</p>
-
-###<a name="RULEhybrid"></a>Hybrid rule engine
-<p>The rule reasoner has the option of employing both of the individual rule engines
+<p>[<a href="#rules">Rule index</a>] [<a href="#index">main index</a>]</p></p>
+<h3 id="wzxhzdk1789wzxhzdk1790hybrid-rule-engine"><a name="RULEhybrid"></a>Hybrid rule engine</h3>
+<p><p>The rule reasoner has the option of employing both of the individual rule engines
   in conjunction. When run in this <i>hybrid</i> mode the data flows look something
   like this: </p>
 <p align="center"><img src="jena-inf-figure2.png"></p>
@@ -1599,12 +1607,11 @@ might be run in either backward or forwa
 <p align="left">Updates to an inference Model working in hybrid mode will discard
   all the tabled LP results, as they do in the pure backward case. However, the
   forward rules still work incrementally, including incrementally asserting or
-  removing backward rules in response to the data changes.</p>
-
+  removing backward rules in response to the data changes.</p></p>
 <p>[<a href="#rules">Rule index</a>] [<a href="#index">main index</a>]</p>
 
-###<a name="RULEconfiguration"></a>GenericRuleReasoner configuration
-<p>As with the other reasoners there are a set of parameters, identified by RDF
+<h3 id="wzxhzdk1821wzxhzdk1822genericrulereasoner-configuration"><a name="RULEconfiguration"></a>GenericRuleReasoner configuration</h3>
+<p><p>As with the other reasoners there are a set of parameters, identified by RDF
   properties, to control behaviour of the <code>GenericRuleReasoner</code>. These
   parameters can be set using the <code>Reasoner.setParameter</code> call or passed
   into the Reasoner factory in an RDF Model.</p>
@@ -1618,10 +1625,9 @@ Reasoner reasoner = new GenericRuleReaso
   syntax described earlier, is the <code>ruleSet</code> parameter which gives
   a file name which should be loadable from either the classpath or relative to
   the current working directory.<br>
-</p>
-
-#### Summary of parameters
-<table width="90%" border="1" cellspacing="0" cellpadding="0">
+</p></p>
+<h4 id="summary-of-parameters_1">Summary of parameters</h4>
+<p><table width="90%" border="1" cellspacing="0" cellpadding="0">
   <tr>
     <td width="26%"><b>Parameter</b></td>
     <td width="23%"><b>Values</b></td>
@@ -1704,10 +1710,9 @@ Reasoner reasoner = new GenericRuleReaso
     </td>
   </tr>
 </table>
-<p>[<a href="#rules">Rule index</a>] [<a href="#index">main index</a>]</p>
-
-### <a name="RULEbuiltins"></a>Builtin primitives
-<p>The procedural primitives which can be called by the rules are each implemented
+<p>[<a href="#rules">Rule index</a>] [<a href="#index">main index</a>]</p></p>
+<h3 id="wzxhzdk1959wzxhzdk1960builtin-primitives"><a name="RULEbuiltins"></a>Builtin primitives</h3>
+<p><p>The procedural primitives which can be called by the rules are each implemented
   by a Java object stored in a registry. Additional primitives can be created
   and registered - see below for more details.</p>
 <p>Each primitive can optionally be used in either the rule body, the rule head
@@ -1768,7 +1773,7 @@ floating point or XSDDateTime).</div>
         quotient(?a, ?b, ?c)</p>
       </td>
     <td width="59%">
-      <div align="left">Sets c to be (a+b), (a+1) (a-b), min(a,b), max(a,b), (a*b), (a/b). Note that these
+      <div align="left">Sets c to be (a+b), (a+1) (a-b), min(a,b), max(a,b), (a<em>b), (a/b). Note that these
         do not run backwards, if in <code>sum</code> a and c are bound and b is
         unbound then the test will fail rather than bind b to (c-a). This could
         be fixed.</div>
@@ -1799,7 +1804,7 @@ floating point or XSDDateTime).</div>
       Note that the capture groups are numbered from 1 and the first capture group
       will be bound to ?m1, we ignore the implicit capature group 0 which corresponds to
       the entire matched string. So for example
-      <pre>regexp('foo bar', '(.*) (.*)', ?m1, ?m2)</pre>
+      <pre>regexp('foo bar', '(.</em>) (.<em>)', ?m1, ?m2)</pre>
       will bind <code>m1</code> to <code>"foo"</code> and <code>m2</code> to <code>"bar"</code>.</div>
     </td>
   </tr>
@@ -1837,7 +1842,7 @@ floating point or XSDDateTime).</div>
     <td width="41%">noValue(?x, ?p)<br>
       noValue(?x ?p ?v)</td>
     <td width="59%">
-      <div align="left">True if there is no known triple (x, p, *) or (x, p, v)
+      <div align="left">True if there is no known triple (x, p, </em>) or (x, p, v)
         in the model or the explicit forward deductions so far. </div>
     </td>
   </tr>
@@ -1904,9 +1909,8 @@ and the call will fail. Only useable in 
       They deduce a set of triples derived from the list argument ?l : listMapAsObject asserts
       triples (?s ?p ?x) for each ?x in the list ?l, listMapAsSubject asserts triples (?x ?p ?o). </div>
     </td>
-  </tr>
-
-  <tr>
+  </tr></p>
+<p><tr>
     <td width="41%">table(?p) tableAll()</td>
     <td width="59%">
       <div align="left">Declare that all goals involving property ?p (or all goals)
@@ -1923,10 +1927,9 @@ do not "pollute" the inference results.<
     </td>
   </tr>
 </table>
-<p>[<a href="#rules">Rule index</a>] [<a href="#index">main index</a>]</p>
-
-### <a name="RULEexamples"></a>Example
-<p>As a simple illustration suppose we wish to create a simple ontology language
+<p>[<a href="#rules">Rule index</a>] [<a href="#index">main index</a>]</p></p>
+<h3 id="wzxhzdk2200wzxhzdk2201example"><a name="RULEexamples"></a>Example</h3>
+<p><p>As a simple illustration suppose we wish to create a simple ontology language
   in which we can declare one property as being the concatenation of two others
   and to build a rule reasoner to implement this.</p>
 <p>As a simple design we define two properties eg:concatFirst, eg:concatSecond
@@ -1946,19 +1949,18 @@ eg:B eg:q eg:C .</pre>
     "     [r1b: (?x ?c ?y) &lt;- (?x ?p ?z) (?z ?q ?y)] ]";
 Reasoner reasoner = new GenericRuleReasoner(Rule.parseRules(rules));
 InfModel inf = ModelFactory.createInfModel(reasoner, rawData);
-System.out.println("A * * =&gt;");
+System.out.println("A * <em> =&gt;");
 Iterator list = inf.listStatements(A, null, (RDFNode)null);
 while (list.hasNext()) {
     System.out.println(" - " + list.next());
 }</pre>
 <p>When run on a rawData model contain the above four triples this generates the
   (correct) output:</p>
-<pre><i>A * * =&gt;
+<pre><i>A * </em> =&gt;
  - [urn:x-hp:eg/A, urn:x-hp:eg/p, urn:x-hp:eg/B]
- - [urn:x-hp:eg/A, urn:x-hp:eg/r, urn:x-hp:eg/C]</i></pre>
-
-####Example 2
-<p>As a second example, we'll look at ways to define a property as being both
+ - [urn:x-hp:eg/A, urn:x-hp:eg/r, urn:x-hp:eg/C]</i></pre></p>
+<h4 id="example-2">Example 2</h4>
+<p><p>As a second example, we'll look at ways to define a property as being both
   symmetric and transitive. Of course, this can be done directly in OWL but there
   are times when one might wish to do this outside of the full OWL rule set and,
   in any case, it makes for a compact illustration.</p>
@@ -1967,23 +1969,19 @@ while (list.hasNext()) {
   The code then looks something like this:</p>
 <pre>// Register a namespace for use in the demo
 String demoURI = "http://jena.hpl.hp.com/demo#";
-PrintUtil.registerPrefix("demo", demoURI);
-
-// Create an (RDF) specification of a hybrid reasoner which
+PrintUtil.registerPrefix("demo", demoURI);</p>
+<p>// Create an (RDF) specification of a hybrid reasoner which
 // loads its data from an external file.
 Model m = ModelFactory.createDefaultModel();
 Resource configuration =  m.createResource();
 configuration.addProperty(ReasonerVocabulary.PROPruleMode, "hybrid");
-configuration.addProperty(ReasonerVocabulary.PROPruleSet,  "data/demo.rules");
-
-// Create an instance of such a reasoner
-Reasoner reasoner = GenericRuleReasonerFactory.theInstance().create(configuration);
-
-// Load test data
+configuration.addProperty(ReasonerVocabulary.PROPruleSet,  "data/demo.rules");</p>
+<p>// Create an instance of such a reasoner
+Reasoner reasoner = GenericRuleReasonerFactory.theInstance().create(configuration);</p>
+<p>// Load test data
 Model data = FileManager.get().loadModel("file:data/demoData.rdf");
-InfModel infmodel = ModelFactory.createInfModel(reasoner, data);
-
-// Query for all things related to "a" by "p"
+InfModel infmodel = ModelFactory.createInfModel(reasoner, data);</p>
+<p>// Query for all things related to "a" by "p"
 Property p = data.getProperty(demoURI, "p");
 Resource a = data.getResource(demoURI + "a");
 StmtIterator i = infmodel.listStatements(a, p, (RDFNode)null);
@@ -2017,16 +2015,14 @@ while (i.hasNext()) {
   The hybrid rule system allows us to get round this by using forward rules to
   recognize any <code>demo:TransProp</code> declarations once and to generate
   the appropriate backward rules:</p>
-<pre>-&gt; tableAll().
-
-[rule1: (?P rdf:type demo:TransProp) -&gt;
+<pre>-&gt; tableAll().</p>
+<p>[rule1: (?P rdf:type demo:TransProp) -&gt;
       [ (?X ?P ?Y) &lt;- (?Y ?P ?X) ]
       [ (?A ?P ?C) &lt;- (?A ?P ?B), (?B ?P ?C) ]
 ] </pre>
-<p>[<a href="#rules">rule index</a>] [<a href="#index">main index</a>]</p>
-
-###<a name="RDFSPlusRules"></a>Combining RDFS/OWL with custom rules
-<p>Sometimes one wishes to write generic inference rules but combine them
+<p>[<a href="#rules">rule index</a>] [<a href="#index">main index</a>]</p></p>
+<h3 id="wzxhzdk2277wzxhzdk2278combining-rdfsowl-with-custom-rules"><a name="RDFSPlusRules"></a>Combining RDFS/OWL with custom rules</h3>
+<p><p>Sometimes one wishes to write generic inference rules but combine them
  with some RDFS or OWL infernece. With the current Jena architecture limited forms of this
  is possible but you need to be aware of the limitations.</p>
 <p>There are two ways of achieving this sort of configuration within Jena (not
@@ -2055,15 +2051,12 @@ while (i.hasNext()) {
  should be backward. Note that the RDFS and OWL rulesets assume certain settings
  for the GenericRuleReasoner so a typical configuration is:</p>
 <pre>
-  Model data = FileManager.get().loadModel("file:data.n3");
-
-  List rules = Rule.rulesFromURL("myrules.rules");
-
-  GenericRuleReasoner reasoner = new GenericRuleReasoner(rules);
+  Model data = FileManager.get().loadModel("file:data.n3");</p>
+<p>List rules = Rule.rulesFromURL("myrules.rules");</p>
+<p>GenericRuleReasoner reasoner = new GenericRuleReasoner(rules);
   reasoner.setOWLTranslation(true);               // not needed in RDFS case
-  reasoner.setTransitiveClosureCaching(true);
-
-  InfModel inf = ModelFactory.createInfModel(reasoner, data);
+  reasoner.setTransitiveClosureCaching(true);</p>
+<p>InfModel inf = ModelFactory.createInfModel(reasoner, data);
 </pre>
 <p>Where the <code>myrules.rules</code> file will use <code>@include</code> to include
  one of the RDFS or OWL rule sets.</p>
@@ -2082,12 +2075,11 @@ while (i.hasNext()) {
 [rdfs3:  (?x ?p ?y), (?p rdfs:range ?c) -&gt; (?y rdf:type ?c)]
 [rdfs6:  (?a ?p ?b), (?p rdfs:subPropertyOf ?q) -&gt; (?a ?q ?b)]
 [rdfs9:  (?x rdfs:subClassOf ?y), (?a rdf:type ?x) -&gt; (?a rdf:type ?y)]
-</pre>
-
+</pre></p>
 <p>[<a href="#rules">rule index</a>] [<a href="#index">main index</a>]</p>
 
-###<a name="RULEnotes"></a>Notes
-<p>One final aspect of the general rule engine to mention is that of validation
+<h3 id="wzxhzdk2307wzxhzdk2308notes"><a name="RULEnotes"></a>Notes</h3>
+<p><p>One final aspect of the general rule engine to mention is that of validation
   rules. We described earlier how reasoners can implement a <code>validate</code>
   call which returns a set of error reports and warnings about inconsistencies
   in a dataset. Some reasoners (e.g. the RDFS reasoner) implement this feature
@@ -2115,19 +2107,16 @@ while (i.hasNext()) {
 </p>
 <p>Future extensions will improve the formatting capabilities and flexibility
   of this mechanism. </p>
-<p>[<a href="#rules">Rule index</a>] [<a href="#index">main index</a>]</p>
-
-###<a name="RULEextensions"></a>Extensions
-<p>There are several places at which the rule system can be extended by application
-  code.</p>
-
-#### Rule syntax
-<p>First, as mentioned earlier, the rule engines themselves only see rules in
+<p>[<a href="#rules">Rule index</a>] [<a href="#index">main index</a>]</p></p>
+<h3 id="wzxhzdk2351wzxhzdk2352extensions"><a name="RULEextensions"></a>Extensions</h3>
+<p><p>There are several places at which the rule system can be extended by application
+  code.</p></p>
+<h4 id="rule-syntax">Rule syntax</h4>
+<p><p>First, as mentioned earlier, the rule engines themselves only see rules in
   terms of the Rule Java object. Thus applications are free to define an alternative
-  rule syntax so long as it can be compiled into Rule objects.</p>
-
-#### Builtins
-<p>Second, the set of procedural builtins can be extended. A builtin should implement
+  rule syntax so long as it can be compiled into Rule objects.</p></p>
+<h4 id="builtins">Builtins</h4>
+<p><p>Second, the set of procedural builtins can be extended. A builtin should implement
   the <a href="/documentation/javadoc/jena/com/hp/hpl/jena/reasoner/rulesys/Builtin.html"><code>Builtin</code></a>
   interface. The easiest way to achieve this is by subclassing <code><a href="/documentation/javadoc/jena/com/hp/hpl/jena/reasoner/rulesys/builtins/BaseBuiltin.html">BaseBuiltin</a></code>
   and defining a name (<code>getName</code>), the number of arguments expected
@@ -2142,19 +2131,17 @@ while (i.hasNext()) {
   with <a href="/documentation/javadoc/jena/com/hp/hpl/jena/reasoner/rulesys/BuiltinRegistry.html"><code>BuiltinRegistry</code></a>
   for it to be seen by the rule parser and interpreters.</p>
 <p>The easiest way to experiment with this is to look at the examples in the builtins
-  directory. </p>
-
-#### Preprocessing hooks
-<p>The rule reasoner can optionally run a sequence of procedural preprocessing
+  directory. </p></p>
+<h4 id="preprocessing-hooks">Preprocessing hooks</h4>
+<p><p>The rule reasoner can optionally run a sequence of procedural preprocessing
   hooks over the data at the time the inference graph is <i>prepared</i>. These
   procedural hooks can be used to perform tests or translations which are slow
   or inconvenient to express in rule form. See <code>GenericRuleReasoner.addPreprocessingHook</code>
   and the <a href="/documentation/javadoc/jena/com/hp/hpl/jena/reasoner/rulesys/RulePreprocessHook.html"><code>RulePreprocessHook</code></a>
   class for more details.</p>
-<p>[<a href="#index">Index</a>]</p>
-
-##<a name="extensions"></a>Extending the inference support
-<p>Apart from the extension points in the rule reasoner discussed above, the intention
+<p>[<a href="#index">Index</a>]</p></p>
+<h2 id="wzxhzdk2403wzxhzdk2404extending-the-inference-support"><a name="extensions"></a>Extending the inference support</h2>
+<p><p>Apart from the extension points in the rule reasoner discussed above, the intention
   is that it should be possible to plug external inference engines into Jena.
   The core interfaces of <code>InfGraph</code> and <code>Reasoner</code> are kept
   as simple and generic as we can to make this possible and the <code>ReasonerRegistry</code>
@@ -2163,10 +2150,9 @@ while (i.hasNext()) {
 <p>In a future Jena release we plan to provide at least one adapter to an example,
   freely available, reasoner to both validate the machinery and to provide an
   example of how this extension can be done.</p>
-<p>[<a href="#index">Index</a>]</p>
-
-##<a name="futures"></a>Futures
-<p>Whilst we can make no firm commitments, at the time of writing we intend to
+<p>[<a href="#index">Index</a>]</p></p>
+<h2 id="wzxhzdk2419wzxhzdk2420futures"><a name="futures"></a>Futures</h2>
+<p><p>Whilst we can make no firm commitments, at the time of writing we intend to
   continue work on the Jena reasoning support. The key activities on the drawing
   board are:</p>
 <ul>
@@ -2179,7 +2165,7 @@ while (i.hasNext()) {
     database engines. This is a rather larger and longer term task than the others
     above and is the least likely to happen in the near future.</li>
 </ul>
-<p>[<a href="#index">Index</a>]</p>
+<p>[<a href="#index">Index</a>]</p></p>
   </div>
 </div>