Author: buildbot
Date: Mon Feb 20 17:53:31 2012
New Revision: 805540
Log:
Staging update by buildbot for stanbol
Modified:
websites/staging/stanbol/trunk/ (props changed)
websites/staging/stanbol/trunk/content/stanbol/docs/trunk/ontologymanager/ontonet/index.html
websites/staging/stanbol/trunk/content/stanbol/docs/trunk/ontologymanager/registry/index.html
Propchange: websites/staging/stanbol/trunk/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Mon Feb 20 17:53:31 2012
@@ -1 +1 @@
-1291372
+1291389
Modified:
websites/staging/stanbol/trunk/content/stanbol/docs/trunk/ontologymanager/ontonet/index.html
==============================================================================
---
websites/staging/stanbol/trunk/content/stanbol/docs/trunk/ontologymanager/ontonet/index.html
(original)
+++
websites/staging/stanbol/trunk/content/stanbol/docs/trunk/ontologymanager/ontonet/index.html
Mon Feb 20 17:53:31 2012
@@ -61,7 +61,7 @@
<p>Stanbol OntoNet implements the API section for managing OWL and OWL2
ontologies, in order to prepare them for consumption by reasoning services,
refactorers, rule engines and the like. Ontology management in OntoNet is
sparse and not connected: once loaded internally from their remote locations,
ontologies live and are known within the realm they were loaded in. This allows
loose-coupling and (de-)activation of ontologies in order to scale the data
sets for reasoners to process and optimize them for efficiency. </p>
<p><center>
<figure>
- <img width="500px" src="../../../images/ontologymanager/ontonet.png"
alt="OntoNet ontology network structure">
+ <img width="500px" src="../../../../images/ontologymanager/ontonet.png"
alt="OntoNet ontology network structure">
<figcaption>Figure 1: an example of OntoNet setup for multiple ontology
networks, showing the orthogonal layering of sessions, scopes and
spaces.</figcaption>
<figure>
</center></p>
Modified:
websites/staging/stanbol/trunk/content/stanbol/docs/trunk/ontologymanager/registry/index.html
==============================================================================
---
websites/staging/stanbol/trunk/content/stanbol/docs/trunk/ontologymanager/registry/index.html
(original)
+++
websites/staging/stanbol/trunk/content/stanbol/docs/trunk/ontologymanager/registry/index.html
Mon Feb 20 17:53:31 2012
@@ -64,7 +64,8 @@
<li>A <strong>Registry</strong> is an RDF resource (i.e. an ontology itself)
that describes one or more libraries. It is the physical object that has to be
accessed to gain knowledge about libraries.</li>
</ul>
<h2 id="usage_scenarios">Usage Scenarios</h2>
-<p>TODO</p>
+<p>Your CMS ca handle hundreds of vocabularies together for semantic
annotation, but you do not want to clutter the system runtime by having all
those vocabularies loaded altogether. You would like the ontology of a specific
vocabulary to be loaded only when someone uses or requests it, and once it is
loaded you would like it to be stored internally, rather than fetching it from
the Web over and over again.</p>
+<p>The Ontology Registry Manager can help you with that. With a simple RDF
document that references these hundreds of ontologies, it is possible to
organize them into libraries, e.g. by topic ("user profile", "product",
"event") or by provenance ("W3C", "Industrial standards", "nonstandard" etc.).
If a user decides to annotate a content item using <code>schema.org</code>, she
can choose to do so and the Registry Manager will automatically figure out that
it is referenced by libraries "Industrial standards", "user profile" and
"product"). None of these libraries has been preloaded yet, so Stanbol will
automatically choose the smallest one, say "Industrial standards", and load it.
The <code>schema.org</code> ontology will be available from that point on.</p>
<h2 id="configuration">Configuration</h2>
<p>Ontology registries (and, by extension, the libraries they reference) are
configured by the Stanbol administrator via the Felix Web console. <em>Note
that the following links assume Stanbol to be deployed on http://localhost:8080
.</em></p>
<ol>
@@ -79,9 +80,51 @@
<p>Then upload the ontology on the Web and add it to the <strong>Registry
locations</strong> from the <a
href="http://localhost:8080/system/console/configMgr/org.apache.stanbol.ontologymanager.registry.impl.RegistryManagerImpl">Felix
console Configuration</a>.</p>
<p>Note that not only can a single registry describe multiple libraries, but
also multiple registries can describe the same library, each adding information
on the ontologies referenced by it. Library descriptions are
<em>monotonic</em>, in that registries can only <em>add</em> information about
libraries, never <em>remove</em> any.</p>
<h3 id="access_a_cached_ontology">Access a cached ontology</h3>
-<p>A cached ontology does not need to be loaded into an OntoNet scope or
session in order to be available. It can be accessed at @/ontonet/{ontologyURI}
.</p>
+<p>A cached ontology does not need to be loaded into an OntoNet scope or
session in order to be available. It can be accessed at
<code>@/ontonet/{ontologyURI}</code>, where <code>{ontologyURI}</code> can be
either the ontology ID, if the ontology is named, of the physical URI it was
retrieved from.</p>
+<h3 id="load_a_library_into_ontonet">Load a library into OntoNet</h3>
+<p>One useful application of ontology libraries is that they can be used to
populate an OntoNet ontology collector (space or session) with multiple
ontologies with a single command. There are two ways to do so.</p>
+<h4 id="java_api">Java API</h4>
+<p>The Registry Manager is an OSGi service component. To obtain the service
reference:</p>
+<div class="codehilite"><pre><span class="nv">@Reference</span>
+<span class="n">RegistryManager</span> <span
class="n">registryManager</span><span class="p">;</span>
+</pre></div>
+
+
+<p>Loading the contents of a library into an ontology collector is done in the
same way as with loading single ontologies, i.e. by creating a suitable
<code>OntologyInputSource</code>. This time, though, it is a special input
source called <code>LibrarySource</code>. A <code>LibrarySource</code> creates
a new blank ontology (or uses an existing one upon request) and appends all the
contents of a library to it via <code>owl:imports</code> statements.</p>
+<p>Suppose we want to load the contents of a library called
<code>http://stanbol.apache.org/ontologies/library/W3C_ontologies</code> into a
scope called <code>AnnotationStandards</code> that already exists (so we'll
have to use its custom space). First of all let us get a hold of the space:</p>
+<div class="codehilite"><pre><span class="nv">@Reference</span>
+<span class="n">ONManager</span> <span class="n">onManager</span><span
class="p">;</span>
+
+<span class="n">OntologyScope</span> <span class="n">scope</span> <span
class="o">=</span> <span class="n">onManager</span><span
class="o">.</span><span class="n">getScopeRegistry</span><span
class="p">()</span><span class="o">.</span><span class="n">getScope</span><span
class="p">(</span><span class="s">"AnnotationStandards"</span><span
class="p">);</span>
+<span class="n">OntologySpace</span> <span class="n">space</span> <span
class="o">=</span> <span class="n">scope</span><span class="o">.</span><span
class="n">getCustomSpace</span><span class="p">();</span>
+</pre></div>
+
+
+<p>Now create the <code>LibrarySource</code>:</p>
+<div class="codehilite"><pre><span class="x">IRI libraryID =
IRI.create("http://stanbol.apache.org/ontologies/library/W3C_ontologies");</span>
+<span class="x">OntologyInputSource</span><span class="cp"><?</span><span
class="p">,</span><span class="cp">?></span><span class="x"> libSrc = new
LibrarySource(libraryID, registryManager);</span>
+</pre></div>
+
+
+<p>Note that all <code>LibrarySource</code> constructors require that a
<code>RegistryManager</code> be passed to them. This is because ontology input
sources in general are not OSGi components and cannot trade service
references.</p>
+<p>Also note that building a <code>LibrarySource</code> will cause the
contents of the corresponding library to be loaded and stored into the ontology
manager, assuming the <em>lazy loading policy</em> option is set and the
library had not been loaded earlier. Creating library sources is one way to
"touch" an ontology library and get the Registry Manager to load it.</p>
+<p>Finally, add the input source to the custom space. Simple as that:</p>
+<div class="codehilite"><pre><span class="n">space</span><span
class="o">.</span><span class="n">addOntology</span><span
class="p">(</span><span class="n">libSrc</span><span class="p">);</span>
+</pre></div>
+
+
+<p>Note that we called <code>addOntology()</code> although this resulted in
adding multiple ontologies. This is because a <code>LibrarySource</code>
"fools" OntoNet into thinking a single ontology is being loaded, i.e. the
<em>root</em> ontology that depends on the library contents. It will still
possible to access a single imported ontology, though.</p>
+<h4 id="rest_api">REST API</h4>
+<p>When using the REST API, an ontology library can be loaded into a scope the
very moment the scope is created.</p>
+<p>To load the contents of library
<code>http://stanbol.apache.org/ontologies/library/W3C_ontologies</code> into a
<em>new</em> scope called <code>AnnotationStandards</code>:</p>
+<div class="codehilite"><pre><span class="n">curl</span> <span
class="o">-</span><span class="n">X</span> <span class="n">PUT</span> <span
class="n">http:</span><span class="sr">//</span><span
class="n">localhost:8080</span><span class="sr">/ontonet/o</span><span
class="n">ntology</span><span
class="sr">/AnnotationStandards?corereg=http://stanbol.apache.org/o</span><span
class="n">ntologies</span><span class="sr">/library/</span><span
class="n">W3C_ontologies</span>
+</pre></div>
+
+
+<h3 id="load_selected_ontologies_from_library">Load selected ontologies from
library</h3>
+<p>We are working on that. Stay tuned.</p>
<h3 id="service_endpoints">Service Endpoints</h3>
-<p>Because the configuration of registries is a task for
<strong>administrators</strong> and is performed through the Felix
administration console, there are no RESTful services for modifying ontology
registries. It is however possible to browse the known ontology libraries.</p>
+<p>Because the configuration of registries is a task for
<strong>administrators</strong> and is performed through the Felix
administration console, there are no RESTful services for modifying ontology
registries. It is however possible to browse the known ontology
<em>libraries</em>.</p>
<ul>
<li><a
href="http://localhost:8080/ontonet/registry"><strong>Libraries</strong></a>.
If called from a Web browser, shows a list of known ontology libraries, and for
each of them the caching state and the number of referenced ontologies.
<em>Note that this service does not provide information on the registries that
describe these libraries; that is classified information for
administrators.</em> This endpoint supports only GET with no parameters, and
generates text/html only.</li>
</ul>