Author: buildbot
Date: Mon Nov  7 06:03:42 2011
New Revision: 798228

Log:
Staging update by buildbot

Modified:
    websites/staging/stanbol/trunk/content/stanbol/docs/trunk/reasoners.html

Modified: 
websites/staging/stanbol/trunk/content/stanbol/docs/trunk/reasoners.html
==============================================================================
--- websites/staging/stanbol/trunk/content/stanbol/docs/trunk/reasoners.html 
(original)
+++ websites/staging/stanbol/trunk/content/stanbol/docs/trunk/reasoners.html 
Mon Nov  7 06:03:42 2011
@@ -46,7 +46,265 @@
   
   <div id="content">
     <h1 class="title">Reasoners</h1>
-    
+    <p>The Stanbol Reasoners component provides a set of services to take 
advantage of automatic inference engines.</p>
+<p>The module implements a common api for reasoning services, providing the 
possibility to plug different reasoners and configurations in parallel.</p>
+<p>Actually the module includes OWLApi and Jena based abstract services, with 
concrete implementations for Jena RDFS, OWL, OWLMini and HermiT reasoning 
service.</p>
+<p>The Reasoners module expose a REST endpoint at the following location:</p>
+<div class="codehilite"><pre><span class="n">http:</span><span 
class="sr">//</span><span class="n">localhost:8080</span><span 
class="o">/</span><span class="n">reasoners</span>
+</pre></div>
+
+
+<p>with the following preloaded services:</p>
+<ul>
+<li>/rdfs, which is based on Jena RDFS reasoner and supports almost all of the 
RDFS entailments.</li>
+<li>/owl, a Jena reasoner configured to support OWL (with some 
limitations)</li>
+<li>/owlmini, another Jena configuration that partially supports OWL</li>
+</ul>
+<p>In addition, it is also available a service which uses the HermiT reasoner 
to exploit the full OWL2 specification.</p>
+<p>Each reasoner can be accessed with one of three tasks:</p>
+<ul>
+<li>check: to perform a consistency check. This service returns HTTP Status 
200 if data is consistent, 204 otherwise (at the current state of 
implementation the service does not include an explanation about why the input 
is inconsistent. This feature is in our �todo� list, by the way)</li>
+<li>classify: to materialize all inferred rdf:type statements.</li>
+<li>enrich: to materialize all inferred statements.</li>
+</ul>
+<p>For example:</p>
+<div class="codehilite"><pre><span class="n">http:</span><span 
class="sr">//</span><span class="n">localhost:8080</span><span 
class="sr">/reasoners/o</span><span class="n">wl</span><span class="sr">/check 
/</span><span class="o">/</span> <span class="n">expose</span> <span 
class="n">the</span> <span class="n">Jena</span> <span class="n">owl</span> 
<span class="n">service</span> <span class="n">with</span> <span 
class="n">task</span> <span class="n">check</span><span class="p">,</span> 
<span class="ow">or</span>
+<span class="n">http:</span><span class="sr">//</span><span 
class="n">localhost:8080</span><span class="sr">/reasoners/o</span><span 
class="n">wl2</span><span class="sr">/classify /</span><span class="o">/</span> 
<span class="n">to</span> <span class="k">use</span> <span class="n">the</span> 
<span class="n">HermiT</span> <span class="n">service</span> <span 
class="n">with</span> <span class="n">task</span> <span 
class="n">classify</span>
+</pre></div>
+
+
+<p>We can use the curl command line utility to ask the Jena OWL reasoning 
service to materialize all inferences produced by loading the FOAF ontology:</p>
+<div class="codehilite"><pre><span class="nv">$</span> <span 
class="nv">curl</span> <span class="o">-</span><span class="n">H</span> <span 
class="s">&quot;Accept: text/n3&quot;</span> <span 
class="s">&quot;http://localhost:8080/stanbol/reasoners/owl/enrich?url=http://xmlns.com/foaf/0.1/&quot;</span>
+</pre></div>
+
+
+<p>The above example performs a GET  asking for a <tt>text/n3</tt> 
representation of the result. For example, the equivalency of 
<tt>foaf:Agent</tt> and <tt>dc:Agent</tt> result in the 
<tt>rdfs:subClassOf</tt> statements for the <tt>foaf:Person</tt> type:
+<pre>[...]
+&lt;http://xmlns.com/foaf/0.1/Person&gt;
+      a       &lt;http://www.w3.org/2002/07/owl#Thing&gt; ,
+              &lt;http://www.w3.org/2002/07/owl#Class&gt; ,
+              &lt;http://www.w3.org/2000/01/rdf-schema#Resource&gt; ,
+              &lt;http://www.w3.org/2000/01/rdf-schema#Class&gt; ;
+      &lt;http://www.w3.org/2000/01/rdf-schema#label&gt;
+              "Person" ;
+      &lt;http://www.w3.org/2000/01/rdf-schema#subClassOf&gt;
+              &lt;http://xmlns.com/foaf/0.1/Person&gt; ,
+              &lt;http://purl.org/dc/terms/Agent&gt; ,
+              &lt;http://xmlns.com/foaf/0.1/Agent&gt; ,
+              &lt;http://www.w3.org/2002/07/owl#Thing&gt; ,
+              &lt;http://www.w3.org/2000/01/rdf-schema#Resource&gt; ,
+              &lt;http://www.w3.org/2000/10/swap/pim/contact#Person&gt; ,
+              &lt;http://www.w3.org/2003/01/geo/wgs84_pos#SpatialThing&gt; ;
+      &lt;http://www.w3.org/2002/07/owl#disjointWith&gt;
+              &lt;http://xmlns.com/foaf/0.1/Organization&gt; ,
+              &lt;http://xmlns.com/foaf/0.1/Project&gt; ;
+[...]</pre>
+This behaviour is equivalent if we use the method POST with the header 
<tt>Content-type: application/x-www-form-urlencoded</tt>. In addition, if the 
<tt>target</tt> parameter is provided, the service saves the output in the 
given graph in the triple store and does not return the RDF stream.</p>
+<h2 id="differences_between_the_reasoners">Differences between the 
reasoners</h2>
+<p>Let's give some example on the differences between the available reasoners 
(to try the example ontology snippets you can download them from <a 
href="https://github.com/enridaga/reasoners.examples/tree/master/enridaga.reasoners.examples";
 target="_blank">here</a>).</p>
+<p>The first snippet uses rdfs:subClassOf to declare that any Article is a 
Document, which is in turn a ContentItem. 
+<pre>
+&lt;!-- item_1 is an Article --&gt;
+&lt;ex:Article rdf:about="http://www.example.org/reasoners/item_1"/&gt;</p>
+<p>&lt;!-- An article is a kind of Document --&gt;
+&lt;rdf:Description rdf:about="http://www.example.org/reasoners/Article"&gt;
+    &lt;rdfs:subClassOf 
rdf:resource="http://www.example.org/reasoners/Document"/&gt;
+&lt;/rdf:Description&gt;</p>
+<p>&lt;!-- An document is a kind of content item --&gt;
+&lt;rdf:Description rdf:about="http://www.example.org/reasoners/Document"&gt;
+    &lt;rdfs:subClassOf 
rdf:resource="http://www.example.org/reasoners/ContentItem"/&gt;
+&lt;/rdf:Description&gt;
+</pre>
+<a 
href="https://raw.github.com/enridaga/reasoners.examples/master/enridaga.reasoners.examples/rdfs/subclass.xml";
 target="_blank">download it</a></p>
+<p>Giving it to the /rdfs reasoning service, we obtain as resulted inferred 
statement that item_1 is also a Document and a ContentItem. Another feature of 
RDFS is the definition of the domain and range of a property.
+<pre style="overflow: auto">
+&lt;!-- Both enridaga and alexdma are authors of item_1 --&gt;
+&lt;rdf:Description rdf:about="http://www.example.org/reasoners/enridaga"&gt;
+    &lt;ex:author rdf:resource="http://www.example.org/reasoners/item_1"/&gt;
+&lt;/rdf:Description&gt;
+&lt;rdf:Description rdf:about="http://www.example.org/reasoners/alexdma"&gt;
+    &lt;ex:author rdf:resource="http://www.example.org/reasoners/item_1"/&gt;
+&lt;/rdf:Description&gt;</p>
+<p>&lt;!-- ex:author wants a person as subject, and a content-item as object 
--&gt;
+&lt;rdf:Description rdf:about="http://www.example.org/reasoners/author"&gt;
+    &lt;rdfs:domain rdf:resource="http://www.example.org/reasoners/Person"/&gt;
+    &lt;rdfs:range 
rdf:resource="http://www.example.org/reasoners/ContentItem"/&gt;
+&lt;/rdf:Description&gt;
+</pre>
+<a 
href="https://raw.github.com/enridaga/reasoners.examples/master/enridaga.reasoners.examples/rdfs/domain-range.xml";
 target="_blank">download it</a>
+We will obtain, in this case, that both <tt>enridaga</tt> and <tt>alexdma</tt> 
are <tt>Authors</tt>, and that <tt>item_1</tt> is a <tt>ContentItem</tt>. RDFS 
semantics is considered also by other reasoners. The <tt>/rdfs</tt> service is 
the less "expressive" of the four.</p>
+<p>The following snippet will work with <tt>/owl</tt>, <tt>/owlmini</tt> and 
<tt>/owl2</tt> (but not with <tt>/rdfs</tt>):
+<pre style="overflow: auto">
+&lt;!-- ogrisel, enridaga and alexdma are developers --&gt;
+&lt;ex:Developer rdf:about="#enridaga" /&gt;
+&lt;ex:Developer rdf:about="#ogrisel" /&gt;
+&lt;ex:Developer rdf:about="#alexdma" /&gt;</p>
+<p>&lt;!-- We know:</p>
+<h1 id="alexdma_workedtogheter_enridaga_and_ogrisel">alexdma #workedTogheter 
#enridaga and #ogrisel</h1>
+<p>--&gt;
+&lt;rdf:Description rdf:about="#alexdma"&gt;
+&lt;workedTogheter rdf:resource="#ogrisel"/&gt;
+&lt;workedTogheter rdf:resource="#enridaga"/&gt;
+&lt;/rdf:Description&gt;</p>
+<p>&lt;!-- #workedTogheter is an owl:SymmetricProperty (well, this is an 
example...) --&gt;
+&lt;owl:SymmetricProperty rdf:about="#workedTogheter"/&gt;
+&lt;!-- #workedTogheter is also a owl:TransitiveProperty (well, this is an 
example...) --&gt;
+&lt;owl:TransitiveProperty rdf:about="#workedTogheter"/&gt;
+</pre>
+<a 
href="https://raw.github.com/enridaga/reasoners.examples/master/enridaga.reasoners.examples/owlmini/symmetric.xml";
 target="_blank">download it</a>
+The OWL vocabulary introduce logical capabilities, allowing more complex 
inferences to be produced. In the above example we state that <tt>alexdma 
workedWith enridaga</tt> and <tt>ogrisel</tt>. Since we declare the property 
<tt>workedTogheter</tt> to be "Symmetric" and "Transitive", the result will 
include the following:
+<ul>
+<li><tt>enridaga workedWith alexdma</tt> (is symmetric)</li>
+<li><tt>ogrisel workedWith alexdma</tt></li>
+<li><tt>ogrisel workedWith enridaga</tt> (is transitive)</li>
+<li><tt>enridaga workedWith ogrisel</tt></li>
+</ul></p>
+<p>Next snippet is inconsistent. This means that the OWL based reasoners will 
not return any inference, but a 204 HTTP response:
+<pre style="overflow: auto">
+&lt;!-- enridaga is a person --&gt;
+&lt;ex:Person rdf:about="http://www.example.org/reasoners/enridaga"; /&gt;</p>
+<p>&lt;!-- Persons and Organizations are disjoint --&gt;
+&lt;owl:Class rdf:about="http://www.example.org/reasoners/Person"; /&gt;
+&lt;owl:Class rdf:about="http://www.example.org/reasoners/Organization"&gt;
+    &lt;owl:disjointWith 
rdf:resource="http://www.example.org/reasoners/Person"; /&gt;
+&lt;/owl:Class&gt;</p>
+<p>&lt;!-- A Public Limited Company is a kind of Company, which is a kind of 
Organization --&gt;
+&lt;owl:Class 
rdf:about="http://www.example.org/reasoners/PublicLimitedCompany"&gt;
+    &lt;rdfs:subClassOf 
rdf:resource="http://www.example.org/reasoners/Company"; /&gt;
+&lt;/owl:Class&gt;
+&lt;owl:Class rdf:about="http://www.example.org/reasoners/Company"&gt;
+    &lt;rdfs:subClassOf 
rdf:resource="http://www.example.org/reasoners/Organization"; /&gt;
+&lt;/owl:Class&gt;</p>
+<p>&lt;!-- enridaga cannot be a Public Limited Company --&gt;
+&lt;ex:PublicLimitedCompany 
rdf:about="http://www.example.org/reasoners/enridaga"; /&gt;
+</pre>
+<a 
href="https://raw.github.com/enridaga/reasoners.examples/master/enridaga.reasoners.examples/owlmini/inconsistent-types.xml";
 target="_blank">download it</a>
+The <tt>/owlmini</tt> implements the OWL language with some (more) limitations 
then <tt>/owl</tt> (both are based on the Jena rule based reasoner, as said 
before).</p>
+<p>The following example shows the use of class restrictions, in particular 
the usage of <tt>owl:someValuesFrom</tt>:
+<pre style="overflow: auto">
+&lt;!-- john, is an developer, but we don't know anything else --&gt;
+&lt;ex:Developer rdf:about="#john"&gt;
+&lt;/ex:Developer&gt;</p>
+<p>&lt;!-- a #SoftwareCompany is a kind of #Organization --&gt;
+&lt;owl:Class rdf:about="SoftwareCompany"&gt;
+    &lt;rdfs:subClassOf rdf:resource="#Organization" /&gt;
+&lt;/owl:Class&gt;</p>
+<p>&lt;!-- #Developers #worksAt some #SoftwareCompany (they are not the only 
one..., 
+    this is why we use owl:subClassOf) --&gt;
+&lt;owl:Class rdf:about="#Developer"&gt;
+    &lt;rdfs:subClassOf&gt;
+        &lt;owl:restriction&gt;
+            &lt;owl:onProperty rdf:resource="#worksAt" /&gt;
+            &lt;owl:someValuesFrom rdf:resource="#SoftwareCompany" /&gt;
+        &lt;/owl:restriction&gt;
+    &lt;/rdfs:subClassOf&gt;
+&lt;/owl:Class&gt;</p>
+<p>&lt;!-- Employees are all who #worksAt any kind of Organization 
(owl:equivalentClass) --&gt;
+&lt;owl:Class rdf:about="#Employee"&gt;
+    &lt;owl:equivalentClass&gt;
+        &lt;owl:restriction&gt;
+            &lt;owl:onProperty rdf:resource="#worksAt" /&gt;
+            &lt;owl:someValuesFrom rdf:resource="#Organization" /&gt;
+        &lt;/owl:restriction&gt;
+    &lt;/owl:equivalentClass&gt;
+&lt;/owl:Class&gt;
+</pre>
+<a 
href="https://raw.github.com/enridaga/reasoners.examples/master/enridaga.reasoners.examples/owl/some-values-from.xml";
 target="_blank">download it</a></p>
+<p>We expect an OWL reasoner to state that John is an <tt>Employee</tt>. This 
example does not work with <tt>/rdfs</tt> (it ignores the OWL semantics), and 
does not work with <tt>/owlmini</tt>, because the Jena OWL(mini) reasoner omits 
the forward entailments for <tt>owl:someValuesFrom restrictions</tt> (see [<a 
href="#ref4">4</a>]). It works correctly if we use the service 
<tt>/owl</tt>.</p>
+<p>The <tt>/owl</tt> service support the most of the semantic of OWL. The 
HermiT reasoner is based on <a href="http://owlapi.sourceforge.net/";>OWLApi</a> 
and is an example of a DL reasoner. It fully covers OWL and OWL2, which 
introduces lot of interesting features. Here is an example:
+<pre style="overflow: auto">
+&lt;!-- any Employee must have some features: firstname, familyname, email 
+    and worksAt (in one of the allowed places) --&gt;
+&lt;owl:Class rdf:about="#Employee"&gt;
+    &lt;owl:equivalentClass&gt;
+        &lt;owl:Class&gt;
+            &lt;owl:intersectionOf rdf:parseType="Collection"&gt;
+                &lt;rdf:Description rdf:about="#Person" /&gt;
+                &lt;owl:Restriction&gt;
+                    &lt;owl:onProperty rdf:resource="#firstname" /&gt;
+                    &lt;owl:someValuesFrom rdf:resource="&amp;rdfs;Literal" 
/&gt;
+                &lt;/owl:Restriction&gt;
+                &lt;owl:Restriction&gt;
+                    &lt;owl:onProperty rdf:resource="#familyname" /&gt;
+                    &lt;owl:someValuesFrom rdf:resource="&amp;rdfs;Literal" 
/&gt;
+                &lt;/owl:Restriction&gt;
+                &lt;owl:Restriction&gt;
+                    &lt;owl:onProperty rdf:resource="#email" /&gt;
+                    &lt;owl:someValuesFrom rdf:resource="&amp;rdfs;Literal" 
/&gt;
+                &lt;/owl:Restriction&gt;
+                &lt;!-- --&gt;
+                &lt;!-- Let's say that Employees can work only in #Rome , 
#Catania and 
+                    #Bologna --&gt;
+                &lt;owl:Restriction&gt;
+                    &lt;owl:onProperty rdf:resource="#worksAt" /&gt;
+                    &lt;owl:someValuesFrom&gt;
+                        &lt;owl:Class&gt;
+                            &lt;owl:oneOf rdf:parseType="Collection"&gt;
+                                &lt;owl:Thing rdf:about="#Rome" /&gt;
+                                &lt;owl:Thing rdf:about="#Catania" /&gt;
+                                &lt;owl:Thing rdf:about="#Bologna" /&gt;
+                            &lt;/owl:oneOf&gt;
+                        &lt;/owl:Class&gt;
+                    &lt;/owl:someValuesFrom&gt;
+                &lt;/owl:Restriction&gt;
+            &lt;/owl:intersectionOf&gt;
+        &lt;/owl:Class&gt;
+    &lt;/owl:equivalentClass&gt;
+&lt;/owl:Class&gt;</p>
+<p>&lt;owl:DatatypeProperty rdf:about="#firstname" /&gt;
+&lt;owl:DatatypeProperty rdf:about="#familyname" /&gt;
+&lt;owl:DatatypeProperty rdf:about="#email" /&gt;</p>
+<p>&lt;!-- #worksAt has range #Place --&gt;
+&lt;owl:ObjectProperty rdf:about="#worksAt"&gt;
+    &lt;rdfs:range rdf:resource="#Place" /&gt;
+&lt;/owl:ObjectProperty&gt;</p>
+<p>&lt;!-- all the following places are distinct (no synonyms here) --&gt;
+&lt;owl:AllDifferent&gt;
+    &lt;owl:distinctMembers rdf:parseType="Collection"&gt;
+        &lt;owl:Thing rdf:about="#Rome" /&gt;
+        &lt;owl:Thing rdf:about="#Catania" /&gt;
+        &lt;owl:Thing rdf:about="#Bologna" /&gt;
+        &lt;owl:Thing rdf:about="#Moricone" /&gt;
+    &lt;/owl:distinctMembers&gt;
+&lt;/owl:AllDifferent&gt;</p>
+<p>&lt;!-- enridaga, to be an Employee, must fulfill the restrictions defined 
+    for the class #Employee. --&gt;
+&lt;Person rdf:about="#enridaga"&gt;
+    &lt;!-- If you comment one of the next 4 statement, you won't have 
#enridaga 
+        to result as #Employee. --&gt;
+    &lt;firstname&gt;Enrico&lt;/firstname&gt;
+    &lt;familyname&gt;Daga&lt;/familyname&gt;
+    &lt;email&gt;[email protected]&lt;/email&gt;
+    &lt;worksAt rdf:resource="#Catania" /&gt;</p>
+<div class="codehilite"><pre><span class="o">&amp;</span><span 
class="ow">lt</span><span class="p">;</span><span class="o">!--</span> <span 
class="n">If</span> <span class="n">you</span> <span class="n">uncomment</span> 
<span class="n">the</span> <span class="n">two</span> <span 
class="n">statements</span> <span class="n">below</span> <span 
class="n">you</span> <span class="n">will</span> <span class="n">obtain</span> 
<span class="n">an</span> <span class="n">inconsistency</span><span 
class="p">,</span> 
+    <span class="n">because</span> <span class="c1">#Moricone is not an 
allowed place for developers --&amp;gt;</span>
+<span class="o">&amp;</span><span class="ow">lt</span><span 
class="p">;</span><span class="o">!--</span> <span class="o">&amp;</span><span 
class="ow">lt</span><span class="p">;</span><span class="n">worksAt</span> 
<span class="n">rdf:resource</span><span class="o">=</span><span 
class="s">&quot;#Moricone&quot;</span> <span class="o">/&amp;</span><span 
class="ow">gt</span><span class="p">;</span> <span class="o">&amp;</span><span 
class="ow">lt</span><span class="p">;</span><span class="n">rdf:type</span> 
<span class="n">rdf:resource</span><span class="o">=</span><span 
class="s">&quot;#Employee&quot;</span> 
+    <span class="o">/&amp;</span><span class="ow">gt</span><span 
class="p">;</span> <span class="o">--&amp;</span><span 
class="ow">gt</span><span class="p">;</span>
+</pre></div>
+
+
+<p>&lt;/Person&gt;
+</pre>
+<a 
href="https://raw.github.com/enridaga/reasoners.examples/master/enridaga.reasoners.examples/owl2/class-restrictions-owl2.xml";
 target="_blank">download it</a></p>
+<p>The above differences depend on the semantic supported by the specific 
reasoner and from the implementation, which limit the power of the system in 
favour of a better efficiency (is the case of the <tt>/owlmini</tt> 
implementation of Jena, more efficient then the respective <tt>/owl</tt>). If 
you need to work with RDFS semantic, and don't need OWL for your inferences, 
just use the RDFS one.</p>
+<h2 id="build_and_install">Build and install</h2>
+<p>Run Stanbol, for example:</p>
+<p>% java -jar -Xmx1g 
org.apache.stanbol.launchers.full-0.9.0-incubating-SNAPSHOT.jar</p>
+<p>You must have the Ontonet and Rules modules already installed (they are if 
you have followed the above example).
+Move to the /reasoners directory, then run</p>
+<p>% mvn install -PinstallBundle -Dsling.url=<the path to your running Felix 
administration console></p>
+<p>for example</p>
+<p>% mvn install -PinstallBundle http://localhost:8080/system/console</p>
+<h3 id="add_the_hermit_reasoner">Add the HermiT reasoner</h3>
+<p>To enable HermiT as OWL2 reasoner you can download and install it from the 
Stanbol (Incubating) svn repository. The steps are the following:</p>
+<div class="codehilite"><pre><span class="nv">$</span> <span 
class="nv">svn</span> <span class="n">co</span> <span 
class="n">https:</span><span class="sr">//s</span><span 
class="n">vn</span><span class="o">.</span><span class="n">apache</span><span 
class="o">.</span><span class="n">org</span><span 
class="sr">/repos/</span><span class="n">asf</span><span 
class="sr">/incubator/s</span><span class="n">tanbol</span><span 
class="sr">/trunk/</span><span class="n">reasoners</span><span 
class="o">/</span><span class="n">hermit</span> <span 
class="n">stanbol</span><span class="o">-</span><span class="n">hermit</span>
+<span class="nv">$</span> <span class="nv">cd</span> <span 
class="n">stanbol</span><span class="o">-</span><span class="n">hermit</span>
+<span class="nv">$</span> <span class="nv">mvn</span> <span 
class="n">install</span> <span class="o">-</span><span 
class="n">PinstallBundle</span> <span class="o">-</span><span 
class="n">Dsling</span><span class="o">.</span><span class="n">url</span><span 
class="o">=</span><span class="n">http:</span><span class="sr">//</span><span 
class="n">localhost:8080</span><span class="sr">/system/co</span><span 
class="n">nsole</span> <span class="sr">//</span> <span class="n">change</span> 
<span class="n">this</span> <span class="n">to</span> <span 
class="n">the</span> <span class="n">path</span> <span class="n">related</span> 
<span class="n">to</span> <span class="n">your</span> <span 
class="n">Stanbol</span> <span class="n">instance</span>
+</pre></div>
+
+
+<hr />
+<p><em><a href="index.html">Back to index</a></em></p>
   </div>
   
   <div id="footer">


Reply via email to