Author: andy
Date: Wed Jul 30 12:24:25 2014
New Revision: 1614631
URL: http://svn.apache.org/r1614631
Log:
Fixes for formatting
Modified:
jena/site/trunk/content/documentation/inference/index.mdtext
Modified: jena/site/trunk/content/documentation/inference/index.mdtext
URL:
http://svn.apache.org/viewvc/jena/site/trunk/content/documentation/inference/index.mdtext?rev=1614631&r1=1614630&r2=1614631&view=diff
==============================================================================
--- jena/site/trunk/content/documentation/inference/index.mdtext (original)
+++ jena/site/trunk/content/documentation/inference/index.mdtext Wed Jul 30
12:24:25 2014
@@ -104,7 +104,7 @@ Title: Reasoners and rule engines: Jena
</li>
</ol>
-###<a name="reasonerAPI"></a>Generic reasoner API
+### Generic reasoner API {#reasonerAPI}
####Finding a reasoner
<p>For each type of reasoner there is a factory class (which conforms to the
interface
@@ -178,7 +178,7 @@ Title: Reasoners and rule engines: Jena
metadata.</p>
<p>[<a href="#api">API index</a>] [<a href="#index">main index</a>]</p>
-###<a name="generalExamples"></a>Some small examples
+### Some small examples {#generalExamples}
<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
@@ -186,7 +186,8 @@ Title: Reasoners and rule engines: Jena
have a resource "a" with value "foo" for "p".
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/";
+
+ String NS = "urn:x-hp-jena:eg/";
// Build a trivial example data set
Model rdfsExample = ModelFactory.createDefaultModel();
@@ -194,16 +195,18 @@ Title: Reasoners and rule engines: Jena
Property q = rdfsExample.createProperty(NS, "q");
rdfsExample.add(p, RDFS.subPropertyOf, q);
rdfsExample.createResource(NS+"a").addProperty(p, "foo");
-</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>
+
+ InfModel inf = ModelFactory.createRDFSModel(rdfsExample); // \[1\]
+
<p>We can then check that resulting model shows that "a" also has
property
"q" of value "foo" by virtue of the subPropertyOf
entailment:</p>
-<pre> Resource a = inf.getResource(NS+"a");
+
+ Resource a = inf.getResource(NS+"a");
System.out.println("Statement: " + a.getProperty(q));
-</pre>
+
<p>Which prints the output:</p>
<pre> <i> Statement: [urn:x-hp-jena:eg/a, urn:x-hp-jena:eg/q,
Literal<foo>]</i>
</pre>
@@ -213,9 +216,10 @@ Title: Reasoners and rule engines: Jena
<p>If we wanted to use a different reasoner which is not available as a
convenience
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();
- InfModel inf = ModelFactory.createInfModel(reasoner, rdfsExample);</pre>
+ Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
+ InfModel inf = ModelFactory.createInfModel(reasoner, rdfsExample);
+
<p>or even more manually by<br>
</p>
<pre> Reasoner reasoner =
RDFSRuleReasonerFactory.theInstance().create(null);
@@ -1343,11 +1347,13 @@ 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: <http://jena.hpl.hp.com/prefix#>.
@include <RDFS>.
[rule1: (?f pre:father ?a) (?u pre:brother ?f) -> (?u pre:uncle ?a)]
+</p>
<p>[<a href="#rules">Rule index</a>] [<a href="#index">main index</a>]</p>