Author: tommaso
Date: Fri Nov  5 15:29:11 2010
New Revision: 1031627

URL: http://svn.apache.org/viewvc?rev=1031627&view=rev
Log:
[CLEREZZA-351] - introduced UIMAServicesFacade interface to indirect services 
offered by UIMA also changing methods offered to be much more coherent (all 
returning UIMA objects, not Strings and UIMA types), introduced getConcepts 
method. Also added AL headers

Added:
    
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/UIMAServicesFacade.java
    
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/resources/TextConceptTaggingAEDescriptor.xml
Modified:
    
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/   
(props changed)
    
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.metadata-generator/src/main/java/org/apache/clerezza/uima/metadatagenerator/UIMABaseMetadataGenerator.java
    
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.metadata-generator/src/test/java/org/apache/clerezza/uima/metadatagenerator/UIMABaseMetadataGeneratorTest.java
    
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.metadata-generator/src/test/java/org/apache/clerezza/uima/metadatagenerator/mediatype/PlainTextExtractorTest.java
    
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.metadata-generator/src/test/java/org/apache/clerezza/uima/metadatagenerator/mediatype/TikaTextExtractorTest.java
    
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/AEProvider.java
    
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/ExternalServicesFacade.java
    
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/UIMAExecutor.java
    
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/UIMAUtils.java
    
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/exception/ExecutionWithoutResultsException.java
    
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/exception/FeatureStructureNotFoundException.java
    
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/exception/NotSingletonFeatureStructureException.java
    
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/test/java/org/apache/clerezza/uima/utils/AEProviderTest.java
    
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/test/java/org/apache/clerezza/uima/utils/ExternalServicesFacadeTest.java
    
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/test/java/org/apache/clerezza/uima/utils/UIMAExecutorTest.java
    
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/test/java/org/apache/clerezza/uima/utils/UIMAUtilsTest.java

Propchange: 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Nov  5 15:29:11 2010
@@ -0,0 +1 @@
+*.iml

Modified: 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.metadata-generator/src/main/java/org/apache/clerezza/uima/metadatagenerator/UIMABaseMetadataGenerator.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.metadata-generator/src/main/java/org/apache/clerezza/uima/metadatagenerator/UIMABaseMetadataGenerator.java?rev=1031627&r1=1031626&r2=1031627&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.metadata-generator/src/main/java/org/apache/clerezza/uima/metadatagenerator/UIMABaseMetadataGenerator.java
 (original)
+++ 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.metadata-generator/src/main/java/org/apache/clerezza/uima/metadatagenerator/UIMABaseMetadataGenerator.java
 Fri Nov  5 15:29:11 2010
@@ -1,3 +1,21 @@
+/*
+ * 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.clerezza.uima.metadatagenerator;
 
 import org.apache.clerezza.rdf.metadata.MetaDataGenerator;
@@ -8,13 +26,13 @@ import org.apache.clerezza.uima.metadata
 import org.apache.clerezza.uima.metadatagenerator.mediatype.PlainTextExtractor;
 import 
org.apache.clerezza.uima.metadatagenerator.mediatype.UnsupportedMediaTypeException;
 import org.apache.clerezza.uima.utils.ExternalServicesFacade;
+import org.apache.clerezza.uima.utils.UIMAServicesFacade;
 import org.apache.clerezza.uima.utils.UIMAUtils;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.felix.scr.annotations.Services;
 import org.apache.uima.UIMAException;
 import org.apache.uima.cas.FeatureStructure;
-import org.apache.uima.jcas.tcas.Annotation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -36,7 +54,7 @@ public class UIMABaseMetadataGenerator i
 
   private final static Logger log = 
LoggerFactory.getLogger(UIMABaseMetadataGenerator.class);
 
-  private ExternalServicesFacade facade;
+  private UIMAServicesFacade facade;
 
   private Set<MediaTypeTextExtractor> textExtractors;
 
@@ -63,11 +81,11 @@ public class UIMABaseMetadataGenerator i
       // add wide purpose subject to the document
       addCategory(node, text);
 
-      // add calais annotations' nodes
-      addCalaisAnnotations(node, text);
+      // add named entities' nodes
+      addNamedEntities(node, text);
 
-      // add alchemyAPI's annotations' nodes
-      addAlchemyAPIEntities(node, text);
+      // add tags' nodes
+      addTags(node, text);
 
       log.info(new StringBuilder(node.toString()).append(" graph node 
enriched").toString());
     } catch (Throwable e) {
@@ -76,6 +94,7 @@ public class UIMABaseMetadataGenerator i
   }
 
   /* initialize text extractors sorted set */
+
   private void initializeExtractors() {
     this.textExtractors.add(new PlainTextExtractor());
   }
@@ -98,29 +117,31 @@ public class UIMABaseMetadataGenerator i
 
   private void addCategory(GraphNode node, String data) throws UIMAException {
     // get category to bind it to the node
-    String category = this.facade.getCategory(data);
+    FeatureStructure categoryFS = this.facade.getCategory(data);
+    String category = 
categoryFS.getStringValue(categoryFS.getType().getFeatureByBaseName("text"));
     node.addPropertyValue(DC.subject, category);
   }
 
   private void addLanguage(GraphNode node, String data) throws UIMAException {
     // get language to bind it to the node
-    String language = this.facade.getLanguage(data);
+    FeatureStructure languageFS = this.facade.getLanguage(data);
+    String language = 
languageFS.getStringValue(languageFS.getType().getFeatureByBaseName("language"));
     node.addPropertyValue(DCTERMS.language, language);
   }
 
-  private void addCalaisAnnotations(GraphNode existingNode, String data) 
throws UIMAException {
+  private void addNamedEntities(GraphNode existingNode, String data) throws 
UIMAException {
     // analyze document text and get the corresponding OpenCalais annotations
-    List<Annotation> calaisAnnotations = facade.getCalaisAnnotations(data);
+    List<FeatureStructure> namedEntities = facade.getNamedEntities(data);
     // convert annotations to nodes inside the current graph
-    UIMAUtils.enhanceNode(existingNode, calaisAnnotations);
+    UIMAUtils.enhanceNode(existingNode, namedEntities);
 
   }
 
-  private void addAlchemyAPIEntities(GraphNode existingNode, String data) 
throws UIMAException {
+  private void addTags(GraphNode existingNode, String data) throws 
UIMAException {
     // analyze document text and get the corresponding AlchemyAPI Tags
-    List<FeatureStructure> alchemyAPIEntities = 
this.facade.getAlchemyAPITags(data);
-    // convert entities to nodes inside the current graph
-    UIMAUtils.enhanceNode(existingNode, alchemyAPIEntities);
+    List<FeatureStructure> alchemyAPITags = this.facade.getTags(data);
+    // convert tags to nodes inside the current graph
+    UIMAUtils.enhanceNode(existingNode, alchemyAPITags);
   }
 
 }

Modified: 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.metadata-generator/src/test/java/org/apache/clerezza/uima/metadatagenerator/UIMABaseMetadataGeneratorTest.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.metadata-generator/src/test/java/org/apache/clerezza/uima/metadatagenerator/UIMABaseMetadataGeneratorTest.java?rev=1031627&r1=1031626&r2=1031627&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.metadata-generator/src/test/java/org/apache/clerezza/uima/metadatagenerator/UIMABaseMetadataGeneratorTest.java
 (original)
+++ 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.metadata-generator/src/test/java/org/apache/clerezza/uima/metadatagenerator/UIMABaseMetadataGeneratorTest.java
 Fri Nov  5 15:29:11 2010
@@ -1,3 +1,21 @@
+/*
+ * 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.clerezza.uima.metadatagenerator;
 
 import org.apache.clerezza.rdf.core.MGraph;

Modified: 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.metadata-generator/src/test/java/org/apache/clerezza/uima/metadatagenerator/mediatype/PlainTextExtractorTest.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.metadata-generator/src/test/java/org/apache/clerezza/uima/metadatagenerator/mediatype/PlainTextExtractorTest.java?rev=1031627&r1=1031626&r2=1031627&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.metadata-generator/src/test/java/org/apache/clerezza/uima/metadatagenerator/mediatype/PlainTextExtractorTest.java
 (original)
+++ 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.metadata-generator/src/test/java/org/apache/clerezza/uima/metadatagenerator/mediatype/PlainTextExtractorTest.java
 Fri Nov  5 15:29:11 2010
@@ -1,3 +1,21 @@
+/*
+ * 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.clerezza.uima.metadatagenerator.mediatype;
 
 import org.junit.Assert;

Modified: 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.metadata-generator/src/test/java/org/apache/clerezza/uima/metadatagenerator/mediatype/TikaTextExtractorTest.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.metadata-generator/src/test/java/org/apache/clerezza/uima/metadatagenerator/mediatype/TikaTextExtractorTest.java?rev=1031627&r1=1031626&r2=1031627&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.metadata-generator/src/test/java/org/apache/clerezza/uima/metadatagenerator/mediatype/TikaTextExtractorTest.java
 (original)
+++ 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.metadata-generator/src/test/java/org/apache/clerezza/uima/metadatagenerator/mediatype/TikaTextExtractorTest.java
 Fri Nov  5 15:29:11 2010
@@ -1,3 +1,21 @@
+/*
+ * 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.clerezza.uima.metadatagenerator.mediatype;
 
 import org.junit.After;

Modified: 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/AEProvider.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/AEProvider.java?rev=1031627&r1=1031626&r2=1031627&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/AEProvider.java
 (original)
+++ 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/AEProvider.java
 Fri Nov  5 15:29:11 2010
@@ -1,3 +1,21 @@
+/*
+ * 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.clerezza.uima.utils;
 
 import org.apache.uima.UIMAFramework;
@@ -11,7 +29,7 @@ import java.net.URL;
 import java.util.Map;
 
 /**
- * provide the AnalysisEngine using the default descriptor or using a custom 
descriptor (absolute)
+ * provide the {...@link AnalysisEngine} using the default descriptor or using 
a custom descriptor (absolute)
  * path
  */
 public class AEProvider {

Modified: 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/ExternalServicesFacade.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/ExternalServicesFacade.java?rev=1031627&r1=1031626&r2=1031627&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/ExternalServicesFacade.java
 (original)
+++ 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/ExternalServicesFacade.java
 Fri Nov  5 15:29:11 2010
@@ -1,12 +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.clerezza.uima.utils;
 
 import org.apache.uima.UIMAException;
 import org.apache.uima.alchemy.ts.categorization.Category;
+import org.apache.uima.alchemy.ts.concept.ConceptFS;
 import org.apache.uima.alchemy.ts.keywords.KeywordFS;
 import org.apache.uima.alchemy.ts.language.LanguageFS;
 import org.apache.uima.cas.FeatureStructure;
 import org.apache.uima.jcas.JCas;
-import org.apache.uima.jcas.tcas.Annotation;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -16,7 +34,7 @@ import java.util.Map;
 /**
  * Facade for querying UIMA external services
  */
-public class ExternalServicesFacade {
+public class ExternalServicesFacade implements UIMAServicesFacade {
 
   private UIMAExecutor uimaExecutor;
 
@@ -26,7 +44,7 @@ public class ExternalServicesFacade {
     this.uimaExecutor = new UIMAExecutor("ExtServicesAE.xml").withResults();
   }
 
-  public List<FeatureStructure> getAlchemyAPITags(String document) throws 
UIMAException {
+  public List<FeatureStructure> getTags(String document) throws UIMAException {
 
     List<FeatureStructure> keywords = new ArrayList<FeatureStructure>();
 
@@ -47,9 +65,9 @@ public class ExternalServicesFacade {
     return keywords;
   }
 
-  public String getLanguage(String document) throws UIMAException {
+  public FeatureStructure getLanguage(String document) throws UIMAException {
 
-    String language = null;
+    FeatureStructure languageFS = null;
 
     try {
 
@@ -60,20 +78,18 @@ public class ExternalServicesFacade {
       JCas jcas = uimaExecutor.getResults();
 
       // extract language Feature Structure using AlchemyAPI Annotator
-      FeatureStructure languageFS = 
UIMAUtils.getSingletonFeatureStructure(LanguageFS.type, jcas);
-
-      language = 
languageFS.getStringValue(languageFS.getType().getFeatureByBaseName("language"));
+      languageFS = UIMAUtils.getSingletonFeatureStructure(LanguageFS.type, 
jcas);
 
     } catch (Exception e) {
       throw new UIMAException(e);
     }
 
-    return language;
+    return languageFS;
   }
 
-  public List<Annotation> getCalaisAnnotations(String document) throws 
UIMAException {
+  public List<FeatureStructure> getNamedEntities(String document) throws 
UIMAException {
 
-    List<Annotation> calaisAnnotations = new ArrayList<Annotation>();
+    List<FeatureStructure> calaisAnnotations = new 
ArrayList<FeatureStructure>();
 
     try {
 
@@ -92,8 +108,8 @@ public class ExternalServicesFacade {
     return calaisAnnotations;
   }
 
-  public String getCategory(String document) throws UIMAException {
-    String category = null;
+  public FeatureStructure getCategory(String document) throws UIMAException {
+    FeatureStructure categoryFS = null;
     try {
 
       // analyze the document
@@ -103,15 +119,34 @@ public class ExternalServicesFacade {
       JCas jcas = uimaExecutor.getResults();
 
       // extract category Feature Structure using AlchemyAPI Annotator
-      FeatureStructure categoryFS = 
UIMAUtils.getSingletonFeatureStructure(Category.type, jcas);
+      categoryFS = UIMAUtils.getSingletonFeatureStructure(Category.type, jcas);
+
+    } catch (Exception e) {
+      throw new UIMAException(e);
+    }
+
+    return categoryFS;
+  }
 
-      category = 
categoryFS.getStringValue(categoryFS.getType().getFeatureByBaseName("text"));
+  @Override
+  public List<FeatureStructure> getConcepts(String document) throws 
UIMAException {
+    List<FeatureStructure> concepts = new ArrayList<FeatureStructure>();
+
+    try {
+      // analyze the document
+      uimaExecutor.analyzeDocument(document, 
"TextConceptTaggingAEDescriptor.xml", getParameterSetting());
+
+      // get execution results
+      JCas jcas = uimaExecutor.getResults();
+
+      // get AlchemyAPI concepts extracted using UIMA
+      concepts.addAll(UIMAUtils.getAllFSofType(ConceptFS.type, jcas));
 
     } catch (Exception e) {
       throw new UIMAException(e);
     }
-    
-    return category;
+
+    return concepts;
   }
 
   public Map<String, Object> getParameterSetting() {

Modified: 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/UIMAExecutor.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/UIMAExecutor.java?rev=1031627&r1=1031626&r2=1031627&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/UIMAExecutor.java
 (original)
+++ 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/UIMAExecutor.java
 Fri Nov  5 15:29:11 2010
@@ -1,17 +1,33 @@
+/*
+ * 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.clerezza.uima.utils;
 
 import 
org.apache.clerezza.uima.utils.exception.ExecutionWithoutResultsException;
 import org.apache.uima.analysis_engine.AnalysisEngine;
 import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
 import org.apache.uima.jcas.JCas;
-import org.apache.uima.resource.ResourceConfigurationException;
 import org.apache.uima.resource.ResourceInitializationException;
 
-import java.util.HashMap;
 import java.util.Map;
 
 /**
- * Executes a UIMA pipeline
+ * Executes a UIMA pipeline eventually collecting results in a {...@link JCas}
  *
  */
 public class UIMAExecutor {

Added: 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/UIMAServicesFacade.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/UIMAServicesFacade.java?rev=1031627&view=auto
==============================================================================
--- 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/UIMAServicesFacade.java
 (added)
+++ 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/UIMAServicesFacade.java
 Fri Nov  5 15:29:11 2010
@@ -0,0 +1,41 @@
+/*
+ * 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.clerezza.uima.utils;
+
+import org.apache.uima.UIMAException;
+import org.apache.uima.cas.FeatureStructure;
+
+import java.util.List;
+
+/**
+ * Interface for Apache UIMA services for enrichment
+ *
+ */
+public interface UIMAServicesFacade {
+
+  public List<FeatureStructure> getTags(String document) throws UIMAException;
+
+  public FeatureStructure getLanguage(String document) throws UIMAException;
+
+  public List<FeatureStructure> getNamedEntities(String document) throws 
UIMAException;
+
+  public FeatureStructure getCategory(String document) throws UIMAException;
+
+  public List<FeatureStructure> getConcepts(String document) throws 
UIMAException;
+}

Modified: 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/UIMAUtils.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/UIMAUtils.java?rev=1031627&r1=1031626&r2=1031627&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/UIMAUtils.java
 (original)
+++ 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/UIMAUtils.java
 Fri Nov  5 15:29:11 2010
@@ -1,3 +1,21 @@
+/*
+ * 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.clerezza.uima.utils;
 
 import org.apache.clerezza.rdf.utils.GraphNode;

Modified: 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/exception/ExecutionWithoutResultsException.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/exception/ExecutionWithoutResultsException.java?rev=1031627&r1=1031626&r2=1031627&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/exception/ExecutionWithoutResultsException.java
 (original)
+++ 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/exception/ExecutionWithoutResultsException.java
 Fri Nov  5 15:29:11 2010
@@ -1,9 +1,33 @@
+/*
+ * 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.clerezza.uima.utils.exception;
 
+/**
+ * Exception meaning a {...@kink UIMAExecutor} has been asked for results when
+ * it was initialized without
+ *
+ * @version $Id$
+ */
 public class ExecutionWithoutResultsException extends RuntimeException {
 
   /**
-   * 
+   *
    */
   private static final long serialVersionUID = -3001462019532255319L;
 

Modified: 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/exception/FeatureStructureNotFoundException.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/exception/FeatureStructureNotFoundException.java?rev=1031627&r1=1031626&r2=1031627&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/exception/FeatureStructureNotFoundException.java
 (original)
+++ 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/exception/FeatureStructureNotFoundException.java
 Fri Nov  5 15:29:11 2010
@@ -1,8 +1,26 @@
+/*
+ * 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.clerezza.uima.utils.exception;
 
 /**
  * 
- * @author tommaso
+ * @version $Id$
  * 
  */
 public class FeatureStructureNotFoundException extends Exception {

Modified: 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/exception/NotSingletonFeatureStructureException.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/exception/NotSingletonFeatureStructureException.java?rev=1031627&r1=1031626&r2=1031627&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/exception/NotSingletonFeatureStructureException.java
 (original)
+++ 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/java/org/apache/clerezza/uima/utils/exception/NotSingletonFeatureStructureException.java
 Fri Nov  5 15:29:11 2010
@@ -1,5 +1,27 @@
+/*
+ * 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.clerezza.uima.utils.exception;
 
+/**
+ * Exception raised when there are multiple {...@link FeatureStructure} 
objects of a same {...@link Type}
+ * in the {...@link JCas} while there should be only one
+ */
 public class NotSingletonFeatureStructureException extends Exception {
 
   /**

Added: 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/resources/TextConceptTaggingAEDescriptor.xml
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/resources/TextConceptTaggingAEDescriptor.xml?rev=1031627&view=auto
==============================================================================
--- 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/resources/TextConceptTaggingAEDescriptor.xml
 (added)
+++ 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/main/resources/TextConceptTaggingAEDescriptor.xml
 Fri Nov  5 15:29:11 2010
@@ -0,0 +1,196 @@
+<?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.    
+-->
+<analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier";>
+  <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+  <primitive>true</primitive>
+  
<annotatorImplementationName>org.apache.uima.alchemy.annotator.TextConceptTaggingAnnotator</annotatorImplementationName>
+  <analysisEngineMetaData>
+    <name>TextConceptTaggingAEDescriptor</name>
+    <description/>
+    <version>1.0</version>
+    <vendor/>
+    <configurationParameters>
+      <configurationParameter>
+        <name>apikey</name>
+        <type>String</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>outputMode</name>
+        <type>String</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>linkedData</name>
+        <type>String</type>
+        <multiValued>false</multiValued>
+        <mandatory>false</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>showSourceText</name>
+        <type>Integer</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>maxRetrieve</name>
+        <type>String</type>
+        <multiValued>false</multiValued>
+        <mandatory>false</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>url</name>
+        <type>String</type>
+        <multiValued>false</multiValued>
+        <mandatory>false</mandatory>
+      </configurationParameter>
+    </configurationParameters>
+    <configurationParameterSettings>
+      <nameValuePair>
+        <name>apikey</name>
+        <value>
+          <string/>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>outputMode</name>
+        <value>
+          <string>xml</string>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>linkedData</name>
+        <value>
+          <string>1</string>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>showSourceText</name>
+        <value>
+          <integer>0</integer>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>maxRetrieve</name>
+        <value>
+          <string>8</string>
+        </value>
+      </nameValuePair>
+    </configurationParameterSettings>
+    <typeSystemDescription>
+      <types>
+        <typeDescription>
+          <name>org.apache.uima.alchemy.ts.concept.ConceptFS</name>
+          <description>a concept tag</description>
+          <supertypeName>uima.cas.TOP</supertypeName>
+          <features>
+            <featureDescription>
+              <name>text</name>
+              <description/>
+              <rangeTypeName>uima.cas.String</rangeTypeName>
+            </featureDescription>
+            <featureDescription>
+              <name>relevance</name>
+              <description/>
+              <rangeTypeName>uima.cas.String</rangeTypeName>
+            </featureDescription>
+            <featureDescription>
+              <name>website</name>
+              <description/>
+              <rangeTypeName>uima.cas.String</rangeTypeName>
+            </featureDescription>
+            <featureDescription>
+              <name>geo</name>
+              <description/>
+              <rangeTypeName>uima.cas.String</rangeTypeName>
+            </featureDescription>
+            <featureDescription>
+              <name>dbpedia</name>
+              <description/>
+              <rangeTypeName>uima.cas.String</rangeTypeName>
+            </featureDescription>
+            <featureDescription>
+              <name>yago</name>
+              <description/>
+              <rangeTypeName>uima.cas.String</rangeTypeName>
+            </featureDescription>
+            <featureDescription>
+              <name>opencyc</name>
+              <description/>
+              <rangeTypeName>uima.cas.String</rangeTypeName>
+            </featureDescription>
+            <featureDescription>
+              <name>freebase</name>
+              <description/>
+              <rangeTypeName>uima.cas.String</rangeTypeName>
+            </featureDescription>
+            <featureDescription>
+              <name>ciaFactbook</name>
+              <description/>
+              <rangeTypeName>uima.cas.String</rangeTypeName>
+            </featureDescription>
+            <featureDescription>
+              <name>census</name>
+              <description/>
+              <rangeTypeName>uima.cas.String</rangeTypeName>
+            </featureDescription>
+            <featureDescription>
+              <name>geonames</name>
+              <description/>
+              <rangeTypeName>uima.cas.String</rangeTypeName>
+            </featureDescription>
+            <featureDescription>
+              <name>musicBrainz</name>
+              <description/>
+              <rangeTypeName>uima.cas.String</rangeTypeName>
+            </featureDescription>
+            <featureDescription>
+              <name>crunchbase</name>
+              <description/>
+              <rangeTypeName>uima.cas.String</rangeTypeName>
+            </featureDescription>
+            <featureDescription>
+              <name>semanticCrunchbase</name>
+              <description/>
+              <rangeTypeName>uima.cas.String</rangeTypeName>
+            </featureDescription>
+          </features>
+        </typeDescription>
+      </types>
+    </typeSystemDescription>
+    <typePriorities/>
+    <fsIndexCollection/>
+    <capabilities>
+      <capability>
+        <inputs/>
+        <outputs/>
+        <languagesSupported/>
+      </capability>
+    </capabilities>
+    <operationalProperties>
+      <modifiesCas>true</modifiesCas>
+      <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+      <outputsNewCASes>false</outputsNewCASes>
+    </operationalProperties>
+  </analysisEngineMetaData>
+  <resourceManagerConfiguration/>
+</analysisEngineDescription>

Modified: 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/test/java/org/apache/clerezza/uima/utils/AEProviderTest.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/test/java/org/apache/clerezza/uima/utils/AEProviderTest.java?rev=1031627&r1=1031626&r2=1031627&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/test/java/org/apache/clerezza/uima/utils/AEProviderTest.java
 (original)
+++ 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/test/java/org/apache/clerezza/uima/utils/AEProviderTest.java
 Fri Nov  5 15:29:11 2010
@@ -1,3 +1,21 @@
+/*
+ * 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.clerezza.uima.utils;
 
 import org.apache.uima.analysis_engine.AnalysisEngine;

Modified: 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/test/java/org/apache/clerezza/uima/utils/ExternalServicesFacadeTest.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/test/java/org/apache/clerezza/uima/utils/ExternalServicesFacadeTest.java?rev=1031627&r1=1031626&r2=1031627&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/test/java/org/apache/clerezza/uima/utils/ExternalServicesFacadeTest.java
 (original)
+++ 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/test/java/org/apache/clerezza/uima/utils/ExternalServicesFacadeTest.java
 Fri Nov  5 15:29:11 2010
@@ -1,3 +1,21 @@
+/*
+ * 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.clerezza.uima.utils;
 
 import org.apache.uima.cas.FeatureStructure;
@@ -29,7 +47,8 @@ public class ExternalServicesFacadeTest 
             Map<String, Object> parameterSettings = new HashMap<String, 
Object>();
             parameterSettings.put("apikey", 
"04490000a72fe7ec5cb3497f14e77f338c86f2fe");
             externalServicesFacade.setParameterSetting(parameterSettings);
-            String language = 
externalServicesFacade.getLanguage(AN_ENGLISH_TEXT);
+            FeatureStructure languageFS = 
externalServicesFacade.getLanguage(AN_ENGLISH_TEXT);
+            String language = 
languageFS.getStringValue(languageFS.getType().getFeatureByBaseName("language"));
             assertEquals(language, "english");
         } catch (Exception e) {
             e.printStackTrace();
@@ -46,7 +65,7 @@ public class ExternalServicesFacadeTest 
             Map<String, Object> parameterSettings = new HashMap<String, 
Object>();
             parameterSettings.put("apikey", 
"04490000a72fe7ec5cb3497f14e77f338c86f2fe");
             externalServicesFacade.setParameterSetting(parameterSettings);
-            List<FeatureStructure> tags = 
externalServicesFacade.getAlchemyAPITags(AN_ENGLISH_TEXT);
+            List<FeatureStructure> tags = 
externalServicesFacade.getTags(AN_ENGLISH_TEXT);
             assertTrue(tags != null);
             assertTrue(!tags.isEmpty());
             assertTrue(tags.size() == 1);
@@ -62,17 +81,18 @@ public class ExternalServicesFacadeTest 
     }
 
     @Test
-    public void getCalaisAnnotationsTest() {
+    public void getNamedEntitiesTest() {
         try {
             ExternalServicesFacade externalServicesFacade = new 
ExternalServicesFacade();
             String licenseId = "g6h9zamsdtwhb93nc247ecrs";
             Map<String, Object> parameterSettings = new HashMap<String, 
Object>();
             parameterSettings.put("licenseID", licenseId);
             externalServicesFacade.setParameterSetting(parameterSettings);
-            List<Annotation> calaisAnnotations = 
externalServicesFacade.getCalaisAnnotations(ANOTHER_ENGLISH_TEXT);
-            assertTrue(calaisAnnotations != null);
-            assertTrue(!calaisAnnotations.isEmpty());
-            for (Annotation annotation : calaisAnnotations) {
+            List<FeatureStructure> entities = 
externalServicesFacade.getNamedEntities(ANOTHER_ENGLISH_TEXT);
+            assertTrue(entities != null);
+            assertTrue(!entities.isEmpty());
+            for (FeatureStructure fs : entities) {
+              Annotation annotation = (Annotation) fs;
               assertTrue(annotation.getType()!=null && 
annotation.getType().getName()!=null);
               assertTrue(annotation.getBegin()>0);
               assertTrue(annotation.getEnd()>0);
@@ -92,7 +112,8 @@ public class ExternalServicesFacadeTest 
             Map<String, Object> parameterSettings = new HashMap<String, 
Object>();
             parameterSettings.put("apikey", 
"04490000a72fe7ec5cb3497f14e77f338c86f2fe");
             externalServicesFacade.setParameterSetting(parameterSettings);
-            String category = 
externalServicesFacade.getCategory(CLEREZZA_RELATED_TEXT);
+            FeatureStructure categoryFS = 
externalServicesFacade.getCategory(CLEREZZA_RELATED_TEXT);
+            String category = 
categoryFS.getStringValue(categoryFS.getType().getFeatureByBaseName("text"));
             assertEquals(category, "computer_internet");
         } catch (Exception e) {
             e.printStackTrace();
@@ -100,4 +121,26 @@ public class ExternalServicesFacadeTest 
         }
     }
 
+    @Test
+    public void getConceptsTest() {
+        try {
+            ExternalServicesFacade externalServicesFacade = new 
ExternalServicesFacade();
+            Map<String, Object> parameterSettings = new HashMap<String, 
Object>();
+            parameterSettings.put("apikey", 
"04490000a72fe7ec5cb3497f14e77f338c86f2fe");
+            externalServicesFacade.setParameterSetting(parameterSettings);
+            List<FeatureStructure> concepts = 
externalServicesFacade.getConcepts(ANOTHER_ENGLISH_TEXT);
+            assertTrue(concepts != null);
+            assertTrue("Concepts list is empty",!concepts.isEmpty());
+            assertTrue("Concepts list size is 
"+concepts.size(),concepts.size() == 8);
+            FeatureStructure concept = concepts.get(0);
+            Type type = concept.getType();
+            String conceptText = 
concept.getStringValue(type.getFeatureByBaseName("text"));
+            assertTrue("First concept was"+conceptText+" instead of 
Petroleum",conceptText!=null && conceptText.equals("Petroleum"));
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.getLocalizedMessage());
+        }
+
+    }
+
 }

Modified: 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/test/java/org/apache/clerezza/uima/utils/UIMAExecutorTest.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/test/java/org/apache/clerezza/uima/utils/UIMAExecutorTest.java?rev=1031627&r1=1031626&r2=1031627&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/test/java/org/apache/clerezza/uima/utils/UIMAExecutorTest.java
 (original)
+++ 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/test/java/org/apache/clerezza/uima/utils/UIMAExecutorTest.java
 Fri Nov  5 15:29:11 2010
@@ -1,3 +1,21 @@
+/*
+ * 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.clerezza.uima.utils;
 
 import org.junit.Test;

Modified: 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/test/java/org/apache/clerezza/uima/utils/UIMAUtilsTest.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/test/java/org/apache/clerezza/uima/utils/UIMAUtilsTest.java?rev=1031627&r1=1031626&r2=1031627&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/test/java/org/apache/clerezza/uima/utils/UIMAUtilsTest.java
 (original)
+++ 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.uima/org.apache.clerezza.uima.utils/src/test/java/org/apache/clerezza/uima/utils/UIMAUtilsTest.java
 Fri Nov  5 15:29:11 2010
@@ -1,3 +1,21 @@
+/*
+ * 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.clerezza.uima.utils;
 
 import org.apache.uima.cas.CAS;


Reply via email to