You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by rw...@apache.org on 2012/03/05 15:31:29 UTC

svn commit: r1297071 [1/2] - in /incubator/stanbol/trunk: enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/rdf/ enhancer/generic/servicesapi/src/main/resources/ enhancer/jersey/src/main/java/org/apache/stanbol/enhancer...

Author: rwesten
Date: Mon Mar  5 14:31:28 2012
New Revision: 1297071

URL: http://svn.apache.org/viewvc?rev=1297071&view=rev
Log:
finally fully implements STANBOL-431

* adds inspection API for the Stanbol Enhancer configuration (see documentation for details)
* adds /enhancer/sparql endpoint allowing to query the Enhancer configuration
* adds {enhancer-endpoint}/ep allowing to retrieve the ExecutionPlan configured for Enhancement Chains
* adds support for making enhancement requests to single Enhancement Engines
* adds a lot of new integration-tests for this features

STANBOL-3: Added owl files for the schmas used by the Stanbol Enhancer

* Enhancer
* Execution Metadata
* Execution Plan
* FISE enhancement structure

other changes

* changed the namespace for ExecutionMetadata from "executionMetadata#" to "executionmetadata"

Added:
    incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/rdf/Enhancer.java   (with props)
    incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/resources/enhancer.owl
    incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/resources/executionmetadata.owl
    incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/resources/executionplan.owl
    incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/resources/fise.owl
    incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/AbstractEnhancerResource.java   (with props)
    incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/AbstractEnhancerUiResource.java   (with props)
    incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/utils/EnhancerUtils.java   (with props)
    incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/imports/enhancersparql.ftl
    incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/AbstractEnhancerUiResource/
    incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/AbstractEnhancerUiResource/index.ftl
      - copied unchanged from r1296703, incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/EnhancerRootResource/index.ftl
    incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/EnhancerRootResource/sparql.ftl
    incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EngineEnhancementRequestTest.java   (with props)
    incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EnhancerConfigurationTest.java   (with props)
    incubator/stanbol/trunk/integration-tests/src/test/resources/
    incubator/stanbol/trunk/integration-tests/src/test/resources/test.pdf   (with props)
    incubator/stanbol/trunk/integration-tests/src/test/resources/testJPEG_EXIF.jpg   (with props)
Removed:
    incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/EnhancerRootResource/index.ftl
Modified:
    incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/rdf/NamespaceEnum.java
    incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/rdf/Properties.java
    incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/rdf/TechnicalClasses.java
    incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/ChainsRootResource.java
    incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnginesRootResource.java
    incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnhancementChainResource.java
    incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnhancementEngineResource.java
    incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnhancementEnginesRootResource.java
    incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnhancerRootResource.java
    incubator/stanbol/trunk/integration-tests/pom.xml
    incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/DefaultChainTest.java
    incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EnhancerTestBase.java
    incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultipartRequestTest.java

Added: incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/rdf/Enhancer.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/rdf/Enhancer.java?rev=1297071&view=auto
==============================================================================
--- incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/rdf/Enhancer.java (added)
+++ incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/rdf/Enhancer.java Mon Mar  5 14:31:28 2012
@@ -0,0 +1,30 @@
+/*
+* 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.
+*/
+package org.apache.stanbol.enhancer.servicesapi.rdf;
+
+import org.apache.clerezza.rdf.core.UriRef;
+
+public class Enhancer {
+
+    public static final UriRef ENHANCEMENT_ENGINE = new UriRef(NamespaceEnum.enhancer+"EnhancementEngine");
+    public static final UriRef ENHANCEMENT_CHAIN = new UriRef(NamespaceEnum.enhancer+"EnhancementChain");
+    public static final UriRef ENHANCER = new UriRef(NamespaceEnum.enhancer+"Enhancer");
+    public static final UriRef HAS_ENGINE = new UriRef(NamespaceEnum.enhancer+"hasEngine");
+    public static final UriRef HAS_CHAIN = new UriRef(NamespaceEnum.enhancer+"hasChain");
+    public static final UriRef HAS_DEFAULT_CHAIN = new UriRef(NamespaceEnum.enhancer+"hasDefaultChain");
+    
+}

Propchange: incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/rdf/Enhancer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/rdf/NamespaceEnum.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/rdf/NamespaceEnum.java?rev=1297071&r1=1297070&r2=1297071&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/rdf/NamespaceEnum.java (original)
+++ incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/rdf/NamespaceEnum.java Mon Mar  5 14:31:28 2012
@@ -18,8 +18,12 @@ package org.apache.stanbol.enhancer.serv
 
 public enum NamespaceEnum {
 
-    // TODO: change the namespace as soon as STANBOL-3 defines a namespace to be used for stanbol
-    enhancer("http://fise.iks-project.eu/ontology/"),
+    /**
+     * The Stanbol Enhancer namespace defining Enhancer, EnhancementEngine and
+     * EnhancementChain. This is NOT the namespace of the enhancement structure.
+     * As EnhancementStrucutre up to now still the old FISE namespace is used.
+     */
+    enhancer("http://stanbol.apache.org/ontology/enhancer/enhancer#"),
     dbpedia_ont("dbpedia-ont", "http://dbpedia.org/ontology/"),
     rdf("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),
     rdfs("http://www.w3.org/2000/01/rdf-schema#"),
@@ -37,10 +41,11 @@ public enum NamespaceEnum {
     /**
      * Namespace for the Stanbol Enhancer Execution Metadata ontology
      */
-    em("http://stanbol.apache.org/ontology/enhancer/executionMetadata#"),
+    em("http://stanbol.apache.org/ontology/enhancer/executionmetadata#"),
     /**
      * The FISE namespace (1st version of the Enhancement Structure).
-     * Currently the same as {@link NamespaceEnum#enhancer}
+     * Will be replaced by the Stanbol Enhancement Structure by a future
+     * release (see STANBOL-3).
      */
     fise("http://fise.iks-project.eu/ontology/"),
     /**

Modified: incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/rdf/Properties.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/rdf/Properties.java?rev=1297071&r1=1297070&r2=1297071&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/rdf/Properties.java (original)
+++ incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/rdf/Properties.java Mon Mar  5 14:31:28 2012
@@ -105,60 +105,63 @@ public class Properties {
      * Refers to the content item the enhancement was extracted form
      */
     public static final UriRef ENHANCER_EXTRACTED_FROM = new UriRef(
-            NamespaceEnum.enhancer + "extracted-from");
+            NamespaceEnum.fise + "extracted-from");
 
     /**
      * the character position of the start of a text selection.
      */
-    public static final UriRef ENHANCER_START = new UriRef(NamespaceEnum.enhancer
+    public static final UriRef ENHANCER_START = new UriRef(NamespaceEnum.fise
             + "start");
 
     /**
      * the character position of the end of a text selection.
      */
-    public static final UriRef ENHANCER_END = new UriRef(NamespaceEnum.enhancer + "end");
+    public static final UriRef ENHANCER_END = new UriRef(NamespaceEnum.fise + "end");
 
     /**
      * The text selected by the text annotation. This is an optional property
      */
     public static final UriRef ENHANCER_SELECTED_TEXT = new UriRef(
-            NamespaceEnum.enhancer + "selected-text");
+            NamespaceEnum.fise + "selected-text");
 
     /**
      * The context (surroundings) of the text selected. (e.g. the sentence
      * containing a person selected by a NLP enhancer)
      */
     public static final UriRef ENHANCER_SELECTION_CONTEXT = new UriRef(
-            NamespaceEnum.enhancer + "selection-context");
+            NamespaceEnum.fise + "selection-context");
 
     /**
      * A positive double value to rank extractions according to the algorithm
      * confidence in the accuracy of the extraction.
      */
-    public static final UriRef ENHANCER_CONFIDENCE = new UriRef(NamespaceEnum.enhancer
+    public static final UriRef ENHANCER_CONFIDENCE = new UriRef(NamespaceEnum.fise
             + "confidence");
 
     /**
      * This refers to the URI identifying the referred named entity
      */
     public static final UriRef ENHANCER_ENTITY_REFERENCE = new UriRef(
-            NamespaceEnum.enhancer + "entity-reference");
+            NamespaceEnum.fise + "entity-reference");
 
     /**
      * This property can be used to specify the type of the entity (Optional)
      */
-    public static final UriRef ENHANCER_ENTITY_TYPE = new UriRef(NamespaceEnum.enhancer
+    public static final UriRef ENHANCER_ENTITY_TYPE = new UriRef(NamespaceEnum.fise
             + "entity-type");
 
     /**
      * The label(s) of the referred entity
      */
     public static final UriRef ENHANCER_ENTITY_LABEL = new UriRef(
-            NamespaceEnum.enhancer + "entity-label");
+            NamespaceEnum.fise + "entity-label");
 
     /**
      * Internet Media Type of a content item.
+     * 
+     * @deprecated dc:FileFormat does not exist
      */
+    @Deprecated
     public static final UriRef DC_FILEFORMAT = new UriRef(NamespaceEnum.dc
             + "FileFormat");
 

Modified: incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/rdf/TechnicalClasses.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/rdf/TechnicalClasses.java?rev=1297071&r1=1297070&r2=1297071&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/rdf/TechnicalClasses.java (original)
+++ incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/rdf/TechnicalClasses.java Mon Mar  5 14:31:28 2012
@@ -30,21 +30,21 @@ public class TechnicalClasses {
      * Type used for all enhancement created by Stanbol Enhancer
      */
     public static final UriRef ENHANCER_ENHANCEMENT = new UriRef(
-            NamespaceEnum.enhancer+"Enhancement");
+            NamespaceEnum.fise+"Enhancement");
 
     /**
      * Type used for annotations on Text created by Stanbol Enhancer. This type is intended
      * to be used in combination with ENHANCER_ENHANCEMENT
      */
     public static final UriRef ENHANCER_TEXTANNOTATION = new UriRef(
-            NamespaceEnum.enhancer+"TextAnnotation");
+            NamespaceEnum.fise+"TextAnnotation");
 
     /**
      * Type used for annotations of named entities. This type is intended
      * to be used in combination with ENHANCER_ENHANCEMENT
      */
     public static final UriRef ENHANCER_ENTITYANNOTATION = new UriRef(
-            NamespaceEnum.enhancer+"EntityAnnotation");
+            NamespaceEnum.fise+"EntityAnnotation");
     
     /**
      * Type used for annotations documents. This type is intended
@@ -58,7 +58,7 @@ public class TechnicalClasses {
      * in the document (like a traditional entity occurrence would).
      */
     public static final UriRef ENHANCER_TOPICANNOTATION = new UriRef(
-            NamespaceEnum.enhancer+"TopicAnnotation");
+            NamespaceEnum.fise+"TopicAnnotation");
 
     /**
      * To be used as a type pour any semantic knowledge extraction
@@ -89,7 +89,7 @@ public class TechnicalClasses {
      * Mapping of Categories</a> for more Information)
      */
     public static final UriRef ENHANCER_CATEGORY = new UriRef(
-            NamespaceEnum.enhancer + "Category");
+            NamespaceEnum.fise + "Category");
 
     private TechnicalClasses() {
     }

Added: incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/resources/enhancer.owl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/resources/enhancer.owl?rev=1297071&view=auto
==============================================================================
--- incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/resources/enhancer.owl (added)
+++ incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/resources/enhancer.owl Mon Mar  5 14:31:28 2012
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<rdf:RDF
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns="http://stanbol.apache.org/ontology/enhancer/enhancer#"
+    xmlns:owl="http://www.w3.org/2002/07/owl#"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+  xml:base="http://stanbol.apache.org/ontology/enhancer/enhancer">
+  <owl:Ontology rdf:about="">
+    <rdfs:comment xml:lang="en">Ontology definig base concepts of the Stanbol Enhancer</rdfs:comment>
+  </owl:Ontology>
+  <owl:Class rdf:ID="EnhancementChain">
+    <rdfs:label xml:lang="en">Enhancement Chain</rdfs:label>
+    <rdfs:comment xml:lang="en">A EnhancementChain is a specific configuration on how parsed Content is enhanced by the Stanbol Enhancer</rdfs:comment>
+  </owl:Class>
+  <owl:Class rdf:ID="Enhancer">
+    <rdfs:label xml:lang="en">Enhancer</rdfs:label>
+    <rdfs:comment xml:lang="en">A Stanbol Enhancer instance. The Resource represents the RESTful Service URL.</rdfs:comment>
+  </owl:Class>
+  <owl:Class rdf:ID="EnhancementEngine">
+    <rdfs:label xml:lang="en">Enhancement Engine</rdfs:label>
+    <rdfs:comment xml:lang="en">EnhancementEngines are responsible for extracting knowledge from Content parsed to the Stanbol Enhancer</rdfs:comment>
+  </owl:Class>
+  <owl:FunctionalProperty rdf:ID="hasDefautChain">
+    <rdfs:subPropertyOf>
+      <owl:InverseFunctionalProperty rdf:ID="hasChain"/>
+    </rdfs:subPropertyOf>
+    <rdfs:label xml:lang="en">has default chain</rdfs:label>
+    <rdfs:comment xml:lang="en">The default chain is the EnhancementChain used to enhance Content parsed to the main /enhancer RESTful service.</rdfs:comment>
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#InverseFunctionalProperty"/>
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
+  </owl:FunctionalProperty>
+  <owl:InverseFunctionalProperty rdf:ID="hasEngine">
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
+    <rdfs:range rdf:resource="#EnhancementEngine"/>
+    <rdfs:domain rdf:resource="#Enhancer"/>
+    <rdfs:label xml:lang="en">has engine</rdfs:label>
+    <rdfs:comment xml:lang="en">links to an EnhancementEngine</rdfs:comment>
+  </owl:InverseFunctionalProperty>
+  <owl:InverseFunctionalProperty rdf:about="#hasChain">
+    <rdfs:label xml:lang="en">has chain</rdfs:label>
+    <rdfs:comment xml:lang="en">links to a configured EnhancementChain</rdfs:comment>
+    <rdfs:domain rdf:resource="#Enhancer"/>
+    <rdfs:range rdf:resource="#EnhancementChain"/>
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
+  </owl:InverseFunctionalProperty>
+</rdf:RDF>
\ No newline at end of file

Added: incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/resources/executionmetadata.owl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/resources/executionmetadata.owl?rev=1297071&view=auto
==============================================================================
--- incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/resources/executionmetadata.owl (added)
+++ incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/resources/executionmetadata.owl Mon Mar  5 14:31:28 2012
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<rdf:RDF
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns:protege="http://protege.stanford.edu/plugins/owl/protege#"
+    xmlns:ep="http://stanbol.apache.org/ontology/enhancer/executionplan#"
+    xmlns:owl="http://www.w3.org/2002/07/owl#"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+    xmlns="http://stanbol.apache.org/ontology/enhancer/executionmetadata#"
+    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+  xml:base="http://stanbol.apache.org/ontology/enhancer/executionmetadata">
+  <owl:Ontology rdf:about="">
+    <owl:imports rdf:resource="http://stanbol.apache.org/ontology/enhancer/executionplan"/>
+    <rdfs:comment xml:lang="en">Allows to describe metadata about an actual execution of an EnhancementChain by the Stanbol Enhancer for a parsed ContentItem</rdfs:comment>
+  </owl:Ontology>
+  <owl:Class rdf:ID="ExecutionStatus">
+    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
+    >Execution Status</rdfs:label>
+    <rdfs:comment xml:lang="en">Class used to represent the status of an Execution</rdfs:comment>
+  </owl:Class>
+  <owl:Class rdf:ID="Execution">
+    <rdfs:label xml:lang="en">Execution</rdfs:label>
+    <rdfs:comment xml:lang="en">An execution (abstract)</rdfs:comment>
+  </owl:Class>
+  <owl:Class rdf:ID="ChainExecution">
+    <rdfs:comment xml:lang="en">An execution of an EnhancementChain</rdfs:comment>
+    <rdfs:subClassOf rdf:resource="#Execution"/>
+    <rdfs:label xml:lang="en">EnhancementEngine Execution</rdfs:label>
+  </owl:Class>
+  <owl:Class rdf:ID="EngineExecution">
+    <rdfs:label xml:lang="en">EnhancementEngine Execution</rdfs:label>
+    <rdfs:comment xml:lang="en">An execution of an Enhancement Engine</rdfs:comment>
+    <rdfs:subClassOf rdf:resource="#Execution"/>
+  </owl:Class>
+  <owl:DatatypeProperty rdf:ID="statusMessage">
+    <rdfs:domain rdf:resource="#Execution"/>
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:label xml:lang="en">status message</rdfs:label>
+    <rdfs:comment xml:lang="en">Allows to provide a status message for an execution (may be multi valued)</rdfs:comment>
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty rdf:ID="started">
+    <rdfs:label xml:lang="en">started</rdfs:label>
+    <rdfs:comment xml:lang="en">Time point when the exection started (also available when skipped)</rdfs:comment>
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#dateTime"/>
+    <rdfs:domain rdf:resource="#Execution"/>
+  </owl:DatatypeProperty>
+  <owl:TransitiveProperty rdf:ID="executionPart">
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty"/>
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
+    <rdfs:comment xml:lang="en">Property that links an Execution to its parent ChainExecution (e.g. the Execution of single Engines to the Execution of the EnhancementChain)</rdfs:comment>
+    <rdfs:range rdf:resource="#ChainExecution"/>
+    <rdfs:domain rdf:resource="#Execution"/>
+  </owl:TransitiveProperty>
+  <owl:FunctionalProperty rdf:ID="enhancedBy">
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
+    <rdfs:range rdf:resource="#ChainExecution"/>
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#InverseFunctionalProperty"/>
+    <rdfs:label xml:lang="en">enhanced by</rdfs:label>
+    <owl:inverseOf>
+      <owl:InverseFunctionalProperty rdf:ID="enhances"/>
+    </owl:inverseOf>
+    <rdfs:comment xml:lang="en">Property that links from the ContentItem to the ChainExecution (defining the root node of the execution metadata)</rdfs:comment>
+  </owl:FunctionalProperty>
+  <owl:FunctionalProperty rdf:ID="executionNode">
+    <rdfs:domain rdf:resource="#EngineExecution"/>
+    <rdfs:range rdf:resource="http://stanbol.apache.org/ontology/enhancer/executionplan#ExecutionNode"/>
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
+    <rdfs:label xml:lang="en">execution node</rdfs:label>
+    <rdfs:comment xml:lang="en">Property that links from the EngineExecution to the ExecutionNode of the ExecutionPlan</rdfs:comment>
+  </owl:FunctionalProperty>
+  <owl:FunctionalProperty rdf:ID="executionPlan">
+    <rdfs:label xml:lang="en">execution plan</rdfs:label>
+    <rdfs:comment xml:lang="en">Property that links from the ChainExecution to the ExecutionPlan.</rdfs:comment>
+    <rdfs:domain rdf:resource="#ChainExecution"/>
+    <rdfs:range rdf:resource="http://stanbol.apache.org/ontology/enhancer/executionplan#ExecutionPlan"/>
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
+  </owl:FunctionalProperty>
+  <owl:FunctionalProperty rdf:ID="status">
+    <rdfs:comment xml:lang="en">The current/final status of an Execution. Allowed values are the instances of ExectionStatus defined by this Ontology</rdfs:comment>
+    <rdfs:label xml:lang="en">status</rdfs:label>
+    <rdfs:range rdf:resource="#ExecutionStatus"/>
+    <rdfs:domain rdf:resource="#Execution"/>
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
+  </owl:FunctionalProperty>
+  <owl:FunctionalProperty rdf:ID="isDefaultChain">
+    <rdfs:comment xml:lang="en">if the ChainExecution represents an execution of the default EnhancementChain of the Stanbol Enhancer.</rdfs:comment>
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#boolean"/>
+    <rdfs:domain rdf:resource="#ChainExecution"/>
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/>
+    <rdfs:label xml:lang="en">is default Chain</rdfs:label>
+  </owl:FunctionalProperty>
+  <owl:FunctionalProperty rdf:ID="completed">
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/>
+    <rdfs:label xml:lang="en">completed</rdfs:label>
+    <rdfs:comment xml:lang="en">time point when the execution completed (succeded, skipped or failed).</rdfs:comment>
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#dateTime"/>
+    <rdfs:domain rdf:resource="#Execution"/>
+  </owl:FunctionalProperty>
+  <owl:InverseFunctionalProperty rdf:about="#enhances">
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty"/>
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
+    <rdfs:label xml:lang="en">enhances</rdfs:label>
+    <rdfs:comment xml:lang="en">Property that links from the ChainExecution to the enhanced ContentItem</rdfs:comment>
+    <rdfs:domain rdf:resource="#ChainExecution"/>
+    <owl:inverseOf rdf:resource="#enhancedBy"/>
+  </owl:InverseFunctionalProperty>
+  <ExecutionStatus rdf:ID="StatusInProgress">
+    <rdfs:comment xml:lang="en">ExecutionStatus indicating that the execution is in progress</rdfs:comment>
+    <rdfs:label xml:lang="en">in progress</rdfs:label>
+  </ExecutionStatus>
+  <ExecutionStatus rdf:ID="StatusSkipped">
+    <rdfs:label xml:lang="en">skipped</rdfs:label>
+    <rdfs:comment xml:lang="en">ExecutionStatus indicating that the execution was skipped</rdfs:comment>
+  </ExecutionStatus>
+  <ExecutionStatus rdf:ID="StatusSheduled">
+    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
+    >sheduled</rdfs:label>
+    <rdfs:comment xml:lang="en">ExecutionStatus indicating that the execution is scheduled, but has not yet started</rdfs:comment>
+  </ExecutionStatus>
+  <ExecutionStatus rdf:ID="StatusCompleted">
+    <rdfs:label xml:lang="en">completed</rdfs:label>
+    <rdfs:comment xml:lang="en">ExecutionStatus indicating that the execution has completed successfully</rdfs:comment>
+  </ExecutionStatus>
+  <ExecutionStatus rdf:ID="StatusFailed">
+    <rdfs:comment xml:lang="en">ExecutionStatus indicating that the execution has failed</rdfs:comment>
+    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
+    >failed</rdfs:label>
+  </ExecutionStatus>
+</rdf:RDF>
\ No newline at end of file

Added: incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/resources/executionplan.owl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/resources/executionplan.owl?rev=1297071&view=auto
==============================================================================
--- incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/resources/executionplan.owl (added)
+++ incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/resources/executionplan.owl Mon Mar  5 14:31:28 2012
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<rdf:RDF
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns="http://stanbol.apache.org/ontology/enhancer/executionplan#"
+    xmlns:owl="http://www.w3.org/2002/07/owl#"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+  xml:base="http://stanbol.apache.org/ontology/enhancer/executionplan">
+  <owl:Ontology rdf:about="">
+    <rdfs:comment xml:lang="en">The Stanbol Execution Plan</rdfs:comment>
+  </owl:Ontology>
+  <owl:Class rdf:ID="ExecutionPlan">
+    <rdfs:comment xml:lang="en">Defines how an EnhancementChain executes EnhancementEngines to enhance content parsed to the Stanbol Enhancer.</rdfs:comment>
+  </owl:Class>
+  <owl:Class rdf:ID="ExecutionNode">
+    <rdfs:comment xml:lang="en">An Enhancement Engine execution</rdfs:comment>
+  </owl:Class>
+  <owl:TransitiveProperty rdf:ID="dependsOn">
+    <rdfs:comment xml:lang="en">defines that an ExecutionNode depends on the execution of an other (transitive)</rdfs:comment>
+    <rdfs:range rdf:resource="#ExecutionNode"/>
+    <rdfs:domain rdf:resource="#ExecutionNode"/>
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
+  </owl:TransitiveProperty>
+  <owl:FunctionalProperty rdf:ID="chain">
+    <rdfs:comment xml:lang="en">the name of the chain</rdfs:comment>
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/>
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ExecutionPlan"/>
+  </owl:FunctionalProperty>
+  <owl:FunctionalProperty rdf:ID="engine">
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/>
+    <rdfs:comment xml:lang="en">the name of the engine</rdfs:comment>
+    <rdfs:domain rdf:resource="#ExecutionNode"/>
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+  </owl:FunctionalProperty>
+  <owl:FunctionalProperty rdf:ID="optional">
+    <rdfs:comment xml:lang="en">if the execution of this node is optional or not.</rdfs:comment>
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#boolean"/>
+    <rdfs:domain rdf:resource="#ExecutionNode"/>
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/>
+  </owl:FunctionalProperty>
+  <owl:InverseFunctionalProperty rdf:ID="hasExecutionNode">
+    <rdfs:range rdf:resource="#ExecutionNode"/>
+    <rdfs:domain rdf:resource="#ExecutionPlan"/>
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
+    <rdfs:comment xml:lang="en">links to an ExecutionNode</rdfs:comment>
+  </owl:InverseFunctionalProperty>
+</rdf:RDF>

Added: incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/resources/fise.owl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/resources/fise.owl?rev=1297071&view=auto
==============================================================================
--- incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/resources/fise.owl (added)
+++ incubator/stanbol/trunk/enhancer/generic/servicesapi/src/main/resources/fise.owl Mon Mar  5 14:31:28 2012
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<rdf:RDF
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns:protege="http://protege.stanford.edu/plugins/owl/protege#"
+    xmlns:owl="http://www.w3.org/2002/07/owl#"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+    xmlns="http://fise.iks-project.eu/ontology/"
+  xml:base="http://fise.iks-project.eu/ontology/">
+  <owl:Ontology rdf:about="">
+    <rdfs:comment xml:lang="en">The FISE Enhancement Structure</rdfs:comment>
+  </owl:Ontology>
+  <owl:Class rdf:about="http://fise.iks-project.eu/ontology/TextAnnotation">
+    <rdfs:label xml:lang="en">Text Annotation</rdfs:label>
+    <rdfs:subClassOf>
+      <owl:Class rdf:about="http://fise.iks-project.eu/ontology/Enhancement"/>
+    </rdfs:subClassOf>
+    <rdfs:comment xml:lang="en">A TextAnnotation</rdfs:comment>
+  </owl:Class>
+  <owl:Class rdf:about="http://fise.iks-project.eu/ontology/TopicAnnotation">
+    <rdfs:comment xml:lang="en">A Topic Annotation</rdfs:comment>
+    <rdfs:label xml:lang="en">Topic Annotation</rdfs:label>
+    <rdfs:subClassOf>
+      <owl:Class rdf:about="http://fise.iks-project.eu/ontology/Enhancement"/>
+    </rdfs:subClassOf>
+  </owl:Class>
+  <owl:Class rdf:about="http://fise.iks-project.eu/ontology/EntityAnnotation">
+    <rdfs:label xml:lang="en">Entity Annotation</rdfs:label>
+    <rdfs:comment xml:lang="en">An Entity Annotation</rdfs:comment>
+    <rdfs:subClassOf>
+      <owl:Class rdf:about="http://fise.iks-project.eu/ontology/Enhancement"/>
+    </rdfs:subClassOf>
+  </owl:Class>
+  <owl:Class rdf:about="http://fise.iks-project.eu/ontology/Enhancement">
+    <rdfs:comment xml:lang="en">An Enhancement</rdfs:comment>
+    <rdfs:label xml:lang="en">Enhancement</rdfs:label>
+  </owl:Class>
+  <owl:ObjectProperty rdf:about="http://fise.iks-project.eu/ontology/entity-type">
+    <rdfs:domain rdf:resource="http://fise.iks-project.eu/ontology/EntityAnnotation"/>
+    <rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
+    <rdfs:comment xml:lang="en">the types of the referenced entity</rdfs:comment>
+  </owl:ObjectProperty>
+  <owl:DatatypeProperty rdf:about="http://fise.iks-project.eu/ontology/entity-label">
+    <rdfs:domain rdf:resource="http://fise.iks-project.eu/ontology/EntityAnnotation"/>
+    <rdfs:comment xml:lang="en">the label(s) of the referenced Entity</rdfs:comment>
+  </owl:DatatypeProperty>
+  <owl:FunctionalProperty rdf:about="http://fise.iks-project.eu/ontology/end">
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/>
+    <rdfs:comment xml:lang="en">The end char position of a selection within the text</rdfs:comment>
+    <rdfs:label xml:lang="en">end</rdfs:label>
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#int"/>
+    <rdfs:domain rdf:resource="http://fise.iks-project.eu/ontology/TextAnnotation"/>
+  </owl:FunctionalProperty>
+  <owl:FunctionalProperty rdf:about="http://fise.iks-project.eu/ontology/start">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#int"/>
+    <rdfs:domain rdf:resource="http://fise.iks-project.eu/ontology/TextAnnotation"/>
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/>
+    <rdfs:comment xml:lang="en">The start char position of a selection within the text</rdfs:comment>
+    <rdfs:label xml:lang="en">start</rdfs:label>
+  </owl:FunctionalProperty>
+  <owl:FunctionalProperty rdf:about="http://fise.iks-project.eu/ontology/extracted-from">
+    <rdfs:comment xml:lang="en">refers to the ContentItem this Enhancement was extracted from</rdfs:comment>
+    <rdfs:label xml:lang="en">extracted from</rdfs:label>
+    <rdfs:domain rdf:resource="http://fise.iks-project.eu/ontology/Enhancement"/>
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
+  </owl:FunctionalProperty>
+  <owl:FunctionalProperty rdf:about="http://fise.iks-project.eu/ontology/selected-text">
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/>
+    <rdfs:comment xml:lang="en">the selected text</rdfs:comment>
+    <rdfs:label xml:lang="en">selected text</rdfs:label>
+    <rdfs:domain rdf:resource="http://fise.iks-project.eu/ontology/TextAnnotation"/>
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+  </owl:FunctionalProperty>
+  <owl:FunctionalProperty rdf:about="http://fise.iks-project.eu/ontology/entity-reference">
+    <rdfs:comment xml:lang="en">links to the URI of the referenced Entity</rdfs:comment>
+    <rdfs:label xml:lang="en">entity reference</rdfs:label>
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
+    <rdfs:domain rdf:resource="http://fise.iks-project.eu/ontology/EntityAnnotation"/>
+  </owl:FunctionalProperty>
+  <owl:FunctionalProperty rdf:about="http://fise.iks-project.eu/ontology/confidence">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#float"/>
+    <rdfs:domain rdf:resource="http://fise.iks-project.eu/ontology/Enhancement"/>
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/>
+    <rdfs:comment xml:lang="en">The confidence of the enhancement</rdfs:comment>
+    <rdfs:label xml:lang="en">confidence</rdfs:label>
+  </owl:FunctionalProperty>
+  <owl:FunctionalProperty rdf:about="http://fise.iks-project.eu/ontology/selection-context">
+    <rdfs:label xml:lang="en">selection context</rdfs:label>
+    <rdfs:comment xml:lang="en">The context of the selected text.</rdfs:comment>
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="http://fise.iks-project.eu/ontology/TextAnnotation"/>
+    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/>
+  </owl:FunctionalProperty>
+</rdf:RDF>
\ No newline at end of file

Added: incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/AbstractEnhancerResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/AbstractEnhancerResource.java?rev=1297071&view=auto
==============================================================================
--- incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/AbstractEnhancerResource.java (added)
+++ incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/AbstractEnhancerResource.java Mon Mar  5 14:31:28 2012
@@ -0,0 +1,225 @@
+/*
+ * 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.
+ */
+package org.apache.stanbol.enhancer.jersey.resource;
+
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+import static javax.ws.rs.core.MediaType.WILDCARD;
+import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.N3;
+import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.N_TRIPLE;
+import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.RDF_JSON;
+import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.RDF_XML;
+import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.TURTLE;
+import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.X_TURTLE;
+import static org.apache.stanbol.commons.web.base.CorsHelper.addCORSOrigin;
+import static org.apache.stanbol.commons.web.base.CorsHelper.enableCORS;
+import static org.apache.stanbol.enhancer.jersey.utils.EnhancementPropertiesHelper.INCLUDE_EXECUTION_METADATA;
+import static org.apache.stanbol.enhancer.jersey.utils.EnhancementPropertiesHelper.OMIT_METADATA;
+import static org.apache.stanbol.enhancer.jersey.utils.EnhancementPropertiesHelper.OMIT_PARSED_CONTENT;
+import static org.apache.stanbol.enhancer.jersey.utils.EnhancementPropertiesHelper.OUTPUT_CONTENT;
+import static org.apache.stanbol.enhancer.jersey.utils.EnhancementPropertiesHelper.OUTPUT_CONTENT_PART;
+import static org.apache.stanbol.enhancer.jersey.utils.EnhancementPropertiesHelper.RDF_FORMAT;
+import static org.apache.stanbol.enhancer.jersey.utils.EnhancementPropertiesHelper.getEnhancementProperties;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.ServletContext;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.HttpMethod;
+import javax.ws.rs.OPTIONS;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
+
+import org.apache.clerezza.rdf.core.MGraph;
+import org.apache.clerezza.rdf.core.TripleCollection;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.stanbol.commons.web.base.ContextHelper;
+import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
+import org.apache.stanbol.commons.web.base.utils.MediaTypeUtil;
+import org.apache.stanbol.enhancer.jersey.utils.EnhancementPropertiesHelper;
+import org.apache.stanbol.enhancer.servicesapi.Chain;
+import org.apache.stanbol.enhancer.servicesapi.ChainException;
+import org.apache.stanbol.enhancer.servicesapi.ChainManager;
+import org.apache.stanbol.enhancer.servicesapi.ContentItem;
+import org.apache.stanbol.enhancer.servicesapi.EngineException;
+import org.apache.stanbol.enhancer.servicesapi.EnhancementEngineManager;
+import org.apache.stanbol.enhancer.servicesapi.EnhancementException;
+import org.apache.stanbol.enhancer.servicesapi.EnhancementJobManager;
+import org.apache.stanbol.enhancer.servicesapi.NoSuchPartException;
+import org.apache.stanbol.enhancer.servicesapi.rdf.ExecutionMetadata;
+
+/**
+ * Abstract super class for all enhancement endpoints that do not use/support
+ * the default Enhancer Web UI.<p>
+ * This is mainly used for supporting enhancement requests to single
+ * enhancement engines.
+ * 
+ * @author Rupert Westenthaler
+ *
+ */
+public abstract class AbstractEnhancerResource extends BaseStanbolResource {
+
+    protected final EnhancementJobManager jobManager;
+    protected final EnhancementEngineManager engineManager;
+    protected final ChainManager chainManager;
+
+    public AbstractEnhancerResource(@Context ServletContext context) {
+        super();
+        // bind the job manager by looking it up from the servlet request context
+        jobManager = ContextHelper.getServiceFromContext(EnhancementJobManager.class, context);
+        chainManager = ContextHelper.getServiceFromContext(ChainManager.class, context);
+        engineManager = ContextHelper.getServiceFromContext(EnhancementEngineManager.class, context);
+    }
+    /**
+     * Getter for the Enhancement {@link Chain}
+     * @return the enhancement chain. MUST NOT return <code>null</code>
+     * @throws ChainException if the Chain is currently not available
+     */
+    protected abstract Chain getChain() throws ChainException;
+    
+    @OPTIONS
+    public Response handleCorsPreflight(@Context HttpHeaders headers) {
+        ResponseBuilder res = Response.ok();
+        enableCORS(servletContext, res, headers);
+        return res.build();
+    }
+
+    @OPTIONS
+    @Path("/ep")
+    public Response handleEpCorsPreflight(@Context HttpHeaders headers) {
+        ResponseBuilder res = Response.ok();
+        enableCORS(servletContext, res, headers,HttpMethod.OPTIONS,HttpMethod.GET);
+        return res.build();
+    }
+
+    @GET
+    @Path("/ep")
+    @Produces(value = {APPLICATION_JSON, N3, N_TRIPLE, RDF_JSON, RDF_XML, TURTLE, X_TURTLE})
+    public Response getExecutionPlan(@Context HttpHeaders headers) {
+        ResponseBuilder res;
+        Chain chain = null;
+        try {
+            chain = getChain();
+            res = Response.ok(chain.getExecutionPlan());
+        } catch (ChainException e) {
+            String chainName = chain == null ? "" : ("'"+chain.getName()+"' ");
+            res = Response.status(Response.Status.INTERNAL_SERVER_ERROR)
+                    .entity("The Enhancement Chain "+chainName+"is currently" +
+                    		"not executeable (message: "+e.getMessage()+")!");
+        }
+        addCORSOrigin(servletContext, res, headers);
+        return res.build();
+        
+        
+    }
+
+    /**
+     * Media-Type based handling of the raw POST data.
+     * 
+     * @param data
+     *            binary payload to analyze
+     * @param uri
+     *            optional URI for the content items (to be used as an identifier in the enhancement graph)
+     * @throws EngineException
+     *             if the content is somehow corrupted
+     * @throws IOException
+     */
+    @POST
+    @Consumes(WILDCARD)
+    public Response enhanceFromData(ContentItem ci,
+            @QueryParam(value = "uri") String uri,
+            @QueryParam(value = "executionmetadata") boolean inclExecMetadata,
+            @QueryParam(value = "outputContent") Set<String> mediaTypes,
+            @QueryParam(value = "omitParsed") boolean omitParsed,
+            @QueryParam(value = "outputContentPart") Set<String> contentParts,
+            @QueryParam(value = "omitMetadata") boolean omitMetadata,
+            @QueryParam(value = "rdfFormat") String rdfFormat,
+            @Context HttpHeaders headers) throws EnhancementException, IOException {
+        Map<String,Object> enhancementProperties = getEnhancementProperties(ci);
+        enhancementProperties.put(INCLUDE_EXECUTION_METADATA, inclExecMetadata);
+        if(mediaTypes != null && !mediaTypes.isEmpty()){
+            enhancementProperties.put(OUTPUT_CONTENT, mediaTypes);
+        }
+        enhancementProperties.put(OMIT_PARSED_CONTENT, omitParsed);
+        if(contentParts != null && !contentParts.isEmpty()){
+            Set<UriRef> outputContentParts = new HashSet<UriRef>();
+            for(String contentPartUri : contentParts){
+                if(contentPartUri != null && !contentPartUri.isEmpty()){
+                    if("*".equals(contentPartUri)){
+                        outputContentParts.add(null); //indicated wildcard
+                    } else {
+                        outputContentParts.add(new UriRef(contentPartUri));
+                    }
+                }
+            }
+            enhancementProperties.put(OUTPUT_CONTENT_PART, outputContentParts);
+        }
+        enhancementProperties.put(OMIT_METADATA, omitMetadata);
+        if(rdfFormat != null && !rdfFormat.isEmpty()){
+            try {
+                enhancementProperties.put(RDF_FORMAT,MediaType.valueOf(rdfFormat).toString());
+            } catch (IllegalArgumentException e) {
+                throw new WebApplicationException(e, 
+                    Response.status(Response.Status.BAD_REQUEST)
+                    .entity(String.format("Unable to parse MediaType form parameter" +
+                    		"rdfFormat=%s",rdfFormat))
+                    .build());
+            }
+        }
+        enhance(ci);
+        ResponseBuilder rb = Response.ok(ci);
+        MediaType mediaType = MediaTypeUtil.getAcceptableMediaType(headers, null);
+        if (mediaType != null) {
+            rb.header(HttpHeaders.CONTENT_TYPE, mediaType);
+        }
+        addCORSOrigin(servletContext, rb, headers);
+        return rb.build();
+    }
+
+    /**
+     * Enhances the parsed ContentItem
+     * @param ci the content item to enhance
+     * @throws EnhancementException
+     */
+    protected void enhance(ContentItem ci) throws EnhancementException {
+        Map<String,Object> enhancementPropertis = EnhancementPropertiesHelper.getEnhancementProperties(ci);
+        if (jobManager != null) {
+            jobManager.enhanceContent(ci, getChain());
+        }
+        MGraph graph = ci.getMetadata();
+        Boolean includeExecutionMetadata = (Boolean)enhancementPropertis.get(INCLUDE_EXECUTION_METADATA);
+        if (includeExecutionMetadata != null && includeExecutionMetadata.booleanValue()) {
+            try {
+                graph.addAll(ci.getPart(ExecutionMetadata.CHAIN_EXECUTION, TripleCollection.class));
+            } catch (NoSuchPartException e) {
+                // no executionMetadata available
+            }
+        }
+    }
+
+}
\ No newline at end of file

Propchange: incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/AbstractEnhancerResource.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/AbstractEnhancerUiResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/AbstractEnhancerUiResource.java?rev=1297071&view=auto
==============================================================================
--- incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/AbstractEnhancerUiResource.java (added)
+++ incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/AbstractEnhancerUiResource.java Mon Mar  5 14:31:28 2012
@@ -0,0 +1,240 @@
+/*
+ * 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.
+ */
+package org.apache.stanbol.enhancer.jersey.resource;
+
+import static javax.ws.rs.core.MediaType.APPLICATION_FORM_URLENCODED;
+import static javax.ws.rs.core.MediaType.TEXT_HTML;
+import static javax.ws.rs.core.MediaType.TEXT_PLAIN;
+import static org.apache.stanbol.commons.web.base.CorsHelper.addCORSOrigin;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import javax.servlet.ServletContext;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
+
+import org.apache.clerezza.rdf.core.Graph;
+import org.apache.clerezza.rdf.core.NonLiteral;
+import org.apache.clerezza.rdf.core.TripleCollection;
+import org.apache.clerezza.rdf.core.access.TcManager;
+import org.apache.clerezza.rdf.core.serializedform.Serializer;
+import org.apache.stanbol.commons.web.base.ContextHelper;
+import org.apache.stanbol.enhancer.servicesapi.Chain;
+import org.apache.stanbol.enhancer.servicesapi.ChainException;
+import org.apache.stanbol.enhancer.servicesapi.ContentItem;
+import org.apache.stanbol.enhancer.servicesapi.EngineException;
+import org.apache.stanbol.enhancer.servicesapi.EnhancementEngine;
+import org.apache.stanbol.enhancer.servicesapi.EnhancementException;
+import org.apache.stanbol.enhancer.servicesapi.helper.ExecutionPlanHelper;
+import org.apache.stanbol.enhancer.servicesapi.helper.InMemoryContentItem;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.sun.jersey.api.view.Viewable;
+
+/**
+ * Abstract super class for all Enhancer endpoint that do also provide the
+ * Stanbol Enhancer Web UI. This includes "/enhancer", /enhancer/chain/{name}
+ * and "/engines".
+ * 
+ * @author Rupert Westenthaler
+ *
+ */
+public abstract class AbstractEnhancerUiResource extends AbstractEnhancerResource {
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+    protected final TcManager tcManager;
+    protected final Serializer serializer;
+    private LinkedHashSet<ExecutionNode> _executionNodes;
+    private LinkedHashSet<ExecutionNode> _activeNodes;
+    protected final Chain chain;
+
+    public AbstractEnhancerUiResource(String chainName,ServletContext context) {
+        super(context);
+        serializer = ContextHelper.getServiceFromContext(Serializer.class, context);
+        tcManager = ContextHelper.getServiceFromContext(TcManager.class, context);
+        if(chainName == null){
+            chain = chainManager.getDefault();
+        } else {
+            this.chain = chainManager.getChain(chainName);
+        }
+        if(this.chain == null){
+            throw new WebApplicationException(Response.Status.NOT_FOUND);
+        }
+    }
+
+    @GET
+    @Produces(TEXT_HTML)
+    public Response get(@Context HttpHeaders headers) {
+        ResponseBuilder res = Response.ok(new Viewable("index", this), TEXT_HTML);
+        addCORSOrigin(servletContext, res, headers);
+        return res.build();
+    }
+
+    /**
+     * Form-based OpenCalais-compatible interface
+     * 
+     * TODO: should we parse the OpenCalais paramsXML and find the closest Stanbol Enhancer semantics too?
+     * 
+     * Note: the format parameter is not part of the official API
+     * 
+     * @throws EngineException
+     *             if the content is somehow corrupted
+     * @throws IOException
+     */
+    @POST
+    @Consumes(APPLICATION_FORM_URLENCODED)
+    public Response enhanceFromForm(@FormParam("content") String content, @FormParam("format") String format, @FormParam("ajax") boolean buildAjaxview, @Context HttpHeaders headers) throws EnhancementException,
+                                                                                      IOException {
+                                                                                        log.info("enhance from From: " + content);
+                                                                                        ContentItem ci = new InMemoryContentItem(content.getBytes("UTF-8"), TEXT_PLAIN);
+                                                                                        if(!buildAjaxview){ //rewrite to a normal EnhancementRequest
+                                                                                            return enhanceFromData(ci, null, false, null, false, null, false, null, headers);
+                                                                                        } else { //enhance and build the AJAX response
+                                                                                            enhance(ci);
+                                                                                            ContentItemResource contentItemResource = new ContentItemResource(null, ci, uriInfo, "",
+                                                                                                    tcManager, serializer, servletContext);
+                                                                                            contentItemResource.setRdfSerializationFormat(format);
+                                                                                            Viewable ajaxView = new Viewable("/ajax/contentitem", contentItemResource);
+                                                                                            ResponseBuilder rb = Response.ok(ajaxView);
+                                                                                            rb.header(HttpHeaders.CONTENT_TYPE, TEXT_HTML + "; charset=UTF-8");
+                                                                                            addCORSOrigin(servletContext, rb, headers);
+                                                                                            return rb.build();
+                                                                                        }
+                                                                                    }
+
+    public boolean isEngineActive(String name) {
+        return engineManager.isEngine(name);
+    }
+
+    public URI getServiceUrl() {
+        return uriInfo.getAbsolutePath();
+    }
+
+    /**
+     * Getter for the executionNodes
+     * 
+     * @return
+     */
+    public Set<ExecutionNode> getExecutionNodes() {
+        if (_executionNodes == null) {
+            Graph ep;
+            try {
+                ep = chain.getExecutionPlan();
+            } catch (ChainException e) {
+                ep = null;
+            }
+            if (ep != null) {
+                _executionNodes = new LinkedHashSet<ExecutionNode>();
+                Set<NonLiteral> processed = new HashSet<NonLiteral>();
+                Set<NonLiteral> next;
+                do {
+                    next = ExecutionPlanHelper.getExecutable(ep, processed);
+                    for (NonLiteral node : next) {
+                        _executionNodes.add(new ExecutionNode(ep, node));
+                    }
+                    processed.addAll(next);
+                } while (!next.isEmpty());
+            }
+        }
+        return _executionNodes;
+    }
+
+    public Set<ExecutionNode> getActiveNodes() {
+        if (_activeNodes == null) {
+            Set<ExecutionNode> ens = getExecutionNodes();
+            if (ens != null) {
+                _activeNodes = new LinkedHashSet<ExecutionNode>();
+                for (ExecutionNode en : ens) {
+                    if (en.isEngineActive()) {
+                        _activeNodes.add(en);
+                    }
+                }
+            }
+        }
+        return _activeNodes;
+    }
+
+    public Chain getChain() {
+        return chain;
+    }
+
+    public boolean isChainAvailable() {
+        Set<ExecutionNode> nodes = getExecutionNodes();
+        if (nodes == null) {
+            return false;
+        }
+        for (ExecutionNode node : getExecutionNodes()) {
+            if (!node.isOptional() && !node.isEngineActive()) {
+                return false;
+            }
+        }
+        return true;
+    }
+    public class ExecutionNode {
+
+        private final NonLiteral node;
+        private final TripleCollection ep;
+        private final boolean optional;
+        private final String engineName;
+
+        public ExecutionNode(TripleCollection executionPlan, NonLiteral node) {
+            this.node = node;
+            this.ep = executionPlan;
+            this.optional = ExecutionPlanHelper.isOptional(ep, node);
+            this.engineName = ExecutionPlanHelper.getEngine(ep, node);
+        }
+
+        public boolean isOptional() {
+            return optional;
+        }
+
+        public String getEngineName() {
+            return engineName;
+        }
+
+        public EnhancementEngine getEngine() {
+            return engineManager.getEngine(engineName);
+        }
+
+        public boolean isEngineActive() {
+            return engineManager.isEngine(engineName);
+        }
+
+        @Override
+        public int hashCode() {
+            return node.hashCode();
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            return o instanceof ExecutionNode && ((ExecutionNode) o).node.equals(node);
+        }
+    }
+}
\ No newline at end of file

Propchange: incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/AbstractEnhancerUiResource.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/ChainsRootResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/ChainsRootResource.java?rev=1297071&r1=1297070&r2=1297071&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/ChainsRootResource.java (original)
+++ incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/ChainsRootResource.java Mon Mar  5 14:31:28 2012
@@ -16,9 +16,19 @@
 */
 package org.apache.stanbol.enhancer.jersey.resource;
 
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
 import static javax.ws.rs.core.MediaType.TEXT_HTML;
+import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.N3;
+import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.N_TRIPLE;
+import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.RDF_JSON;
+import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.RDF_XML;
+import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.TURTLE;
+import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.X_TURTLE;
 import static org.apache.stanbol.commons.web.base.CorsHelper.addCORSOrigin;
 import static org.apache.stanbol.commons.web.base.CorsHelper.enableCORS;
+import static org.apache.stanbol.enhancer.jersey.utils.EnhancerUtils.addActiveChains;
+import static org.apache.stanbol.enhancer.jersey.utils.EnhancerUtils.buildChainsMap;
+import static org.apache.stanbol.enhancer.servicesapi.rdf.Enhancer.ENHANCEMENT_ENGINE;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -40,10 +50,22 @@ import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.ResponseBuilder;
 
+import org.apache.clerezza.rdf.core.MGraph;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl;
+import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
+import org.apache.clerezza.rdf.core.impl.TripleImpl;
+import org.apache.clerezza.rdf.core.impl.TypedLiteralImpl;
+import org.apache.clerezza.rdf.ontologies.RDF;
+import org.apache.clerezza.rdf.ontologies.RDFS;
+import org.apache.clerezza.rdf.ontologies.XSD;
 import org.apache.stanbol.commons.web.base.ContextHelper;
 import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
+import org.apache.stanbol.enhancer.jersey.utils.EnhancerUtils;
 import org.apache.stanbol.enhancer.servicesapi.Chain;
 import org.apache.stanbol.enhancer.servicesapi.ChainManager;
+import org.apache.stanbol.enhancer.servicesapi.EnhancementEngine;
+import org.apache.stanbol.enhancer.servicesapi.rdf.Enhancer;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
 
@@ -64,18 +86,9 @@ public class ChainsRootResource extends 
                 "The required ChainManager Service is not available!"));
         }
         defaultChain = chainManager.getDefault();
-        chains = new HashMap<String,Map.Entry<ServiceReference,Chain>>();
-        for(String chainName : chainManager.getActiveChainNames()){
-            ServiceReference chainRef = chainManager.getReference(chainName);
-            if(chainRef != null){
-                Chain chain = chainManager.getChain(chainRef);
-                if(chain != null){
-                    Map<ServiceReference,Chain> m = Collections.singletonMap(chainRef, chain);
-                    chains.put(chainName, m.entrySet().iterator().next());
-                }
-            }
-        }
+        chains = buildChainsMap(chainManager);
     }
+
     @OPTIONS
     public Response handleCorsPreflight(@Context HttpHeaders headers){
         ResponseBuilder res = Response.ok();
@@ -90,6 +103,17 @@ public class ChainsRootResource extends 
         addCORSOrigin(servletContext,res, headers);
         return res.build();
     }
+    @GET
+    @Produces(value={APPLICATION_JSON,N3,N_TRIPLE,RDF_JSON,RDF_XML,TURTLE,X_TURTLE})
+    public Response getEngines(@Context HttpHeaders headers){
+        String rootUrl = uriInfo.getBaseUriBuilder().path(getRootUrl()).build().toString();
+        MGraph graph = new SimpleMGraph();
+        addActiveChains(chains.values(),defaultChain,graph,rootUrl);
+        ResponseBuilder res = Response.ok(graph);
+        addCORSOrigin(servletContext,res, headers);
+        return res.build();
+    }
+
 
     public Collection<Chain> getChains(){
         Set<Chain> chains = new HashSet<Chain>();

Modified: incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnginesRootResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnginesRootResource.java?rev=1297071&r1=1297070&r2=1297071&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnginesRootResource.java (original)
+++ incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnginesRootResource.java Mon Mar  5 14:31:28 2012
@@ -31,11 +31,9 @@ import javax.ws.rs.core.Context;
  *
  */
 @Path("/engines")
-public class EnginesRootResource extends EnhancerRootResource {
-
-    
+public final class EnginesRootResource extends AbstractEnhancerUiResource {
     
     public EnginesRootResource(@Context ServletContext context) {
-        super(context);
+        super(null,context);
     }
 }

Modified: incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnhancementChainResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnhancementChainResource.java?rev=1297071&r1=1297070&r2=1297071&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnhancementChainResource.java (original)
+++ incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnhancementChainResource.java Mon Mar  5 14:31:28 2012
@@ -32,19 +32,14 @@ import org.apache.stanbol.enhancer.servi
  *
  */
 @Path("/enhancer/chain/{chain}")
-public class EnhancementChainResource extends EnhancerRootResource {
+public final class EnhancementChainResource extends AbstractEnhancerUiResource {
 
-    
     public EnhancementChainResource(@PathParam(value = "chain") String chain,
                                     @Context ServletContext context) {
-        super(context);
+        super(chain,context);
         if(chain == null || chain.isEmpty()){
             throw new WebApplicationException(Response.Status.NOT_FOUND);
         }
-        this.chain = chainManager.getChain(chain);
-        if(this.chain == null){
-            throw new WebApplicationException(Response.Status.NOT_FOUND);
-        }
     }
 
 }

Modified: incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnhancementEngineResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnhancementEngineResource.java?rev=1297071&r1=1297070&r2=1297071&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnhancementEngineResource.java (original)
+++ incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnhancementEngineResource.java Mon Mar  5 14:31:28 2012
@@ -44,18 +44,20 @@ import org.apache.clerezza.rdf.core.seri
 import org.apache.stanbol.commons.web.base.ContextHelper;
 import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
 import org.apache.stanbol.enhancer.servicesapi.Chain;
+import org.apache.stanbol.enhancer.servicesapi.ChainException;
 import org.apache.stanbol.enhancer.servicesapi.ChainManager;
 import org.apache.stanbol.enhancer.servicesapi.EnhancementEngine;
 import org.apache.stanbol.enhancer.servicesapi.EnhancementEngineManager;
 import org.apache.stanbol.enhancer.servicesapi.EnhancementJobManager;
 import org.apache.stanbol.enhancer.servicesapi.ServiceProperties;
+import org.apache.stanbol.enhancer.servicesapi.helper.SingleEngineChain;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
 
 import com.sun.jersey.api.view.Viewable;
 
 @Path("/enhancer/engine/{engineName}")
-public class EnhancementEngineResource extends BaseStanbolResource {
+public class EnhancementEngineResource extends AbstractEnhancerResource {
 
     
     private final List<EnhancementEngine> engines;
@@ -64,9 +66,10 @@ public class EnhancementEngineResource e
     
     public EnhancementEngineResource(@PathParam(value = "engineName") String name,
                                      @Context ServletContext context) {
+        super(context);
         // bind the job manager by looking it up from the servlet request context
-        EnhancementEngineManager engineManager = 
-                ContextHelper.getServiceFromContext(EnhancementEngineManager.class, context);
+//        EnhancementEngineManager engineManager = 
+//                ContextHelper.getServiceFromContext(EnhancementEngineManager.class, context);
         if(engineManager == null){
             throw new WebApplicationException(
                 new IllegalStateException(
@@ -90,6 +93,16 @@ public class EnhancementEngineResource e
             throw new WebApplicationException(Response.Status.NOT_FOUND);
         }
     }
+    /**
+     * Wraps the engine with the highest service ranking with a
+     * {@link SingleEngineChain}.
+     * @see org.apache.stanbol.enhancer.jersey.resource.AbstractEnhancerResource#getChain()
+     */
+    @Override
+    protected Chain getChain() {
+        return new SingleEngineChain(engines.get(0));
+    }
+    
     @OPTIONS
     public Response handleCorsPreflight(@Context HttpHeaders headers){
         ResponseBuilder res = Response.ok();

Modified: incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnhancementEnginesRootResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnhancementEnginesRootResource.java?rev=1297071&r1=1297070&r2=1297071&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnhancementEnginesRootResource.java (original)
+++ incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnhancementEnginesRootResource.java Mon Mar  5 14:31:28 2012
@@ -16,9 +16,19 @@
 */
 package org.apache.stanbol.enhancer.jersey.resource;
 
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
 import static javax.ws.rs.core.MediaType.TEXT_HTML;
+import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.N3;
+import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.N_TRIPLE;
+import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.RDF_JSON;
+import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.RDF_XML;
+import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.TURTLE;
+import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.X_TURTLE;
 import static org.apache.stanbol.commons.web.base.CorsHelper.addCORSOrigin;
 import static org.apache.stanbol.commons.web.base.CorsHelper.enableCORS;
+import static org.apache.stanbol.enhancer.jersey.utils.EnhancerUtils.addActiveEngines;
+import static org.apache.stanbol.enhancer.jersey.utils.EnhancerUtils.buildEnginesMap;
+import static org.apache.stanbol.enhancer.servicesapi.rdf.Enhancer.ENHANCEMENT_ENGINE;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -37,18 +47,30 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.ResponseBuilder;
 
+import org.apache.clerezza.rdf.core.MGraph;
+import org.apache.clerezza.rdf.core.UriRef;
 import org.apache.clerezza.rdf.core.access.TcManager;
+import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl;
+import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
+import org.apache.clerezza.rdf.core.impl.TripleImpl;
 import org.apache.clerezza.rdf.core.serializedform.Serializer;
+import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
+import org.apache.clerezza.rdf.ontologies.RDF;
+import org.apache.clerezza.rdf.ontologies.RDFS;
 import org.apache.stanbol.commons.web.base.ContextHelper;
 import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
+import org.apache.stanbol.enhancer.jersey.utils.EnhancerUtils;
 import org.apache.stanbol.enhancer.servicesapi.Chain;
 import org.apache.stanbol.enhancer.servicesapi.ChainManager;
 import org.apache.stanbol.enhancer.servicesapi.EnhancementEngine;
 import org.apache.stanbol.enhancer.servicesapi.EnhancementEngineManager;
 import org.apache.stanbol.enhancer.servicesapi.EnhancementJobManager;
+import org.apache.stanbol.enhancer.servicesapi.rdf.Enhancer;
+import org.apache.stanbol.enhancer.servicesapi.rdf.NamespaceEnum;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
 
@@ -67,18 +89,9 @@ public class EnhancementEnginesRootResou
             throw new WebApplicationException(new IllegalStateException(
                 "The required EnhancementEngineManager Service is not available!"));
         }
-        engines = new HashMap<String,Map.Entry<ServiceReference,EnhancementEngine>>();
-        for(String chainName : engineManager.getActiveEngineNames()){
-            ServiceReference engineRef = engineManager.getReference(chainName);
-            if(engineRef != null){
-                EnhancementEngine engine = engineManager.getEngine(engineRef);
-                if(engine != null){
-                    Map<ServiceReference,EnhancementEngine> m = Collections.singletonMap(engineRef, engine);
-                    engines.put(chainName, m.entrySet().iterator().next());
-                }
-            }
-        }
+        engines = buildEnginesMap(engineManager);
     }
+
     @OPTIONS
     public Response handleCorsPreflight(@Context HttpHeaders headers){
         ResponseBuilder res = Response.ok();
@@ -94,6 +107,17 @@ public class EnhancementEnginesRootResou
         return res.build();
     }
 
+    @GET
+    @Produces(value={APPLICATION_JSON,N3,N_TRIPLE,RDF_JSON,RDF_XML,TURTLE,X_TURTLE})
+    public Response getEngines(@Context HttpHeaders headers){
+        String rootUrl = uriInfo.getBaseUriBuilder().path(getRootUrl()).build().toString();
+        MGraph graph = new SimpleMGraph();
+        addActiveEngines(engines.values(), graph, rootUrl);
+        ResponseBuilder res = Response.ok(graph);
+        addCORSOrigin(servletContext,res, headers);
+        return res.build();
+    }
+
     public Collection<EnhancementEngine> getEngines(){
         Set<EnhancementEngine> engines = new HashSet<EnhancementEngine>();
         for(Entry<ServiceReference,EnhancementEngine> entry : this.engines.values()){