You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by bu...@apache.org on 2012/09/20 16:14:35 UTC

svn commit: r832567 [14/27] - in /websites/staging/stanbol/trunk/content: ./ css/ development/ docs/ docs/0.9.0-incubating/ docs/0.9.0-incubating/cmsadapter/ docs/0.9.0-incubating/contenthub/ docs/0.9.0-incubating/enhancer/ docs/0.9.0-incubating/enhanc...

Added: websites/staging/stanbol/trunk/content/docs/trunk/components/enhancer/chains/index.html
==============================================================================
--- websites/staging/stanbol/trunk/content/docs/trunk/components/enhancer/chains/index.html (added)
+++ websites/staging/stanbol/trunk/content/docs/trunk/components/enhancer/chains/index.html Thu Sep 20 14:14:28 2012
@@ -0,0 +1,193 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE- 2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+  <link href="/stanbol/css/stanbol.css" rel="stylesheet" type="text/css">
+  <title>Apache Stanbol - Enhancement Chains</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+  <link rel="icon" type="image/png" href="/stanbol/images/stanbol-logo/stanbol-favicon.png"/>
+  <script type="text/javascript">
+    // Google Analytics Tracking Code
+    var _gaq = _gaq || [];
+    _gaq.push(['_setAccount', 'UA-32086816-1']);
+    _gaq.push(['_trackPageview']);
+
+    (function() {
+      var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+    })();
+  </script>  
+</head>
+
+<body>
+  <div id="logo"> <!-- do not scroll the logo -->
+  <a href="/stanbol/index.html"><img alt="Apache Stanbol" width="220" height="101" border="0" src="/stanbol/images/stanbol-logo/stanbol-2010-12-14.png"/></a></div>
+  <div id="navigation"> <!-- but auto scroll the menue -->
+      <h1 id="stanbol">Stanbol</h1>
+<ul>
+<li><a href="/stanbol/index.html">Home</a></li>
+<li><a href="/stanbol/docs/trunk/tutorial.html">Getting Started</a></li>
+<li><a href="/stanbol/docs/trunk/">Documentation</a><ul>
+<li><a href="/stanbol/docs/trunk/scenarios.html">Usage Scenarios</a></li>
+<li><a href="/stanbol/docs/trunk/components">Components</a></li>
+</ul>
+</li>
+<li><a href="/stanbol/development/">Development</a></li>
+</ul>
+<h1 id="project">Project</h1>
+<ul>
+<li><a href="/stanbol/docs/trunk/mailinglists.html">Mailing Lists</a></li>
+<li><a href="https://issues.apache.org/jira/browse/STANBOL">Issue Tracker</a></li>
+<li><a href="/stanbol/team.html">Project Team</a></li>
+<li><a href="http://www.apache.org/licenses/LICENSE-2.0">License</a></li>
+<li><a href="/stanbol/privacy-policy.html">Privacy Policy</a></li>
+</ul>
+<h1 id="downloads">Downloads</h1>
+<ul>
+<li><a href="/stanbol/downloads/">Overview</a><ul>
+<li><a href="/stanbol/downloads/releases.html">Releases</a></li>
+<li><a href="/stanbol/downloads/launchers.html">Launchers</a></li>
+</ul>
+</li>
+</ul>
+<h1 id="archive">Archive</h1>
+<ul>
+<li><a href="/stanbol/docs/0.9.0-incubating/">0.9.0-incubating</a></li>
+</ul>
+<h1 id="the-asf">The ASF</h1>
+<ul>
+<li><a href="http://www.apache.org">Apache Software Foundation</a></li>
+<li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li>
+<li><a href="http://www.apache.org/foundation/sponsorship.html">Become a Sponsor</a></li>
+<li><a href="http://www.apache.org/security/">Security</a></li>
+</ul>
+  </div>
+  <div id="content">
+    <div class="breadcrumbs">
+      <ul> <li><a href="/">Home</a></li> <li class="item"><a href="/docs/">Docs</a></li> <li class="item"><a href="/docs/trunk/">Trunk</a></li> <li class="item"><a href="/docs/trunk/components/">Components</a></li> <li class="item"><a href="/docs/trunk/components/enhancer/">Enhancer</a></li> <li class="item"><a href="/docs/trunk/components/enhancer/chains/">Chains</a></li> </ul>
+    </div>
+    <h1 class="title">Enhancement Chains</h1>
+    <p>An Enhancement Chain defines how content parsed to the Stanbol Enhancer is processed. More concretely it defines which <a href="../engines">EnhancementEngines</a> and in what order are used to process <a href="../contentitem.html">ContentItems</a>. Chains are not responsible for the actual processing of ContentItems. They provide the <a href="executionplan.html">ExecutionPlan</a> to the <a href="../enhancementjobmanager.html">EnhancementJobManger</a> that does the actual processing of the ContentItem.</p>
+<p>In the RESTful API enhancement chains can be accessed by their name under</p>
+<div class="codehilite"><pre>http://{host}:{port}/{stanbol-path}/enhancer/chain/{chain-name}
+</pre></div>
+
+
+<p>Enhancement requests issued to </p>
+<div class="codehilite"><pre>http://{host}:{port}/{stanbol-path}/enhancer
+http://{host}:{port}/{stanbol-path}/engines
+</pre></div>
+
+
+<p>are processed by using the default enhancement chain.</p>
+<p>When using the Java API Chains can be looked up as OSGI services. The <a href="chainmanager.html">ChainManager</a> service is designed to ease this by providing an API that allows to access Chains by their name. Because Chains are not responsible to perform the actual execution but only provide the <a href="executionplan.html">ExecutionPlan</a> one needs to also lookup an EnhancementJobManager instance to enhance a ContentItem.</p>
+<div class="codehilite"><pre><span class="nd">@Reference</span>
+<span class="n">EnhancementJobManager</span> <span class="n">jobManager</span><span class="o">;</span>
+
+<span class="nd">@Reference</span>
+<span class="n">ChainManager</span> <span class="n">chainManager</span><span class="o">;</span>
+
+<span class="c1">//enhance a ContentItem ci </span>
+<span class="n">ContentItem</span> <span class="n">ci</span><span class="o">;</span>
+<span class="c1">//by using the Chain &quot;demo&quot;</span>
+<span class="n">String</span> <span class="n">chainName</span><span class="o">;</span>
+<span class="n">Chain</span> <span class="n">chain</span> <span class="o">=</span> <span class="n">chainManager</span><span class="o">.</span><span class="na">getChain</span><span class="o">(</span><span class="n">chainName</span><span class="o">);</span>
+<span class="k">if</span><span class="o">(</span><span class="n">chain</span> <span class="o">!=</span> <span class="kc">null</span><span class="o">){</span>
+    <span class="n">jobManager</span><span class="o">.</span><span class="na">enhanceContent</span><span class="o">(</span><span class="n">ci</span><span class="o">,</span><span class="n">chain</span><span class="o">);</span>
+<span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
+    <span class="c1">//Chain with name &quot;demo&quot; is not active</span>
+<span class="o">}</span>
+<span class="c1">//the enhancement results are now available in the metadata</span>
+<span class="n">MGraph</span> <span class="n">enhancementResults</span> <span class="o">=</span> <span class="n">ci</span><span class="o">.</span><span class="na">getMetadata</span><span class="o">();</span>
+</pre></div>
+
+
+<p>To enhance a ContentItem with the default chain the "enhanceContent(ContentItem ci)" can be used.</p>
+<h2 id="chain-interface">Chain Interface</h2>
+<p>The Chain interface is very simplistic. It defines just the following three methods:</p>
+<div class="codehilite"><pre><span class="cm">/** Getter for the name of the Chain */</span>
+<span class="o">+</span> <span class="n">getName</span><span class="o">()</span> <span class="o">:</span> <span class="n">String</span>
+<span class="cm">/** Getter for the execution plan */</span>
+<span class="o">+</span> <span class="n">getExecutionPlan</span><span class="o">()</span> <span class="o">:</span> <span class="n">Graph</span>
+<span class="cm">/** Getter for the name of the Engines referenced by this Chain */</span>
+<span class="o">+</span> <span class="n">getEngines</span><span class="o">()</span> <span class="o">:</span> <span class="n">Set</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span>
+<span class="cm">/** Constant for the property used to for the name of the Chain */</span>
+<span class="o">+</span> <span class="n">PROPERTY_NAME</span> <span class="o">:</span> <span class="n">String</span>
+</pre></div>
+
+
+<p>Each Chain has an name assigned. This is typically provided by the chain configuration and MUST be set as value to the property "stanbol.enhancer.chain.name" of the service registration. The getter for the name MUST return the same value. Chain implementation will usually get the name by calling</p>
+<div class="codehilite"><pre><span class="k">this</span><span class="o">.</span><span class="na">name</span> <span class="o">=</span> <span class="o">(</span><span class="n">String</span><span class="o">)</span><span class="n">ComponentContext</span><span class="o">.</span><span class="na">getProperties</span><span class="o">(</span><span class="n">Chain</span><span class="o">.</span><span class="na">PROPERTY_NAME</span><span class="o">);</span>
+</pre></div>
+
+
+<p>within the activate method of the Chain. There is also an AbstractChain implementation provided by the servicesapi module of the Stanbol Enhancer that already implements this functionality.</p>
+<p>The getEngines method returns the name of all <a href="../engines">EnhancementEngines</a> referenced by a Chain. Note that this method returns a Set. This method is intended to allow fast access to the referenced engines and does not provide any information about the execution order.</p>
+<p>Components that need to know the details about a Chain need to process the <a href="executionplan.html">ExecutionPlan</a> returned by the <code>getExecutionPlan()</code> method. The <a href="executionplan.html">ExecutionPlan</a> is represented as an RDF graph following the ExecutionPlan ontology. It formally describes how a ContentItem must be processed by the EnhancementJobManager. For details see the documentation for the <a href="executionplan.html">ExecutionPlan</a>.</p>
+<p>For any Chain implementation it is important that the returned Graph holding the execution plan MUST BE read-only AND final. This means, that a change in the configuration of a Chain MUST NOT change the graph returned by calls to the getExecutionPlan method.</p>
+<p>Because the configuration of a Chain might change at any time, the EnhancementJobManager implementation MUST retrieve the execution plan once and then use this instance for the whole enhancement process. Because of the above requirement that the execution plan is stored in a read-only and final Graph this ensures that the plan can not change even for long lasting enhancement processes. Therefore any change to the configuration of a chain will not influence the ongoing enhancement processes.</p>
+<h2 id="enhancement-chain-management">Enhancement Chain Management</h2>
+<p>This section describes how Enhancement Chains are managed by the Stanbol Enhancer and how they can be selected/accessed. It also describes how the "default" Chain is determined.</p>
+<p>For every Stanbol Enhancer a single Chain MUST BE present. If this is not the case enhance requests MUST throw a ChainException with an according error message. However typically multiple EnhancementChains will be configured. </p>
+<h3 id="chain-name-conflicts">Chain Name Conflicts</h3>
+<p>Chains are identified by the value of the "stanbol.enhancer.chain.name" property - the name of the chain. If more than one Chain do use the same name, then the normal OSGI procedure to select the default service is used. This means that</p>
+<ol>
+<li>the Chain with the highest "service.ranking" and</li>
+<li>the Chain with the lowest "service.id"</li>
+</ol>
+<p>will be selected on requests for a given Chain name. Via the RESTful service API there is no possibility to call the other chains for a given name. However the ChainManager interface allows to access all registered services for a given name.</p>
+<h3 id="default-chain">Default Chain</h3>
+<p>The second important concept of the Chain management is the definition of the "default chain". The default Chain is used for enhancement requests that do not specify a Chain. This is true for requests to the "/engines" and "/enhancer" RESTful services as well as API calls to the "EnhancementJobManager.enhanceContent(ContentItem ci)" method.</p>
+<p>The default Chain is determined by the following rules:</p>
+<ol>
+<li>the Chain with the name "default". If more than one Chain is present with that name, than the above rules for resolving name conflicts apply. If none,</li>
+<li>the Chain with the highest "service.ranking". If several have the same ranking,</li>
+<li>the Chain with the lowest "service.id".</li>
+</ol>
+<p>If no chain is active a ChainException with an according message MUST BE thrown.</p>
+<p>All Stanbol launchers are configured with the <a href="defaultchain.html">Default Chain</a> enabled. This registers itself with the name "default" and the lowest possible service ranking - Integer.MIN_VALUE. This default provides a Chain that considers all currently active <a href="../engines">EnhancementEngines</a> and sorts them based on their ordering information (see the <a href="weightedchain.html#calculation_of_the_executionplan">Calculation of the Execution Plan based on the EnhancementEngine Ordering</a> for details).</p>
+<h3 id="chainmanager-interface">ChainManager interface</h3>
+<p>The <a href="chainmanager.html">ChainManager</a> is the management interface for EnhancementChains that can be used by components to lookup chains based on their name. It also provides a getter for the default chain. There is also an OSGI ServiceTracker like implementation that can be used to track only chains with specific names and to get even notified on any change of such chains.</p>
+<h2 id="chain-implementations">Chain implementations</h2>
+<p>The following Chain implementations are included within the default Stanbol Enhancer distribution:</p>
+<ul>
+<li><strong><a href="defaultchain.html">DefaultChain</a></strong>: This implementation includes all currently active EnhancementEngines. If enabled it registers itself under the name "default" with the service ranking Integer.MIN_VALUE. This makes this chain to the default chain as long users do not deactivate it or register an other chain with the name "default".</li>
+<li><strong><a href="listchain.html">ListChain</a></strong>: Implementation that creates the ExecutionPlan by chaining the EnhancementEngines in the exact order as specified by the parsed list. This Chain does not support parallel execution of engines.</li>
+<li><strong><a href="weightedchain.html">WeightedChain</a></strong>: This Chain implementation takes a List of Engines names as input and uses the "org.apache.stanbol.enhancer.engine.order " metadata provided by such engines to calculate the ExecutionGraph.</li>
+<li><strong><a href="graphchain.html">GraphChain</a></strong>: This Chain implementation is based on a ExecutionGraph parsed as configuration.</li>
+<li><strong>SingleEngineChain</strong>: An Adapter to execute a single EnhancementEngine within a Chain. This type of Chain will not be registered as OSGI service. Instances will be created on request for single EnhancementEngines and directly parsed to the <a href="../enhancementjobmanager.html">EnhancementJobManager</a> implementation.</li>
+</ul>
+  </div>
+  
+  <div id="footer">
+    <div class="copyright">
+      <p>
+        Copyright &copy; 2010 The Apache Software Foundation, Licensed under 
+        the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.
+        <br />
+        Apache, Stanbol and the Apache feather and Stanbol logos are trademarks of The Apache Software Foundation.
+      </p>
+    </div>
+  </div>
+  
+</body>
+</html>
+

Added: websites/staging/stanbol/trunk/content/docs/trunk/components/enhancer/chains/listchain.html
==============================================================================
--- websites/staging/stanbol/trunk/content/docs/trunk/components/enhancer/chains/listchain.html (added)
+++ websites/staging/stanbol/trunk/content/docs/trunk/components/enhancer/chains/listchain.html Thu Sep 20 14:14:28 2012
@@ -0,0 +1,125 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE- 2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+  <link href="/stanbol/css/stanbol.css" rel="stylesheet" type="text/css">
+  <title>Apache Stanbol - List Chain</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+  <link rel="icon" type="image/png" href="/stanbol/images/stanbol-logo/stanbol-favicon.png"/>
+  <script type="text/javascript">
+    // Google Analytics Tracking Code
+    var _gaq = _gaq || [];
+    _gaq.push(['_setAccount', 'UA-32086816-1']);
+    _gaq.push(['_trackPageview']);
+
+    (function() {
+      var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+    })();
+  </script>  
+</head>
+
+<body>
+  <div id="logo"> <!-- do not scroll the logo -->
+  <a href="/stanbol/index.html"><img alt="Apache Stanbol" width="220" height="101" border="0" src="/stanbol/images/stanbol-logo/stanbol-2010-12-14.png"/></a></div>
+  <div id="navigation"> <!-- but auto scroll the menue -->
+      <h1 id="stanbol">Stanbol</h1>
+<ul>
+<li><a href="/stanbol/index.html">Home</a></li>
+<li><a href="/stanbol/docs/trunk/tutorial.html">Getting Started</a></li>
+<li><a href="/stanbol/docs/trunk/">Documentation</a><ul>
+<li><a href="/stanbol/docs/trunk/scenarios.html">Usage Scenarios</a></li>
+<li><a href="/stanbol/docs/trunk/components">Components</a></li>
+</ul>
+</li>
+<li><a href="/stanbol/development/">Development</a></li>
+</ul>
+<h1 id="project">Project</h1>
+<ul>
+<li><a href="/stanbol/docs/trunk/mailinglists.html">Mailing Lists</a></li>
+<li><a href="https://issues.apache.org/jira/browse/STANBOL">Issue Tracker</a></li>
+<li><a href="/stanbol/team.html">Project Team</a></li>
+<li><a href="http://www.apache.org/licenses/LICENSE-2.0">License</a></li>
+<li><a href="/stanbol/privacy-policy.html">Privacy Policy</a></li>
+</ul>
+<h1 id="downloads">Downloads</h1>
+<ul>
+<li><a href="/stanbol/downloads/">Overview</a><ul>
+<li><a href="/stanbol/downloads/releases.html">Releases</a></li>
+<li><a href="/stanbol/downloads/launchers.html">Launchers</a></li>
+</ul>
+</li>
+</ul>
+<h1 id="archive">Archive</h1>
+<ul>
+<li><a href="/stanbol/docs/0.9.0-incubating/">0.9.0-incubating</a></li>
+</ul>
+<h1 id="the-asf">The ASF</h1>
+<ul>
+<li><a href="http://www.apache.org">Apache Software Foundation</a></li>
+<li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li>
+<li><a href="http://www.apache.org/foundation/sponsorship.html">Become a Sponsor</a></li>
+<li><a href="http://www.apache.org/security/">Security</a></li>
+</ul>
+  </div>
+  <div id="content">
+    <div class="breadcrumbs">
+      <ul> <li><a href="/">Home</a></li> <li class="item"><a href="/docs/">Docs</a></li> <li class="item"><a href="/docs/trunk/">Trunk</a></li> <li class="item"><a href="/docs/trunk/components/">Components</a></li> <li class="item"><a href="/docs/trunk/components/enhancer/">Enhancer</a></li> <li class="item"><a href="/docs/trunk/components/enhancer/chains/">Chains</a></li> </ul>
+    </div>
+    <h1 class="title">List Chain</h1>
+    <p>The ListChain creates the ExecutionPlan based on the exact order of the configured <a href="../engines">EnhancementEngines</a>. This provides users with a simple possibility to configure the exact oder in which the referenced EnhancementEngines are called during the enhancement process of a content item. However the ListChain can not support parallel execution of engines - a considerable disadvantage in contrast to the <a href="graphchain.html">GraphChain</a>.</p>
+<p>A typical usage scenario would be that users start of with configuring a ListChain and later optimize the execution by migrating functional configuration to a <a href="graphchain.html">GraphChain</a>.</p>
+<h2 id="configuration">Configuration</h2>
+<p>The property "stanbol.enhancer.chain.list.enginelist" is used to provide the list of engine names. This configuration MUST BE parsed as an array as string because the ordering of the configured entries is essential for the configuration.</p>
+<p>In addition it is possible to define engines as optional. This allows to specify that the enhancement process should not fail if an engine is not active or fails while processing a content item.</p>
+<p>The syntax to define an engine as optional is as follows below <em>(Both variants make the execution of the engine with the name <name> optional.)</em>:</p>
+<div class="codehilite"><pre>&lt;name&gt;;optional
+&lt;name&gt;;optional=true
+</pre></div>
+
+
+<p>The following figure shows the configuration dialog for ListChains as provided by the Apache Felix Web Console.</p>
+<p><img alt="Configuration dialog for the ListChain" src="enhancer-listchain-config.png" title="Screenshot of the configuration dialog for a ListChain with required and optional engines" /></p>
+<p>It is also possible to configure a ListChain by directly installing a configuration with the name "{classname}-{configName}.config". Note that the {configName} needs not to be the same as the name of the chain. The {configName} is just used by the OSGI environment to distinguish different configurations for {classname}.</p>
+<p>To create the same configuration as in the above screenshot the file would need to look like this:</p>
+<div class="codehilite"><pre><span class="na">stanbol.enhancer.chain.name</span><span class="o">=</span><span class="s">&quot;list&quot;</span>
+<span class="na">stanbol.enhancer.chain.list.enginelist</span><span class="o">=</span><span class="s">[&quot;metaxa;optional&quot;,&quot;langid&quot;,&quot;ner&quot;,&quot;dbpediaLinking&quot;]</span>
+</pre></div>
+
+
+<h2 id="calculation-of-the-executionplan">Calculation of the ExecutionPlan</h2>
+<p>The ExecutionPlan is created based on the exact order of the <a href="../engines">EnhancementEngines</a> provided by the "stanbol.enhancer.chain.list.enginelist" property. The configuration MUST contain at least a single engine. In addition no engine MUST be mentioned twice.</p>
+  </div>
+  
+  <div id="footer">
+    <div class="copyright">
+      <p>
+        Copyright &copy; 2010 The Apache Software Foundation, Licensed under 
+        the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.
+        <br />
+        Apache, Stanbol and the Apache feather and Stanbol logos are trademarks of The Apache Software Foundation.
+      </p>
+    </div>
+  </div>
+  
+</body>
+</html>
+

Added: websites/staging/stanbol/trunk/content/docs/trunk/components/enhancer/chains/weightedchain.html
==============================================================================
--- websites/staging/stanbol/trunk/content/docs/trunk/components/enhancer/chains/weightedchain.html (added)
+++ websites/staging/stanbol/trunk/content/docs/trunk/components/enhancer/chains/weightedchain.html Thu Sep 20 14:14:28 2012
@@ -0,0 +1,129 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE- 2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+  <link href="/stanbol/css/stanbol.css" rel="stylesheet" type="text/css">
+  <title>Apache Stanbol - Weighted Chain</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+  <link rel="icon" type="image/png" href="/stanbol/images/stanbol-logo/stanbol-favicon.png"/>
+  <script type="text/javascript">
+    // Google Analytics Tracking Code
+    var _gaq = _gaq || [];
+    _gaq.push(['_setAccount', 'UA-32086816-1']);
+    _gaq.push(['_trackPageview']);
+
+    (function() {
+      var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+    })();
+  </script>  
+</head>
+
+<body>
+  <div id="logo"> <!-- do not scroll the logo -->
+  <a href="/stanbol/index.html"><img alt="Apache Stanbol" width="220" height="101" border="0" src="/stanbol/images/stanbol-logo/stanbol-2010-12-14.png"/></a></div>
+  <div id="navigation"> <!-- but auto scroll the menue -->
+      <h1 id="stanbol">Stanbol</h1>
+<ul>
+<li><a href="/stanbol/index.html">Home</a></li>
+<li><a href="/stanbol/docs/trunk/tutorial.html">Getting Started</a></li>
+<li><a href="/stanbol/docs/trunk/">Documentation</a><ul>
+<li><a href="/stanbol/docs/trunk/scenarios.html">Usage Scenarios</a></li>
+<li><a href="/stanbol/docs/trunk/components">Components</a></li>
+</ul>
+</li>
+<li><a href="/stanbol/development/">Development</a></li>
+</ul>
+<h1 id="project">Project</h1>
+<ul>
+<li><a href="/stanbol/docs/trunk/mailinglists.html">Mailing Lists</a></li>
+<li><a href="https://issues.apache.org/jira/browse/STANBOL">Issue Tracker</a></li>
+<li><a href="/stanbol/team.html">Project Team</a></li>
+<li><a href="http://www.apache.org/licenses/LICENSE-2.0">License</a></li>
+<li><a href="/stanbol/privacy-policy.html">Privacy Policy</a></li>
+</ul>
+<h1 id="downloads">Downloads</h1>
+<ul>
+<li><a href="/stanbol/downloads/">Overview</a><ul>
+<li><a href="/stanbol/downloads/releases.html">Releases</a></li>
+<li><a href="/stanbol/downloads/launchers.html">Launchers</a></li>
+</ul>
+</li>
+</ul>
+<h1 id="archive">Archive</h1>
+<ul>
+<li><a href="/stanbol/docs/0.9.0-incubating/">0.9.0-incubating</a></li>
+</ul>
+<h1 id="the-asf">The ASF</h1>
+<ul>
+<li><a href="http://www.apache.org">Apache Software Foundation</a></li>
+<li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li>
+<li><a href="http://www.apache.org/foundation/sponsorship.html">Become a Sponsor</a></li>
+<li><a href="http://www.apache.org/security/">Security</a></li>
+</ul>
+  </div>
+  <div id="content">
+    <div class="breadcrumbs">
+      <ul> <li><a href="/">Home</a></li> <li class="item"><a href="/docs/">Docs</a></li> <li class="item"><a href="/docs/trunk/">Trunk</a></li> <li class="item"><a href="/docs/trunk/components/">Components</a></li> <li class="item"><a href="/docs/trunk/components/enhancer/">Enhancer</a></li> <li class="item"><a href="/docs/trunk/components/enhancer/chains/">Chains</a></li> </ul>
+    </div>
+    <h1 class="title">Weighted Chain</h1>
+    <p>The WeightedChain takes a list of <a href="../engines">EnhancementEngine</a> names as input and uses the "org.apache.stanbol.enhancer.engine.order" metadata of the configured Engines to calculate an ExecutionPlan.</p>
+<p>This chain is designed for easy configuration - just a list of the engine names - but has limited possibilities to control the execution order.</p>
+<h2 id="configuration">Configuration</h2>
+<p>The property "stanbol.enhancer.chain.weighted.chain" is used to provide the list of engine names. Both arrays and collections are supported as values.</p>
+<p>In addition it is possible to define engines as optional. This allows to specify that the enhancement process should not fail if an engine is not active or fails while processing a content item.</p>
+<p>The syntax to define an Engine as optional is as follows <em>(Both variants make the execution of the engine with the name <name> optional.)</em>:</p>
+<div class="codehilite"><pre>&lt;name&gt;;optional
+&lt;name&gt;;optional=true
+</pre></div>
+
+
+<p><img alt="Configuration dialog for the WeightedCahin" src="enhancer-weightedchain-config.png" title="Screenshot of the configuration dialog for a WeightedChain with two required and one optional engine" /></p>
+<h2 id="calculation-of-the-executionplan">Calculation of the ExecutionPlan</h2>
+<p>It is important to note that the ordering of the list has no influence on the ExecutionPlan because the order of execution of the configured <a href="../engines">EnhancementEngines</a> is calculated only by using the value of the "org.apache.stanbol.enhancer.engine.order" property provided by the EnhancementEngine:</p>
+<ul>
+<li>Engines with a lower order are executed before engines with a higher value</li>
+<li>Engines with the same order may be executed simultaneously if the EnhancementJobManager and the EnhancementEngine do support this feature.</li>
+</ul>
+<p>The WeightedCahin follows exactly the same algorithm as the WeightedJobManager used to decide the execution order of all active EnhancementEngines. However the WeightedChain will only consider configured chains and ignore others.</p>
+<p>The following image shows the ExecutionPlan as calculated based on the above configuration.</p>
+<p><img alt="ExecutionPlan for the keyword chain" src="enhancer-weightedchain-allactive.png" title="The ExecutionPlan is calculated based on the 'order' information of the Enhancement Engines. In this case first 'metaxa' is used to convert any type of content to plain text; second the 'langid' engine is used to detect the language and third the words mentioned in the text are used to lookup entities in DBpedia.org" /></p>
+<p>If some of the Enhancement Engines are not available this will be visualized as follows. If you parse content by using the RESTful interface similar information will be available via the the Execution Metadata included in the metadata of the enhanced content item.</p>
+<p><img alt="Optional Engine is inactive" src="enhancer-weightedchain-optionalinactive.png" title="The optional 'metaxa' engine is inactive. The engines can still be executed however content other than plain text will bot get enhanced" /></p>
+<p>This shows that the optional engine 'metaxa' is currently not available. The chain can be still used however the functionality provided by this optional engine will not be available. In this case only requests for plain text files could be processed.</p>
+<p>The next figure shows a situation where a required engine is not active. Requests to this chain will fail until all required engines are active.</p>
+<p><img alt="Required Engine is inactive" src="enhancer-weightedchain-requiredinactive.png" title="The required 'langid' engine is not active. Because of this requests to this chain will fail." /></p>
+  </div>
+  
+  <div id="footer">
+    <div class="copyright">
+      <p>
+        Copyright &copy; 2010 The Apache Software Foundation, Licensed under 
+        the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.
+        <br />
+        Apache, Stanbol and the Apache feather and Stanbol logos are trademarks of The Apache Software Foundation.
+      </p>
+    </div>
+  </div>
+  
+</body>
+</html>
+

Added: websites/staging/stanbol/trunk/content/docs/trunk/components/enhancer/contentitem.html
==============================================================================
--- websites/staging/stanbol/trunk/content/docs/trunk/components/enhancer/contentitem.html (added)
+++ websites/staging/stanbol/trunk/content/docs/trunk/components/enhancer/contentitem.html Thu Sep 20 14:14:28 2012
@@ -0,0 +1,229 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE- 2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+  <link href="/stanbol/css/stanbol.css" rel="stylesheet" type="text/css">
+  <title>Apache Stanbol - Content Item</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+  <link rel="icon" type="image/png" href="/stanbol/images/stanbol-logo/stanbol-favicon.png"/>
+  <script type="text/javascript">
+    // Google Analytics Tracking Code
+    var _gaq = _gaq || [];
+    _gaq.push(['_setAccount', 'UA-32086816-1']);
+    _gaq.push(['_trackPageview']);
+
+    (function() {
+      var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+    })();
+  </script>  
+</head>
+
+<body>
+  <div id="logo"> <!-- do not scroll the logo -->
+  <a href="/stanbol/index.html"><img alt="Apache Stanbol" width="220" height="101" border="0" src="/stanbol/images/stanbol-logo/stanbol-2010-12-14.png"/></a></div>
+  <div id="navigation"> <!-- but auto scroll the menue -->
+      <h1 id="stanbol">Stanbol</h1>
+<ul>
+<li><a href="/stanbol/index.html">Home</a></li>
+<li><a href="/stanbol/docs/trunk/tutorial.html">Getting Started</a></li>
+<li><a href="/stanbol/docs/trunk/">Documentation</a><ul>
+<li><a href="/stanbol/docs/trunk/scenarios.html">Usage Scenarios</a></li>
+<li><a href="/stanbol/docs/trunk/components">Components</a></li>
+</ul>
+</li>
+<li><a href="/stanbol/development/">Development</a></li>
+</ul>
+<h1 id="project">Project</h1>
+<ul>
+<li><a href="/stanbol/docs/trunk/mailinglists.html">Mailing Lists</a></li>
+<li><a href="https://issues.apache.org/jira/browse/STANBOL">Issue Tracker</a></li>
+<li><a href="/stanbol/team.html">Project Team</a></li>
+<li><a href="http://www.apache.org/licenses/LICENSE-2.0">License</a></li>
+<li><a href="/stanbol/privacy-policy.html">Privacy Policy</a></li>
+</ul>
+<h1 id="downloads">Downloads</h1>
+<ul>
+<li><a href="/stanbol/downloads/">Overview</a><ul>
+<li><a href="/stanbol/downloads/releases.html">Releases</a></li>
+<li><a href="/stanbol/downloads/launchers.html">Launchers</a></li>
+</ul>
+</li>
+</ul>
+<h1 id="archive">Archive</h1>
+<ul>
+<li><a href="/stanbol/docs/0.9.0-incubating/">0.9.0-incubating</a></li>
+</ul>
+<h1 id="the-asf">The ASF</h1>
+<ul>
+<li><a href="http://www.apache.org">Apache Software Foundation</a></li>
+<li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li>
+<li><a href="http://www.apache.org/foundation/sponsorship.html">Become a Sponsor</a></li>
+<li><a href="http://www.apache.org/security/">Security</a></li>
+</ul>
+  </div>
+  <div id="content">
+    <div class="breadcrumbs">
+      <ul> <li><a href="/">Home</a></li> <li class="item"><a href="/docs/">Docs</a></li> <li class="item"><a href="/docs/trunk/">Trunk</a></li> <li class="item"><a href="/docs/trunk/components/">Components</a></li> <li class="item"><a href="/docs/trunk/components/enhancer/">Enhancer</a></li> </ul>
+    </div>
+    <h1 class="title">Content Item</h1>
+    <p><span style="float:right"> <img alt="Content Item Overview" src="contentitemoverview.png" title="The ContentItem can contain several ContentParts and the Enhancement Metadata - an RDF Graph" /></span> </p>
+<p>The ContentItem is the object which represents the content to be enhanced by Apache Stanbol. It is created based on the data provided by the enhancement request and used throughout the enhancement process to store results. Therefore, after the enhancement process has finished, the ContentItem represents the result of the Apache Stanbol enhancement process. ContentItem instances are created by using the <a href="contentitemfactory.html">ContentItemFactory</a> service.</p>
+<p>The following section describes the interface of the ContentItem in detail:</p>
+<h3 id="content-parts">Content Parts</h3>
+<p>Content parts are used to represent the original content as well as transformations of the original content (typically created by pre-processing <a href="engines/list.html">enhancement engines</a> such as the <a href="engines/metaxaengine.html">Metaxa engine</a>). </p>
+<p>The ContentItem provides the following API to work with content parts:</p>
+<div class="codehilite"><pre><span class="cm">/** Getter for the ContentPart based on the index */</span>
+<span class="n">getPart</span><span class="o">(</span><span class="kt">int</span> <span class="n">index</span><span class="o">,</span> <span class="n">Class</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span> <span class="n">type</span><span class="o">)</span> <span class="o">:</span> <span class="n">T</span>
+<span class="cm">/** Getter for the ContentPart based on its ID */</span>
+<span class="n">getPart</span><span class="o">(</span><span class="n">UriRef</span> <span class="n">uri</span><span class="o">,</span> <span class="n">Class</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span> <span class="n">type</span><span class="o">)</span> <span class="o">:</span> <span class="n">T</span>
+<span class="cm">/** Getter for the ID based on the index */</span>
+<span class="n">getPartUri</span><span class="o">(</span><span class="n">index</span> <span class="n">index</span><span class="o">)</span> <span class="o">:</span> <span class="n">UriRef</span>
+<span class="cm">/** Adds a new ContentPart to the content item */</span>
+<span class="n">addPart</span><span class="o">(</span><span class="n">UriRef</span> <span class="n">uri</span><span class="o">,</span> <span class="n">Object</span> <span class="n">part</span><span class="o">)</span> <span class="o">:</span> <span class="n">Object</span>
+</pre></div>
+
+
+<p>Content parts are accessible by the index <em>and</em> by their URI formatted ID. Re-adding a content part will replace the old one. The index will not be changed by this operation.</p>
+<p>There are two types of content parts:</p>
+<ol>
+<li>Content parts which have additional metadata provided within the metadata of the content item. Such content parts are typically used to store transformed versions of the original content. This allows e.g. engines which can only process plain text versions to query for the content part containing this version of the passed document.</li>
+<li>Content parts that are registered under a predefined URI. Such content parts are typically not mentioned within the metadata of the content item. This is used to share intermediate enhancement results between enhancement engines. An example would be tokens, sentences, POS tags and chunks that are extracted by some NLP engine. Engines which want to consume such data need to know the predefined URI of the content part holding this data. They will check within the <code>canEnhance(..)</code> method if a content part with an expected URI is present and if it has the correct type. </li>
+</ol>
+<h3 id="accessing-the-main-content-of-the-contentitem">Accessing the main content of the ContentItem</h3>
+<p>The main content of the ContentItem refers to the content passed by the enhancement request (or downloaded from the URL provided by a request). For accessing this content the following methods are available</p>
+<div class="codehilite"><pre><span class="cm">/** Getter for the InputStream of the content as passed</span>
+<span class="cm">    for the ContentItem */</span>
+<span class="o">+</span> <span class="n">getStream</span><span class="o">()</span> <span class="o">:</span> <span class="n">InputStream</span>
+<span class="cm">/** Getter for the mime type of the content */</span>
+<span class="o">+</span> <span class="n">getMimeType</span><span class="o">()</span> <span class="o">:</span> <span class="n">String</span>
+<span class="cm">/** Getted for the Content as Blob */</span>
+<span class="o">+</span> <span class="n">getBlob</span><span class="o">()</span> <span class="o">:</span> <span class="n">Blob</span>
+</pre></div>
+
+
+<p>The <code>getStream()</code> and <code>getMimeType()</code> methods are shortcuts for the according methods of the content item's blob object. Calling <code>contentItem.getBlob.getStream()</code> will return an InputStream over the exact same content as directly calling <code>getStream()</code> on the content item. <em>Note that the blob interface also provides a <code>getParameter()</code> method which allows to retrieve mime-type parameters such as the charset of textual content.</em></p>
+<p>The content passed by the user is stored as content part at the index '0' with the URI of the content item in the form of a blob. Therefore, calling</p>
+<div class="codehilite"><pre><span class="n">contentItem</span><span class="o">.</span><span class="na">getPart</span><span class="o">(</span><span class="mi">0</span><span class="o">,</span><span class="n">Blob</span><span class="o">.</span><span class="na">class</span><span class="o">)</span>
+<span class="n">contentItem</span><span class="o">.</span><span class="na">getPart</span><span class="o">(</span><span class="n">contentItem</span><span class="o">.</span><span class="na">getUri</span><span class="o">(),</span><span class="n">Blob</span><span class="o">.</span><span class="na">class</span><span class="o">)</span>
+<span class="n">contentItem</span><span class="o">.</span><span class="na">getBlob</span><span class="o">()</span>
+</pre></div>
+
+
+<p>returns the same blob instance.</p>
+<h3 id="metadata-of-the-contentitem">Metadata of the ContentItem</h3>
+<p>The metadata of the ContentItem is managed by a lockable MGraph. This is basically a normal <code>java.util.Collections</code> for triples. The only RDF specific method is the support for filtered iterators which support wildcards for subjects, predicates and objects.</p>
+<p>This graph is used to store all <a href="enhancementstructure.html">enhancement results</a> as well as metadata about the content item (such as content parts) and the enhancement process (see <a href="executionmetadata.html">execution metadata</a>).</p>
+<h3 id="readwrite-locks">Read/Write locks</h3>
+<p>During the Apache Stanbol enhancement process as executed by the <a href="enhancementjobmanager.html">enhancement job manager</a> components running in multiple threads need to access the state of the <em>ContentItem</em>. Because of that the content item provides the possibility to acquire locks.</p>
+<div class="codehilite"><pre><span class="cm">/** Getter for the ReadWirteLock of a ContentItem */</span>
+<span class="o">+</span> <span class="n">getLock</span><span class="o">()</span> <span class="o">:</span> <span class="n">java</span><span class="o">.</span><span class="na">util</span><span class="o">.</span><span class="na">concurrent</span><span class="o">.</span><span class="na">ReadWriteLock</span>
+</pre></div>
+
+
+<p>Note also that</p>
+<div class="codehilite"><pre><span class="n">contentItem</span><span class="o">.</span><span class="na">getLock</span><span class="o">()</span>
+<span class="n">contentItem</span><span class="o">.</span><span class="na">getMetadata</span><span class="o">().</span><span class="na">getLock</span><span class="o">()</span>
+</pre></div>
+
+
+<p>will return the same <code>ReadWriteLock</code> instance.</p>
+<p>This lock can be used to request read/write locks on the content item. All methods of the content item and also the <code>MGraph</code> holding the metadata need to be protected by using the lock. This means that users which do not need to protect whole sections of code do not need to bother with the usage of locks. Typical examples are working with content parts, final classes like <code>Blob</code> or adding/removing a triple from the metadata.</p>
+<p>However, whenever components need to ensure that the data are not changed by other threads while performing some calculations read/write locks <em>must be</em> used. A typical example are iterations over data returned by the MGraph. In this case code iterating over the results should be protected against concurrent changes by</p>
+<div class="codehilite"><pre><span class="n">contentItem</span><span class="o">.</span><span class="na">getLock</span><span class="o">().</span><span class="na">readLock</span><span class="o">().</span><span class="na">lock</span><span class="o">();</span>
+<span class="k">try</span> <span class="o">{</span>
+    <span class="n">Iterator</span><span class="o">&lt;</span><span class="n">Triple</span><span class="o">&gt;</span> <span class="n">it</span> <span class="o">=</span> <span class="n">contentItem</span><span class="o">.</span><span class="na">getMetadata</span><span class="o">().</span>
+        <span class="n">filter</span><span class="o">(</span><span class="kc">null</span><span class="o">,</span><span class="n">RDF</span><span class="o">.</span><span class="na">TYPE</span><span class="o">,</span><span class="n">TechnicalClasses</span><span class="o">.</span><span class="na">ENHANCER_TEXTANNOTATION</span><span class="o">);</span>
+    <span class="k">while</span><span class="o">(</span><span class="n">it</span><span class="o">.</span><span class="na">hasNext</span><span class="o">()){</span>
+        <span class="n">log</span><span class="o">.</span><span class="na">debug</span><span class="o">(</span><span class="err">&quot;</span><span class="n">Process</span> <span class="nl">TextAnnotation:</span> <span class="o">{},</span><span class="n">it</span><span class="o">.</span><span class="na">next</span><span class="o">().</span><span class="na">getSubject</span><span class="o">());</span>
+        <span class="c1">//read the needed information</span>
+    <span class="o">}</span>
+<span class="o">}</span> <span class="k">finally</span> <span class="o">{</span>
+    <span class="n">contentItem</span><span class="o">.</span><span class="na">getLock</span><span class="o">().</span><span class="na">readLock</span><span class="o">().</span><span class="na">unlock</span><span class="o">()</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<p>While accessing content items within an <a href="engines">enhancement engine</a> there is an exception to this rule. If an engine declares that it only supports the <code>SYNCHRONOUS</code> enhancement mode, then the <a href="enhancementjobmanager.html">enhancement job manager</a> needs to take care that an engine has exclusive access to the <em>CotentItem</em>. In this case implementors of enhancement engines need not to care about using read/write locks.</p>
+<h3 id="contentitemfactory">ContentItemFactory</h3>
+<p>Since version 0.10.0 ContentItems and Blobs are created by using the <a href="contentitemfactory.html">ContentItemFactory</a>. ContentItemFactory implementation register themselves as OSGI service. By default the implementation with the highest "service.ranking" is used by the StanbolEnhancer to create instances. By default two implementations are available. The in-memory and a file-based one where the in-memory implementation is used as default.</p>
+<p>Most users will not need to change the default ContentItem implementation. However if the Enhancer is used to extract metadata from gib media files such as EXIF metadata from big images, ID3 from MP3 files ... than changing the default from the InMemoryContentItemFactory to the FileContentItemFactory might considerable reduce the memory footprint. </p>
+<p>With the introduction of the ContentItemFactory also all ContentItem implementation specific constructors to parse content where deprecated and replaced by the following three interfaces:</p>
+<ol>
+<li><strong>ContentSource</strong> allows to parse Content that is available as stream, byte array or string.</li>
+<li><strong>ContentReference</strong> allows to parse a Reference (e.g. a URL) to a ContentItem. The derefernce() method of this interface is used by the ContentItemFactory to convert a ContentReference to a ContentSource.</li>
+<li><strong>ContentSink</strong> allows to obtain an OutputStream to an initially empty Blob that can later be used to stream the content. This is intended to be used by EnhancementEngine that need to convert content from one format to an other because it allows to avoid caching the converted content in-memory.</li>
+</ol>
+<h3 id="multipart-mime-serialization">Multipart MIME serialization</h3>
+<p><span style="float:right"> <img alt="ContentItem Multipart MIME format" src="contentitemmultipartmime.png" title="This figure provides an overview how Content Items are serialized as MultiPart MIME" /></span></p>
+<p>Stanbol supports the serialization of content items as multipart MIME. This serialization is used by the RESTful API of the Stanbol Enhancer. This section provides details about how content items are represented using multipart MIME. For more information on how to send/receive multipart content items via the RESTful Services provided by the Stanbol Enhancer please see the documentation provided in the web interface (e.g. at http://localhost:8080/enhancer).</p>
+<p>The following figure provides an overview on how ContentItems are represented using MultiPart MIME.</p>
+<p><strong>ContentItem Container</strong></p>
+<ul>
+<li>ContentItems are contained within a "multipart/form-data" container</li>
+<li>Apache Stanbol uses "ContentItem" as "boundary", but users may use any other as long as the "boundary" parameter in the "Content-Type" header is set correctly.</li>
+<li>Stanbol uses UTF-8 as charset, but users might use any supported encoding as long as the "charset" parameter in the "Content-Type" header is set accordingly.</li>
+</ul>
+<p>The default Content-Type for serialized ContentItems is therefore "multipart/form-data; boundary=contentItem; charset=UTF-8"</p>
+<p><strong>Enhancement Metadata</strong></p>
+<ul>
+<li>If present this MUST BE the first MIME part within the "multipart/form-data" container representing the ContentItem.</li>
+<li>The "name" parameter of the "Content-Disposition" header MUST BE "metadata"</li>
+<li>If the "fileName" parameter of the "Content-Disposition" header is present it MUST BE the URI of the ContentItem. Users are typically required to set this header in case they want to parse existing metadata with enhancement requests. This is because is such cases it is important that the URI of the ContentItem created by the Stanbol Enhancer is equal to the URI used to describe the Content within the passed Metadata. The Stanbol Enhancer MUST set to "fileName" parameter of the metadata to the URI of the processed ContentItem.</li>
+<li>The "Content-Type" of the metadata can be any RDF serialization supported by Apache Stanbol. UTF-8 is used as default charset.</li>
+<li>The RDF data serialized in this MIME part represent the enhancement results.</li>
+</ul>
+<p><strong>Content</strong></p>
+<ul>
+<li>If present the MIME part representing the Content MUST directly follow the Metadata. If the Metadata are not present the Content MUST BE the first MIME part within the "multipart/form-data" container representing the ContentItem.</li>
+<li>Because multiple content variants can be included within a ContentItem a "multipart/alternate" container is used to represent the content.</li>
+<li>The "name" parameter of the "Content-Disposition" header MUST BE "content". The "fileName" parameter is not used and therefore not present/ignored. The Stanbol Enhancer uses "contentParts" as boundary but users may use any boundary as long as it is correctly set within the "Content-Type" header.</li>
+</ul>
+<p>The various content elements are contained within the "multipart/form-data" container. The ordering is important. For serialized ContentItems it is assumed that the first element is the original document for the ConentItem. All further MIME parts are considered alternate - e.g. transcoded/transformed - versions. For serialized ContentItems provided as response to requests to the Stanbol Enhancer the ordering of the MIME parts is the same as the indexes of the ContentParts in the ContentItem.</p>
+<ul>
+<li>the "name" parameter of the "Content-Disposition" is set to the URI of the ContentPart in the ContentItem.</li>
+<li>the "Content-Type" header must correspond to the media type of the content</li>
+</ul>
+<p>Note that users which want to send a single ContentPart AND Metadata to the Stanbol Enhancer can also directly add the content to the "multipart/form-data" container of the ContentItem. In this case the "name" parameter MUST BE still set to "content" but the "Content-Type" header needs to be directly set to the media type of the passed ContentPart. The Stanbol Enhancer does NOT use this option when serializing ContentItems. It will ALWAYS use a "multipart/alternate" container for the "content" even when only a single ContentPart is included in an Response.</p>
+<p><strong>Additional Metadata</strong></p>
+<p>The <a href="#content_parts">ContentPart API</a> of the Stanbol ContentItem allows to register content parts of any type. The MultiPart MIME serialization of ContentItems supports the serialization of such additional parts as long as they are encoded as RDF graphs (compatible to the Clerezza TripleCollection class). Additional ContentParts which are not encoded as RDF data are currently not supported by the Multipart MIME serialization.</p>
+<ul>
+<li>MimeParts representing such ContentParts MUST BE added after the MIME parts for the "metadata" AND the "content"</li>
+<li>The "name" parameter of the "Content-Disposition" MUST BE set to the URI of the ContentPart in the ContentItem.</li>
+<li>the "Content-Type" header must correspond to the media type of the content. The Stanbol Enhancer will always use the same RDF serialization as for the "metadata" when serializing additional Metadata. Users are free to use any supported serialization as long as they set the "Content-Type" header accordingly.</li>
+<li>The ordering of parts representing additional Metadata is the same as the ordering (index) of the ContentParts in the ContentItem.</li>
+</ul>
+  </div>
+  
+  <div id="footer">
+    <div class="copyright">
+      <p>
+        Copyright &copy; 2010 The Apache Software Foundation, Licensed under 
+        the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.
+        <br />
+        Apache, Stanbol and the Apache feather and Stanbol logos are trademarks of The Apache Software Foundation.
+      </p>
+    </div>
+  </div>
+  
+</body>
+</html>
+

Added: websites/staging/stanbol/trunk/content/docs/trunk/components/enhancer/contentitemfactory.html
==============================================================================
--- websites/staging/stanbol/trunk/content/docs/trunk/components/enhancer/contentitemfactory.html (added)
+++ websites/staging/stanbol/trunk/content/docs/trunk/components/enhancer/contentitemfactory.html Thu Sep 20 14:14:28 2012
@@ -0,0 +1,209 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE- 2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+  <link href="/stanbol/css/stanbol.css" rel="stylesheet" type="text/css">
+  <title>Apache Stanbol - Content Item Factory</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+  <link rel="icon" type="image/png" href="/stanbol/images/stanbol-logo/stanbol-favicon.png"/>
+  <script type="text/javascript">
+    // Google Analytics Tracking Code
+    var _gaq = _gaq || [];
+    _gaq.push(['_setAccount', 'UA-32086816-1']);
+    _gaq.push(['_trackPageview']);
+
+    (function() {
+      var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+    })();
+  </script>  
+</head>
+
+<body>
+  <div id="logo"> <!-- do not scroll the logo -->
+  <a href="/stanbol/index.html"><img alt="Apache Stanbol" width="220" height="101" border="0" src="/stanbol/images/stanbol-logo/stanbol-2010-12-14.png"/></a></div>
+  <div id="navigation"> <!-- but auto scroll the menue -->
+      <h1 id="stanbol">Stanbol</h1>
+<ul>
+<li><a href="/stanbol/index.html">Home</a></li>
+<li><a href="/stanbol/docs/trunk/tutorial.html">Getting Started</a></li>
+<li><a href="/stanbol/docs/trunk/">Documentation</a><ul>
+<li><a href="/stanbol/docs/trunk/scenarios.html">Usage Scenarios</a></li>
+<li><a href="/stanbol/docs/trunk/components">Components</a></li>
+</ul>
+</li>
+<li><a href="/stanbol/development/">Development</a></li>
+</ul>
+<h1 id="project">Project</h1>
+<ul>
+<li><a href="/stanbol/docs/trunk/mailinglists.html">Mailing Lists</a></li>
+<li><a href="https://issues.apache.org/jira/browse/STANBOL">Issue Tracker</a></li>
+<li><a href="/stanbol/team.html">Project Team</a></li>
+<li><a href="http://www.apache.org/licenses/LICENSE-2.0">License</a></li>
+<li><a href="/stanbol/privacy-policy.html">Privacy Policy</a></li>
+</ul>
+<h1 id="downloads">Downloads</h1>
+<ul>
+<li><a href="/stanbol/downloads/">Overview</a><ul>
+<li><a href="/stanbol/downloads/releases.html">Releases</a></li>
+<li><a href="/stanbol/downloads/launchers.html">Launchers</a></li>
+</ul>
+</li>
+</ul>
+<h1 id="archive">Archive</h1>
+<ul>
+<li><a href="/stanbol/docs/0.9.0-incubating/">0.9.0-incubating</a></li>
+</ul>
+<h1 id="the-asf">The ASF</h1>
+<ul>
+<li><a href="http://www.apache.org">Apache Software Foundation</a></li>
+<li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li>
+<li><a href="http://www.apache.org/foundation/sponsorship.html">Become a Sponsor</a></li>
+<li><a href="http://www.apache.org/security/">Security</a></li>
+</ul>
+  </div>
+  <div id="content">
+    <div class="breadcrumbs">
+      <ul> <li><a href="/">Home</a></li> <li class="item"><a href="/docs/">Docs</a></li> <li class="item"><a href="/docs/trunk/">Trunk</a></li> <li class="item"><a href="/docs/trunk/components/">Components</a></li> <li class="item"><a href="/docs/trunk/components/enhancer/">Enhancer</a></li> </ul>
+    </div>
+    <h1 class="title">Content Item Factory</h1>
+    <p>The ContentItemFactory is used by the Stanbol Enhancer to create <a href="contentitem.html">ContentItem</a> and Blob instances. ContentItemFactory implementation typically register themselves as OSGI service. The Stanbol Enhancer will use the factory implementation with the highest "service.ranking" to create ContentItems and Blobs for requests on the RESTful API. When using the Java API any ContentItem implementation can be used.</p>
+<h3 id="contentitemfactory-interface">ContentItemFactory interface</h3>
+<p>The interface of the ContentItemFactory defines the following methods to create ContentItems</p>
+<div class="codehilite"><pre><span class="o">+</span> <span class="n">createContentItem</span><span class="o">(</span><span class="n">ContentSource</span> <span class="n">source</span><span class="o">)</span> <span class="o">:</span> <span class="n">ContentItem</span>
+<span class="o">+</span> <span class="n">createContentItem</span><span class="o">(</span><span class="n">String</span> <span class="n">prefix</span><span class="o">,</span> <span class="n">ContentSource</span> <span class="n">source</span><span class="o">)</span> <span class="o">:</span> <span class="n">ContentItem</span>
+<span class="o">+</span> <span class="n">createContentItem</span><span class="o">(</span><span class="n">UriRef</span> <span class="n">id</span><span class="o">,</span> <span class="n">ContentSource</span> <span class="n">source</span><span class="o">)</span> <span class="o">:</span> <span class="n">ContentItem</span>
+<span class="o">+</span> <span class="n">createContentItem</span><span class="o">(</span><span class="n">String</span> <span class="n">prefix</span><span class="o">,</span> <span class="n">ContentSource</span> <span class="n">source</span><span class="o">,</span> <span class="n">MGraph</span> <span class="n">metadata</span><span class="o">)</span> <span class="o">:</span> <span class="n">ContentItem</span>
+<span class="o">+</span> <span class="n">createContentItem</span><span class="o">(</span><span class="n">UriRef</span> <span class="n">id</span><span class="o">,</span> <span class="n">ContentSource</span> <span class="n">source</span><span class="o">,</span> <span class="n">MGraph</span> <span class="n">metadata</span><span class="o">)</span> <span class="o">:</span> <span class="n">ContentItem</span>
+<span class="o">+</span> <span class="n">createContentItem</span><span class="o">(</span><span class="n">ContentReference</span> <span class="n">reference</span><span class="o">)</span> <span class="o">:</span> <span class="n">ContentItem</span>
+<span class="o">+</span> <span class="n">createContentItem</span><span class="o">(</span><span class="n">ContentReference</span> <span class="n">reference</span><span class="o">,</span> <span class="n">MGraph</span> <span class="n">metadata</span><span class="o">)</span> <span class="o">:</span> <span class="n">ContentItem</span>
+</pre></div>
+
+
+<p>The content for created ContentItem can be passed by using either a ContentSource or a ContentReference. The Stanbol Enhancer Servicesapi module provides implementations for creating ContentSources for Java streams, byte arrays and string object as well as ContentReferences for URLs. For details see the sections below.</p>
+<p>The URI of the created ContentItem is determined as follows:</p>
+<ul>
+<li>if no URI is passed, than it is calculated by using a default prefix plus an digest over the passed content. This ensures that of the some content is passed several times the created ContentItems will use the same id.</li>
+<li>methods that take a <strong>prefix</strong> will also generate the URI by calculating a digest over the passed content. However the passed prefix will be used instead of the default one.</li>
+<li>If an <strong>UriRef id</strong> is passed, than that URI is used as id for the content item.</li>
+</ul>
+<p>The ContentItemFactory allows also to parse pre-existing metadata. All RDF triples in the passed MGraph are guaranteed to be added to the metadata of the created ContentItems. Note that implementations are free to directly use the passed MGraph instance for the metadata or to create an new MGraph instance and copy all triples of the passed instance.</p>
+<p>The following methods of the ContentItemFactory can be used to create Blobs</p>
+<div class="codehilite"><pre><span class="o">+</span> <span class="n">createBlob</span><span class="o">(</span><span class="n">ContentSource</span> <span class="n">source</span><span class="o">)</span> <span class="o">:</span> <span class="n">Blob</span>
+<span class="o">+</span> <span class="n">createBlob</span><span class="o">(</span><span class="n">ContentReference</span> <span class="n">reference</span><span class="o">)</span> <span class="o">:</span> <span class="n">Blob</span>
+<span class="o">+</span> <span class="n">createContentSink</span><span class="o">(</span><span class="n">String</span> <span class="n">mediaType</span><span class="o">)</span> <span class="o">:</span> <span class="n">ContentSink</span>
+</pre></div>
+
+
+<p>The Blob interface is used by the Stanbol Enhancer to represent content. Blobs are added to ContentItems as <a href="contentitem.html#content-parts">content parts</a>. In addition to the ContentSource and ContentReference interfaces that are also supported for the creation of ContentItems for the creation of Blobs also a ContentSink can be used. A ContentSink allows to obtain an OutputStream to an initially empty Blob that can later be used to stream the content. This is intended to be used by EnhancementEngine that need to convert content from one format to an other because it allows to avoid caching the converted content in-memory.</p>
+<h3 id="contentitem-implementations">ContentItem implementations</h3>
+<p>By default the Stanbol Enhancer provides two ContentItemFactory/ContentItem/Blob implementations. Users can control the implementation used by the Stanbol Enhancer by configuring the "service.ranking" property of the different ContentItemFactory implementations (e.g. via the configuration tab of the Apache Felix Web Console). The implementation with the highest "service.ranking" will be used by the Stanbol Enhancer to create ContentItems and Blobs. </p>
+<h4 id="in-memory-contentitem">In-memory ContentItem</h4>
+<p>This implementation manages contents - Blobs - as byte arrays that are kept in-memory. While this ensures fast access to the passed content it also might cause problems if the Stanbol Enhancer is used to process big media files. Nonetheless this is currently used as default, because for typical usage scenarios content processed by the Stanbol Enhancer easily fits into memory.</p>
+<p>The ContentItemFactory of this implementation registers itself with a "service.ranking" of 100 and is therefore used as default by the Stanbol Enhancer.</p>
+<h4 id="file-based-contentitem">File-based ContentItem</h4>
+<p>This implementation differs from the in-memory one that it stores content - Blobs - in temporary files on the hard disc. All other information such as the metadata or non Blob content parts are still kept in-memory. This implementation is intended to be used by users that use the Stanbol Enhancer to process big media files such as TIFF images, MP3 files, rich text files including big graphics or even video files. </p>
+<p>The ContentItemFactory of the the file based implementation is registered with a "service.ranking" of 50. To use it as default users need to ensure that the ranking of this implementation higher than the one of the in-memory implementation.</p>
+<h3 id="contentsource">ContentSource</h3>
+<p>This interface describes the source of a content. It defines the following API</p>
+<div class="codehilite"><pre><span class="cm">/** the content as stream */</span>
+<span class="o">+</span> <span class="n">getStream</span><span class="o">()</span> <span class="o">:</span> <span class="n">InputStream</span>
+<span class="cm">/** the content as byte array */</span>
+<span class="o">+</span> <span class="n">getData</span><span class="o">()</span> <span class="o">:</span> <span class="kt">byte</span><span class="o">[]</span>
+<span class="cm">/** optionally the media type of the content */</span>
+<span class="o">+</span> <span class="n">getMediaType</span><span class="o">()</span> <span class="o">:</span> <span class="n">String</span>
+<span class="cm">/** optionally the file name of the content */</span>
+<span class="o">+</span> <span class="n">getFileName</span><span class="o">()</span> <span class="o">:</span> <span class="n">String</span>
+<span class="cm">/** optionally additional headers */</span>
+<span class="o">+</span> <span class="n">getHeaders</span><span class="o">()</span> <span class="o">:</span> <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span><span class="n">List</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;&gt;</span>
+</pre></div>
+
+
+<p>The ContentSource interface defines methods for obtaining the wrapped content as InputStream and byte[]. This is mainly to avoid unnecessary copying of content. Implementors of ContentItems SHOULD prefer to call </p>
+<ul>
+<li>ContentSource#getData() if the ContentItem/Blob implementation will store the content as byte[] in-memory</li>
+<li>ContentSource#getStream() if the content of a ContentSource is streamed to a file, database, CMS or any other target outside the JVM.</li>
+</ul>
+<p>The following implementations of this interface are provided by the Stanbol Enhnacer servicesapi module</p>
+<ul>
+<li>StreamSource: A ContentSource wrapping an InputStream. Multiple calls to #getStream() are not be supported and will cause IllegalStateExceptions. Calls to #getData() will load the contents of the stream to an in memory.</li>
+<li>ByteArraySource: A ContentSource implementation that uses a byte array to store represent the content. All constructors take the byte array representing the content as parameter. Calls to #getData() MUST NOT copy the byte array to avoid duplications.</li>
+<li>StringSource: A ContentSource implementation that directly allows to parse a String instance. The constructors convert the passed String to an byte array by using the passed Charset. UTF-8 is used as default. This implementation is based on the ByteArraySource. </li>
+</ul>
+<h3 id="contentreference">ContentReference</h3>
+<p>This interface allows to describe content that is not yet locally available. The Stanbol Enhancer will dereference the content when automatically when needed.</p>
+<div class="codehilite"><pre><span class="cm">/** the Reference to the content */</span>
+<span class="o">+</span> <span class="n">gerReference</span><span class="o">()</span> <span class="o">:</span> <span class="n">String</span>
+<span class="cm">/** dereferences the content */</span>
+<span class="o">+</span> <span class="n">dereference</span><span class="o">()</span> <span class="o">:</span> <span class="n">ContentSource</span>
+</pre></div>
+
+
+<p>When referenced content is dereferenced by the Stanbol Enhancer depends on many factors. Earliest it may be dereferenced by the createBlob/createContentItem methods of a ContentItemFactory implementation. At latest it will be dereferenced when the referenced content is first used by the Stanbol Enhancer (e.g. on a call to ContentItem#getStream() or ContentItem#getMimeType()).</p>
+<p>By default an ContentReference implementation for Java URLs is provided by the Stanbol Enhancer servicesapi module. This implementation replaces the WebContentItem that was used for obtaining content from URL until Stanbol version 0.9.0-incubating. </p>
+<h3 id="contentsink">ContentSink</h3>
+<p>EnhancementEngines that do convert passed content (e.g. the <a href="engines/tikaengine.html">TikaEngine</a>) are often capable to so stream processing on content - meaning that the do not need to load the whole content in memory while analyzing it. To support this operation mode also within the StanbolEnhancer the ContentSink interface place an important role as it allows to create an - initially empty - Blob and than "stream" the content to it while processing the content.</p>
+<p>The following method of the ContentItemFactory can be used to create a ContentSink</p>
+<div class="codehilite"><pre><span class="cm">/** Creates a new ContentSink */</span>
+<span class="o">+</span> <span class="n">createContentSink</span><span class="o">(</span><span class="n">String</span> <span class="n">mediaType</span><span class="o">)</span> <span class="o">:</span> <span class="n">ContentSink</span><span class="o">;</span>
+</pre></div>
+
+
+<p>The ContentSink interface provides the OutputStream as well as the created Blob</p>
+<div class="codehilite"><pre><span class="cm">/** Getter for the OutputStream */</span>
+<span class="o">+</span> <span class="n">getOutputStream</span><span class="o">()</span> <span class="o">:</span> <span class="n">OutputStream</span><span class="o">;</span>
+<span class="cm">/** Getter for the Blob */</span>
+<span class="o">+</span> <span class="n">getBlob</span><span class="o">()</span> <span class="o">:</span> <span class="n">Blob</span><span class="o">;</span>
+</pre></div>
+
+
+<p><strong>Note:</strong> User MUST NOT parse the Blob of a ContentSink to any other components until all the data are written to the OutputStream, because this may cause that other components to read partial data when calling Blob#getStream(). This feature is intended to reduce the memory footprint and not to support concurrent writing and reading of data as supported by pipes.</p>
+<h4 id="intended-usage">Intended Usage:</h4>
+<p>This example shows a typical usage of a ContentSink within the processEnhancement(..) method of an EnhancementEngine that needs to transform some content.</p>
+<div class="codehilite"><pre><span class="n">ContentItem</span> <span class="n">ci</span><span class="o">;</span> <span class="c1">//the content item to process</span>
+<span class="n">ContentSink</span> <span class="n">plainTextSink</span> <span class="o">=</span> <span class="n">contentItemFactory</span><span class="o">.</span><span class="na">createContentSink</span><span class="o">(</span><span class="s">&quot;text/plain&quot;</span><span class="o">);</span>
+<span class="n">Writer</span> <span class="n">writer</span> <span class="o">=</span> <span class="k">new</span> <span class="n">OutputStreamWriter</span><span class="o">(</span><span class="n">plainTextSink</span><span class="o">.</span><span class="na">getOutputStream</span><span class="o">,</span><span class="s">&quot;UTF-8&quot;</span><span class="o">);</span>
+<span class="k">try</span> <span class="o">{</span>
+<span class="c1">// parse the writer to the framework that extracts the text</span>
+<span class="o">}</span> <span class="k">finally</span> <span class="o">{</span>
+    <span class="n">IOUtils</span><span class="o">.</span><span class="na">closeQuietly</span><span class="o">(</span><span class="n">writer</span><span class="o">);</span>
+<span class="o">}</span>
+<span class="c1">//now add the Blob to the ContentItem</span>
+<span class="n">UriRef</span> <span class="n">textBlobUri</span><span class="o">;</span> <span class="c1">//create an UriRef for the Blob</span>
+<span class="n">ci</span><span class="o">.</span><span class="na">addPart</span><span class="o">(</span><span class="n">textBlobUri</span><span class="o">,</span> <span class="n">plainTextSink</span><span class="o">.</span><span class="na">getBlob</span><span class="o">());</span>
+<span class="n">plainTextSink</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
+</pre></div>
+  </div>
+  
+  <div id="footer">
+    <div class="copyright">
+      <p>
+        Copyright &copy; 2010 The Apache Software Foundation, Licensed under 
+        the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.
+        <br />
+        Apache, Stanbol and the Apache feather and Stanbol logos are trademarks of The Apache Software Foundation.
+      </p>
+    </div>
+  </div>
+  
+</body>
+</html>
+

Added: websites/staging/stanbol/trunk/content/docs/trunk/components/enhancer/contentitemmultipartmime.png
==============================================================================
Binary file - no diff available.

Propchange: websites/staging/stanbol/trunk/content/docs/trunk/components/enhancer/contentitemmultipartmime.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: websites/staging/stanbol/trunk/content/docs/trunk/components/enhancer/contentitemoverview.png
==============================================================================
Binary file - no diff available.

Propchange: websites/staging/stanbol/trunk/content/docs/trunk/components/enhancer/contentitemoverview.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: websites/staging/stanbol/trunk/content/docs/trunk/components/enhancer/engines/enhancementenginemanager.html
==============================================================================
--- websites/staging/stanbol/trunk/content/docs/trunk/components/enhancer/engines/enhancementenginemanager.html (added)
+++ websites/staging/stanbol/trunk/content/docs/trunk/components/enhancer/engines/enhancementenginemanager.html Thu Sep 20 14:14:28 2012
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE- 2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+  <link href="/stanbol/css/stanbol.css" rel="stylesheet" type="text/css">
+  <title>Apache Stanbol - Enhancement Engine Manager</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+  <link rel="icon" type="image/png" href="/stanbol/images/stanbol-logo/stanbol-favicon.png"/>
+  <script type="text/javascript">
+    // Google Analytics Tracking Code
+    var _gaq = _gaq || [];
+    _gaq.push(['_setAccount', 'UA-32086816-1']);
+    _gaq.push(['_trackPageview']);
+
+    (function() {
+      var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+    })();
+  </script>  
+</head>
+
+<body>
+  <div id="logo"> <!-- do not scroll the logo -->
+  <a href="/stanbol/index.html"><img alt="Apache Stanbol" width="220" height="101" border="0" src="/stanbol/images/stanbol-logo/stanbol-2010-12-14.png"/></a></div>
+  <div id="navigation"> <!-- but auto scroll the menue -->
+      <h1 id="stanbol">Stanbol</h1>
+<ul>
+<li><a href="/stanbol/index.html">Home</a></li>
+<li><a href="/stanbol/docs/trunk/tutorial.html">Getting Started</a></li>
+<li><a href="/stanbol/docs/trunk/">Documentation</a><ul>
+<li><a href="/stanbol/docs/trunk/scenarios.html">Usage Scenarios</a></li>
+<li><a href="/stanbol/docs/trunk/components">Components</a></li>
+</ul>
+</li>
+<li><a href="/stanbol/development/">Development</a></li>
+</ul>
+<h1 id="project">Project</h1>
+<ul>
+<li><a href="/stanbol/docs/trunk/mailinglists.html">Mailing Lists</a></li>
+<li><a href="https://issues.apache.org/jira/browse/STANBOL">Issue Tracker</a></li>
+<li><a href="/stanbol/team.html">Project Team</a></li>
+<li><a href="http://www.apache.org/licenses/LICENSE-2.0">License</a></li>
+<li><a href="/stanbol/privacy-policy.html">Privacy Policy</a></li>
+</ul>
+<h1 id="downloads">Downloads</h1>
+<ul>
+<li><a href="/stanbol/downloads/">Overview</a><ul>
+<li><a href="/stanbol/downloads/releases.html">Releases</a></li>
+<li><a href="/stanbol/downloads/launchers.html">Launchers</a></li>
+</ul>
+</li>
+</ul>
+<h1 id="archive">Archive</h1>
+<ul>
+<li><a href="/stanbol/docs/0.9.0-incubating/">0.9.0-incubating</a></li>
+</ul>
+<h1 id="the-asf">The ASF</h1>
+<ul>
+<li><a href="http://www.apache.org">Apache Software Foundation</a></li>
+<li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li>
+<li><a href="http://www.apache.org/foundation/sponsorship.html">Become a Sponsor</a></li>
+<li><a href="http://www.apache.org/security/">Security</a></li>
+</ul>
+  </div>
+  <div id="content">
+    <div class="breadcrumbs">
+      <ul> <li><a href="/">Home</a></li> <li class="item"><a href="/docs/">Docs</a></li> <li class="item"><a href="/docs/trunk/">Trunk</a></li> <li class="item"><a href="/docs/trunk/components/">Components</a></li> <li class="item"><a href="/docs/trunk/components/enhancer/">Enhancer</a></li> <li class="item"><a href="/docs/trunk/components/enhancer/engines/">Engines</a></li> </ul>
+    </div>
+    <h1 class="title">Enhancement Engine Manager</h1>
+    <p>The EnhancementEngineManager provides name based access to all active <a href="index.html">EnhancementEngine</a>s and their ServiceReferences. This interface is typically used by components that need to lookup EnhancementEngines based on their name. However the EngineTracker implementation can also be used to track specific EnhancementEngines.</p>
+<h3 id="enhancementenginemanager-interface">EnhancementEngineManager interface</h3>
+<p>This is the Java API providing access to registered EnhancementEngines in the ways as described above. This interface includes the following methods:</p>
+<div class="codehilite"><pre><span class="cm">/** Getter for all names with active engines */</span>
+<span class="n">getActiveEngineNames</span><span class="o">()</span> <span class="o">:</span> <span class="n">Set</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span>
+<span class="cm">/** Getter for the ServiceReference to the engine </span>
+<span class="cm">    with a given name */</span>
+<span class="n">getReference</span><span class="o">(</span><span class="n">String</span> <span class="n">name</span><span class="o">)</span> <span class="o">:</span> <span class="n">ServiceReference</span>
+<span class="cm">/** Getter for all ServiceReferences to engines </span>
+<span class="cm">    with a given name sorted by service ranking */</span>
+<span class="n">getReferences</span><span class="o">(</span><span class="n">String</span> <span class="n">name</span><span class="o">)</span>
+<span class="cm">/** Getter for the engine with a given name */</span>
+<span class="o">+</span> <span class="n">getEngine</span><span class="o">(</span><span class="n">Stirng</span> <span class="n">name</span><span class="o">)</span> <span class="o">:</span> <span class="n">EnhancementEngine</span>
+<span class="cm">/** Getter for all engines with a given name sorted </span>
+<span class="cm">    by service ranking */</span>
+<span class="o">+</span> <span class="n">getEngines</span><span class="o">(</span><span class="n">String</span> <span class="n">name</span><span class="o">)</span> <span class="o">:</span> <span class="n">List</span><span class="o">&lt;</span><span class="n">EnhancementEngine</span><span class="o">&gt;</span>
+<span class="cm">/** Getter for an engine based on a service reference */</span>
+<span class="o">+</span> <span class="n">getEngine</span><span class="o">(</span><span class="n">ServiceReference</span> <span class="n">ref</span><span class="o">)</span> <span class="o">:</span> <span class="n">EnhancementEgnie</span>
+<span class="cm">/** Checks if there is an engine for the given name */</span>
+<span class="o">+</span> <span class="n">isEngine</span><span class="o">(</span><span class="n">String</span> <span class="n">name</span><span class="o">)</span> <span class="o">:</span> <span class="kt">boolean</span>
+</pre></div>
+
+
+<p>There are two implementations of this interface available:</p>
+<h4 id="enhancementenginemanager-service">EnhancementEngineManager Service</h4>
+<p>This is an implementation of the EnhancementEngineManager interface that is registered as OSGI service. It can be used e.g. by using the @Reference annotation</p>
+<div class="codehilite"><pre><span class="nd">@Reference</span>
+<span class="n">EnhancementEngineManager</span> <span class="n">engineManager</span>
+</pre></div>
+
+
+<p>This service is provided by the "org.apache.stanbol.enhancer.enginemanager" module and is included in all Stanbol launchers.</p>
+<h4 id="enginestracker">EnginesTracker</h4>
+<p>This is an utility similar to the standard OSGI ServiceTracker which allows to track some/all EnhancementEngines. It also supports the usage of a ServiceTrackerCustomizer so that users of that utility can directly react to changes of tracked EnhancementEngines.</p>
+<div class="codehilite"><pre><span class="c1">//track only &quot;myEngine&quot; and &quot;otherEngine&quot;</span>
+<span class="n">EnginesTracker</span> <span class="n">tracker</span> <span class="o">=</span> <span class="k">new</span> <span class="n">EnginesTracker</span><span class="o">(</span>
+    <span class="n">context</span><span class="o">,</span> <span class="s">&quot;myEngine&quot;</span><span class="o">,</span><span class="s">&quot;otherEngine&quot;</span><span class="o">);</span>
+<span class="n">tracker</span><span class="o">.</span><span class="na">open</span><span class="o">();</span> <span class="c1">//start tracking</span>
+
+<span class="c1">//the tracker need to be closed if no longer needed</span>
+<span class="n">tracker</span><span class="o">.</span><span class="na">close</span><span class="o">()</span>
+<span class="n">tracker</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
+</pre></div>
+
+
+<p>For most users the EnhancementEngineManager service is sufficient and preferable. Direct use of the EngineTracker is only recommended if one needs only to track some specific engines and especially if one needs to get notified an changes of such engines.</p>
+<p>The implementation of the <code><a href="http://svn.apache.org/repos/asf/incubator/stanbol/trunk/enhancer/chain/weighted/src/main/java/org/apache/stanbol/enhancer/chain/weighted/impl/WeightedChain.java">WeightedChain</a></code> is a good example for the intended usage of the EnginesTracker.</p>
+  </div>
+  
+  <div id="footer">
+    <div class="copyright">
+      <p>
+        Copyright &copy; 2010 The Apache Software Foundation, Licensed under 
+        the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.
+        <br />
+        Apache, Stanbol and the Apache feather and Stanbol logos are trademarks of The Apache Software Foundation.
+      </p>
+    </div>
+  </div>
+  
+</body>
+</html>
+