You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by to...@apache.org on 2010/09/04 17:05:04 UTC
svn commit: r992621 [3/18] - in /uima/sandbox/trunk/AlchemyAPIAnnotator:
desc/ src/main/java/org/apache/uima/alchemy/annotator/
src/main/java/org/apache/uima/alchemy/mapper/
src/main/java/org/apache/uima/alchemy/mapper/exception/
src/main/java/org/apac...
Modified: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/AbstractAlchemyAnnotator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/AbstractAlchemyAnnotator.java?rev=992621&r1=992620&r2=992621&view=diff
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/AbstractAlchemyAnnotator.java (original)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/AbstractAlchemyAnnotator.java Sat Sep 4 15:05:01 2010
@@ -26,7 +26,8 @@ import org.apache.uima.alchemy.digester.
import org.apache.uima.alchemy.digester.domain.Results;
import org.apache.uima.alchemy.digester.exception.ResultDigestingException;
import org.apache.uima.alchemy.digester.exception.UnsupportedResultFormatException;
-import org.apache.uima.alchemy.utils.exception.MappingException;
+import org.apache.uima.alchemy.mapper.Alchemy2TypeSystemMapper;
+import org.apache.uima.alchemy.mapper.exception.MappingException;
import org.apache.uima.analysis_component.JCasAnnotator_ImplBase;
import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
import org.apache.uima.jcas.JCas;
@@ -146,6 +147,10 @@ public abstract class AbstractAlchemyAnn
private InputStream parseOutput(URLConnection connection) throws IOException {
return new BufferedInputStream(connection.getInputStream());
}
+
+ private void mapResultsToTypeSystem(Results results, JCas aJCas) throws MappingException {
+ Alchemy2TypeSystemMapper.mapResultsToTypeSystem(results, aJCas);
+ }
public void setDigesterProvider(DigesterProvider digesterProvider) {
this.digesterProvider = digesterProvider;
@@ -161,9 +166,6 @@ public abstract class AbstractAlchemyAnn
protected abstract String[] getServiceParameters();
- protected abstract void mapResultsToTypeSystem(Results results, JCas aJCas)
- throws MappingException;
-
protected abstract void initializeRuntimeParameters(JCas aJCas)
throws AnalysisEngineProcessException;
Modified: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/HtmlMicroformatsAnnotator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/HtmlMicroformatsAnnotator.java?rev=992621&r1=992620&r2=992621&view=diff
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/HtmlMicroformatsAnnotator.java (original)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/HtmlMicroformatsAnnotator.java Sat Sep 4 15:05:01 2010
@@ -25,11 +25,7 @@ import java.net.URL;
import java.net.URLEncoder;
import org.apache.uima.alchemy.digester.DigesterProvider;
-import org.apache.uima.alchemy.digester.domain.MicroformatsResults;
-import org.apache.uima.alchemy.digester.domain.Results;
import org.apache.uima.alchemy.digester.microformats.MicroformatsDigesterProvider;
-import org.apache.uima.alchemy.utils.Alchemy2TypeSystemMapper;
-import org.apache.uima.alchemy.utils.exception.MappingException;
import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
import org.apache.uima.jcas.JCas;
@@ -43,10 +39,6 @@ public class HtmlMicroformatsAnnotator e
return new String[] { "outputMode", "url" };
}
- protected void mapResultsToTypeSystem(Results results, JCas aJCas) throws MappingException {
- Alchemy2TypeSystemMapper.mapMicroformats((MicroformatsResults) results, aJCas);
- }
-
protected DigesterProvider createDigester() {
return new MicroformatsDigesterProvider();
}
Modified: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextAnnotatedNamedEntityExtractionAnnotator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextAnnotatedNamedEntityExtractionAnnotator.java?rev=992621&r1=992620&r2=992621&view=diff
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextAnnotatedNamedEntityExtractionAnnotator.java (original)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextAnnotatedNamedEntityExtractionAnnotator.java Sat Sep 4 15:05:01 2010
@@ -23,11 +23,7 @@ import java.net.URI;
import java.net.URL;
import org.apache.uima.alchemy.digester.DigesterProvider;
-import org.apache.uima.alchemy.digester.domain.AnnotatedResults;
-import org.apache.uima.alchemy.digester.domain.Results;
import org.apache.uima.alchemy.digester.entity.annotated.AnnotatedEntityDigesterProvider;
-import org.apache.uima.alchemy.utils.Alchemy2TypeSystemMapper;
-import org.apache.uima.alchemy.utils.exception.MappingException;
import org.apache.uima.jcas.JCas;
/**
@@ -48,10 +44,6 @@ public class TextAnnotatedNamedEntityExt
"showSourceText", "coreference" };
}
- protected void mapResultsToTypeSystem(Results results, JCas aJCas) throws MappingException {
- Alchemy2TypeSystemMapper.mapAnnotatedEntities((AnnotatedResults) results, aJCas);
- }
-
protected DigesterProvider createDigester() {
return new AnnotatedEntityDigesterProvider();
}
Modified: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextCategorizationAnnotator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextCategorizationAnnotator.java?rev=992621&r1=992620&r2=992621&view=diff
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextCategorizationAnnotator.java (original)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextCategorizationAnnotator.java Sat Sep 4 15:05:01 2010
@@ -24,10 +24,6 @@ import java.net.URL;
import org.apache.uima.alchemy.digester.DigesterProvider;
import org.apache.uima.alchemy.digester.categorization.CategorizationDigesterProvider;
-import org.apache.uima.alchemy.digester.domain.CategorizationResults;
-import org.apache.uima.alchemy.digester.domain.Results;
-import org.apache.uima.alchemy.utils.Alchemy2TypeSystemMapper;
-import org.apache.uima.alchemy.utils.exception.MappingException;
import org.apache.uima.jcas.JCas;
public class TextCategorizationAnnotator extends AbstractAlchemyAnnotator {
@@ -40,10 +36,6 @@ public class TextCategorizationAnnotator
return new String[] { "outputMode", "baseUrl", "url" };
}
- protected void mapResultsToTypeSystem(Results results, JCas aJCas) throws MappingException {
- Alchemy2TypeSystemMapper.mapCategorizationEntity((CategorizationResults) results, aJCas);
- }
-
protected DigesterProvider createDigester() {
return new CategorizationDigesterProvider();
}
Modified: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextConceptTaggingAnnotator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextConceptTaggingAnnotator.java?rev=992621&r1=992620&r2=992621&view=diff
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextConceptTaggingAnnotator.java (original)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextConceptTaggingAnnotator.java Sat Sep 4 15:05:01 2010
@@ -18,19 +18,15 @@
*/
package org.apache.uima.alchemy.annotator;
-import org.apache.uima.alchemy.digester.concept.ConceptTaggingDigesterProvider;
-import org.apache.uima.alchemy.digester.DigesterProvider;
-import org.apache.uima.alchemy.digester.domain.ConceptResults;
-import org.apache.uima.alchemy.digester.domain.Results;
-import org.apache.uima.alchemy.utils.Alchemy2TypeSystemMapper;
-import org.apache.uima.alchemy.utils.exception.MappingException;
-import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
-import org.apache.uima.jcas.JCas;
-
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
+import org.apache.uima.alchemy.digester.DigesterProvider;
+import org.apache.uima.alchemy.digester.concept.ConceptTaggingDigesterProvider;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.jcas.JCas;
+
public class TextConceptTaggingAnnotator extends AbstractAlchemyAnnotator {
@Override
protected DigesterProvider createDigester() {
@@ -48,11 +44,6 @@ public class TextConceptTaggingAnnotator
}
@Override
- protected void mapResultsToTypeSystem(Results results, JCas aJCas) throws MappingException {
- Alchemy2TypeSystemMapper.mapConceptTagging((ConceptResults) results, aJCas);
- }
-
- @Override
protected void initializeRuntimeParameters(JCas aJCas) throws AnalysisEngineProcessException {
StringBuffer serviceParamsBuf = new StringBuffer();
serviceParamsBuf.append("&text=");
Modified: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextKeywordExtractionAnnotator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextKeywordExtractionAnnotator.java?rev=992621&r1=992620&r2=992621&view=diff
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextKeywordExtractionAnnotator.java (original)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextKeywordExtractionAnnotator.java Sat Sep 4 15:05:01 2010
@@ -23,11 +23,7 @@ import java.net.URI;
import java.net.URL;
import org.apache.uima.alchemy.digester.DigesterProvider;
-import org.apache.uima.alchemy.digester.domain.KeywordResults;
-import org.apache.uima.alchemy.digester.domain.Results;
import org.apache.uima.alchemy.digester.keyword.KeywordDigesterProvider;
-import org.apache.uima.alchemy.utils.Alchemy2TypeSystemMapper;
-import org.apache.uima.alchemy.utils.exception.MappingException;
import org.apache.uima.jcas.JCas;
public class TextKeywordExtractionAnnotator extends AbstractAlchemyAnnotator {
@@ -37,12 +33,7 @@ public class TextKeywordExtractionAnnota
}
protected String[] getServiceParameters() {
- return new String[] { "outputMode", "baseUrl", "url", "maxRetrieve",
- "showSourceText" };
- }
-
- protected void mapResultsToTypeSystem(Results results, JCas aJCas) throws MappingException {
- Alchemy2TypeSystemMapper.mapKeywordEntity((KeywordResults) results, aJCas);
+ return new String[] { "outputMode", "baseUrl", "url", "maxRetrieve", "showSourceText" };
}
protected DigesterProvider createDigester() {
Modified: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextLanguageDetectionAnnotator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextLanguageDetectionAnnotator.java?rev=992621&r1=992620&r2=992621&view=diff
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextLanguageDetectionAnnotator.java (original)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextLanguageDetectionAnnotator.java Sat Sep 4 15:05:01 2010
@@ -23,11 +23,7 @@ import java.net.URI;
import java.net.URL;
import org.apache.uima.alchemy.digester.DigesterProvider;
-import org.apache.uima.alchemy.digester.domain.LanguageDetectionResults;
-import org.apache.uima.alchemy.digester.domain.Results;
import org.apache.uima.alchemy.digester.language.LanguageDetectionDigesterProvider;
-import org.apache.uima.alchemy.utils.Alchemy2TypeSystemMapper;
-import org.apache.uima.alchemy.utils.exception.MappingException;
import org.apache.uima.jcas.JCas;
public class TextLanguageDetectionAnnotator extends AbstractAlchemyAnnotator {
@@ -40,10 +36,6 @@ public class TextLanguageDetectionAnnota
return new String[] { "outputMode", "url" };
}
- protected void mapResultsToTypeSystem(Results results, JCas aJCas) throws MappingException {
- Alchemy2TypeSystemMapper.mapLanguageDetection((LanguageDetectionResults) results, aJCas);
- }
-
protected DigesterProvider createDigester() {
return new LanguageDetectionDigesterProvider();
}
Modified: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextRankedNamedEntityExtractionAnnotator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextRankedNamedEntityExtractionAnnotator.java?rev=992621&r1=992620&r2=992621&view=diff
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextRankedNamedEntityExtractionAnnotator.java (original)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/TextRankedNamedEntityExtractionAnnotator.java Sat Sep 4 15:05:01 2010
@@ -23,11 +23,7 @@ import java.net.URI;
import java.net.URL;
import org.apache.uima.alchemy.digester.DigesterProvider;
-import org.apache.uima.alchemy.digester.domain.EntitiesResults;
-import org.apache.uima.alchemy.digester.domain.Results;
import org.apache.uima.alchemy.digester.entity.ranked.RankedEntityDigesterProvider;
-import org.apache.uima.alchemy.utils.Alchemy2TypeSystemMapper;
-import org.apache.uima.alchemy.utils.exception.MappingException;
import org.apache.uima.jcas.JCas;
public class TextRankedNamedEntityExtractionAnnotator extends AbstractAlchemyAnnotator {
@@ -41,10 +37,6 @@ public class TextRankedNamedEntityExtrac
"showSourceText", "quotations", "coreference" };
}
- protected void mapResultsToTypeSystem(Results results, JCas aJCas) throws MappingException {
- Alchemy2TypeSystemMapper.mapRankedEntities((EntitiesResults) results, aJCas); // create
- }
-
protected DigesterProvider createDigester() {
return new RankedEntityDigesterProvider();
}
Modified: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/URLMicroformatsAnnotator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/URLMicroformatsAnnotator.java?rev=992621&r1=992620&r2=992621&view=diff
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/URLMicroformatsAnnotator.java (original)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/annotator/URLMicroformatsAnnotator.java Sat Sep 4 15:05:01 2010
@@ -25,11 +25,7 @@ import java.net.URL;
import java.net.URLEncoder;
import org.apache.uima.alchemy.digester.DigesterProvider;
-import org.apache.uima.alchemy.digester.domain.MicroformatsResults;
-import org.apache.uima.alchemy.digester.domain.Results;
import org.apache.uima.alchemy.digester.microformats.MicroformatsDigesterProvider;
-import org.apache.uima.alchemy.utils.Alchemy2TypeSystemMapper;
-import org.apache.uima.alchemy.utils.exception.MappingException;
import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
import org.apache.uima.jcas.JCas;
@@ -43,10 +39,6 @@ public class URLMicroformatsAnnotator ex
return new String[] { "outputMode" };
}
- protected void mapResultsToTypeSystem(Results results, JCas aJCas) throws MappingException {
- Alchemy2TypeSystemMapper.mapMicroformats((MicroformatsResults) results, aJCas);
- }
-
protected DigesterProvider createDigester() {
return new MicroformatsDigesterProvider();
}
Copied: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/Alchemy2TypeSystemMapper.java (from r992561, uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/utils/Alchemy2TypeSystemMapper.java)
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/Alchemy2TypeSystemMapper.java?p2=uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/Alchemy2TypeSystemMapper.java&p1=uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/utils/Alchemy2TypeSystemMapper.java&r1=992561&r2=992621&rev=992621&view=diff
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/utils/Alchemy2TypeSystemMapper.java (original)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/Alchemy2TypeSystemMapper.java Sat Sep 4 15:05:01 2010
@@ -16,222 +16,59 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.uima.alchemy.utils;
+package org.apache.uima.alchemy.mapper;
-import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
-import org.apache.commons.lang.StringUtils;
-import org.apache.uima.alchemy.digester.domain.*;
-import org.apache.uima.alchemy.ts.categorization.Category;
-import org.apache.uima.alchemy.ts.concept.ConceptFS;
-import org.apache.uima.alchemy.ts.entity.AlchemyAnnotation;
-import org.apache.uima.alchemy.ts.keywords.KeywordFS;
-import org.apache.uima.alchemy.ts.language.LanguageFS;
-import org.apache.uima.alchemy.ts.microformats.MicroformatFS;
-import org.apache.uima.alchemy.utils.exception.MappingException;
-import org.apache.uima.cas.FeatureStructure;
-import org.apache.uima.cas.Type;
+import org.apache.uima.alchemy.digester.domain.AnnotatedResults;
+import org.apache.uima.alchemy.digester.domain.CategorizationResults;
+import org.apache.uima.alchemy.digester.domain.ConceptResults;
+import org.apache.uima.alchemy.digester.domain.EntitiesResults;
+import org.apache.uima.alchemy.digester.domain.KeywordResults;
+import org.apache.uima.alchemy.digester.domain.LanguageDetectionResults;
+import org.apache.uima.alchemy.digester.domain.MicroformatsResults;
+import org.apache.uima.alchemy.digester.domain.Results;
+import org.apache.uima.alchemy.mapper.exception.MappingException;
+import org.apache.uima.alchemy.mapper.processor.AlchemyOutputProcessor;
+import org.apache.uima.alchemy.mapper.processor.AnnotatedEntitiesProcessor;
+import org.apache.uima.alchemy.mapper.processor.CategorizationProcessor;
+import org.apache.uima.alchemy.mapper.processor.ConceptTaggingProcessor;
+import org.apache.uima.alchemy.mapper.processor.KeywordProcessor;
+import org.apache.uima.alchemy.mapper.processor.LanguageProcessor;
+import org.apache.uima.alchemy.mapper.processor.MicroformatsProcessor;
+import org.apache.uima.alchemy.mapper.processor.RankedEntitiesProcessor;
import org.apache.uima.jcas.JCas;
-import org.apache.uima.jcas.cas.StringArray;
public class Alchemy2TypeSystemMapper {
- public static void mapRankedEntities(EntitiesResults results, JCas aJCas) throws MappingException {
- setLanaguage(results, aJCas);
- for (Entity entity : results.getEntities().getEntities()) {
- try {
- // use reflection to instantiate classes of the proper type in the type system
- Object fsObject;
- try {// usually jcas gen creates the constructor with jcas argument as the second one
- fsObject = Class.forName("org.apache.uima.alchemy.ts.entity." + entity.getType())
- .getConstructors()[1].newInstance(aJCas);
- } catch (Exception e) { // for exceptional cases in which jcas parameter constructor is the
- // first
- fsObject = Class.forName("org.apache.uima.alchemy.ts.entity." + entity.getType())
- .getConstructors()[0].newInstance(aJCas);
- }
- FeatureStructure fs = (FeatureStructure) fsObject;
-
- Type type = fs.getType();
-
- fs.setFeatureValueFromString(type.getFeatureByBaseName("count"), entity.getCount()); // count
- fs.setFeatureValueFromString(type.getFeatureByBaseName("text"), entity.getText()); // text
- fs.setFeatureValueFromString(type.getFeatureByBaseName("relevance"), entity.getRelevance()); // relevance
- if (entity.getDisambiguated() != null) {
- fs.setFeatureValueFromString(type.getFeatureByBaseName("disambiguation"), entity
- .getDisambiguated().getName()); // disambiguation name
- fs.setFeatureValueFromString(type.getFeatureByBaseName("dbpedia"), entity
- .getDisambiguated().getDbpedia()); // dbpedia
- fs.setFeatureValueFromString(type.getFeatureByBaseName("website"), entity
- .getDisambiguated().getWebsite()); // website
- fs.setFeatureValueFromString(type.getFeatureByBaseName("subType"), entity
- .getDisambiguated().getSubType()); // subtype
- fs.setFeatureValueFromString(type.getFeatureByBaseName("geo"), entity.getDisambiguated()
- .getGeo()); // geo
- fs.setFeatureValueFromString(type.getFeatureByBaseName("opencyc"), entity
- .getDisambiguated().getOpencyc()); // opencyc
- fs.setFeatureValueFromString(type.getFeatureByBaseName("yago"), entity.getDisambiguated()
- .getYago()); // yago
- fs.setFeatureValueFromString(type.getFeatureByBaseName("umbel"), entity
- .getDisambiguated().getUmbel()); // umbel
- fs.setFeatureValueFromString(type.getFeatureByBaseName("freebase"), entity
- .getDisambiguated().getFreebase()); // freebase
- fs.setFeatureValueFromString(type.getFeatureByBaseName("ciaFactbook"), entity
- .getDisambiguated().getCiaFactbook()); // ciaFactbook
- fs.setFeatureValueFromString(type.getFeatureByBaseName("census"), entity
- .getDisambiguated().getCensus()); // census
- fs.setFeatureValueFromString(type.getFeatureByBaseName("geonames"), entity
- .getDisambiguated().getGeonames()); // geonames
- fs.setFeatureValueFromString(type.getFeatureByBaseName("musicBrainz"), entity
- .getDisambiguated().getMusicBrainz()); // musicBrainz
- }
- if (entity.getQuotations() != null && entity.getQuotations().getQuotations() != null
- && entity.getQuotations().getQuotations().size() > 0) {
- StringArray quotationsFeatureStructure = new StringArray(aJCas, entity.getQuotations()
- .getQuotations().size());
- int i = 0;
- for (String quotation : entity.getQuotations().getQuotations()) {
- quotationsFeatureStructure.set(i, quotation);
- i++;
- }
- fs.setFeatureValue(type.getFeatureByBaseName("quotations"), quotationsFeatureStructure);
- }
- aJCas.addFsToIndexes(fs);
- } catch (Exception e) {
- throw new MappingException(e);
- }
- }
-
- }
+ private static Map<Class<? extends Results>, AlchemyOutputProcessor> processors = new HashMap<Class<? extends Results>, AlchemyOutputProcessor>();
- private static void setLanaguage(Results results, JCas aJCas) {
- aJCas.setDocumentLanguage(results.getLanguage());
- }
-
- public static void mapAnnotatedEntities(AnnotatedResults results, JCas aJCas) {
- setLanaguage(results, aJCas);
- String annotatedText = results.getAnnotatedText();
-
- // find strings of pattern 'TYPE[TEXT'
- String[] ants = StringUtils.substringsBetween(annotatedText, "[", "]");
-
- // map the ants to UIMA CAS
- for (String ant : ants) {
- if (ant.indexOf("[") > 0) {
- AlchemyAnnotation alchemyAnnotation = new AlchemyAnnotation(aJCas);
-
- int indexOfAnt = annotatedText.indexOf(ant);
- alchemyAnnotation.setBegin(indexOfAnt - 1);
-
- String antText = ant.substring(ant.indexOf("[") + 1);
- alchemyAnnotation.setEnd(indexOfAnt + antText.length() - 1);
-
- String antType = ant.substring(0, ant.indexOf("["));
- alchemyAnnotation.setAlchemyType(antType);
- alchemyAnnotation.addToIndexes();
-
- annotatedText = annotatedText.replaceFirst("\\[" + ant.replace("[", "\\[") + "\\]\\]",
- antText);
- }
- }
-
- }
-
- public static void mapCategorizationEntity(CategorizationResults results, JCas aJCas)
- throws MappingException {
+ public static void mapResultsToTypeSystem(Results results, JCas aJCas) throws MappingException {
setLanaguage(results, aJCas);
try {
- FeatureStructure fs = new Category(aJCas);
- Type type = fs.getType();
- fs.setFeatureValueFromString(type.getFeatureByBaseName("score"), results.getScore());
- fs.setFeatureValueFromString(type.getFeatureByBaseName("text"), results.getCategory());
- aJCas.addFsToIndexes(fs);
+ if (processors.isEmpty())
+ initializeProcessors();
+ processors.get(results.getClass()).process(aJCas, results);
} catch (Exception e) {
- e.printStackTrace();
throw new MappingException(e);
}
}
- public static void mapKeywordEntity(KeywordResults results, JCas aJCas) throws MappingException {
- setLanaguage(results, aJCas);
- for (Keyword k : results.getKeywords()) {
- try {
- KeywordFS fs = new KeywordFS(aJCas);
- Type type = fs.getType();
- fs.setFeatureValueFromString(type.getFeatureByBaseName("text"), k.getText()); // text
- fs.addToIndexes();
- } catch (Exception e) {
- throw new MappingException(e);
- }
- }
+ private static void initializeProcessors() {
+ processors.put(AnnotatedResults.class, new AnnotatedEntitiesProcessor());
+ processors.put(CategorizationResults.class, new CategorizationProcessor());
+ processors.put(ConceptResults.class, new ConceptTaggingProcessor());
+ processors.put(EntitiesResults.class, new RankedEntitiesProcessor());
+ processors.put(KeywordResults.class, new KeywordProcessor());
+ processors.put(LanguageDetectionResults.class, new LanguageProcessor());
+ processors.put(MicroformatsResults.class, new MicroformatsProcessor());
}
- public static void mapMicroformats(MicroformatsResults results, JCas aJCas) {
- setLanaguage(results, aJCas);
- for (Microformat microformat : results.getMicroformats()) {
- MicroformatFS microformatFS = new MicroformatFS(aJCas);
- Type type = microformatFS.getType();
- microformatFS.setFeatureValueFromString(type.getFeatureByBaseName("fieldName"), microformat
- .getFieldName());
- microformatFS.setFeatureValueFromString(type.getFeatureByBaseName("fieldData"), microformat
- .getFieldData());
- microformatFS.addToIndexes();
- }
-
- }
-
- public static void mapLanguageDetection(LanguageDetectionResults results, JCas aJCas) {
- setLanaguage(results, aJCas);
- LanguageFS languageFS = new LanguageFS(aJCas);
- Type type = languageFS.getType();
- languageFS.setFeatureValueFromString(type.getFeatureByBaseName("language"), results
- .getLanguage());
- languageFS
- .setFeatureValueFromString(type.getFeatureByBaseName("iso6391"), results.getIso6391());
- languageFS
- .setFeatureValueFromString(type.getFeatureByBaseName("iso6392"), results.getIso6392());
- languageFS
- .setFeatureValueFromString(type.getFeatureByBaseName("iso6393"), results.getIso6393());
- languageFS.setFeatureValueFromString(type.getFeatureByBaseName("ethnologue"), results
- .getEthnologue());
- languageFS.setFeatureValueFromString(type.getFeatureByBaseName("nativeSpeakers"), results
- .getNativeSpeakers());
- languageFS.setFeatureValueFromString(type.getFeatureByBaseName("wikipedia"), results
- .getWikipedia());
- languageFS.addToIndexes();
- }
-
- public static void mapConceptTagging(ConceptResults results, JCas aJCas) {
- setLanaguage(results, aJCas);
- if (results.getConcepts() != null) {
- List<Concept> concepts = results.getConcepts().getConcepts();
- for (Concept concept : concepts) {
- ConceptFS conceptFS = new ConceptFS(aJCas);
- Type type = conceptFS.getType();
- conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("text"), concept.getText());
- conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("relevance"), concept
- .getRelevance());
- conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("website"), concept
- .getWebsite());
- conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("geo"), concept.getGeo());
- conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("dbpedia"), concept
- .getDbpedia());
- conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("yago"), concept.getYago());
- conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("opencyc"), concept
- .getOpencyc());
- conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("ciaFactbook"), concept
- .getCiaFactbook());
- conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("geonames"), concept
- .getGeonames());
- conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("crunchbase"), concept
- .getCrunchbase());
- conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("semanticCrunchbase"),
- concept.getSemanticCrunchbase());
- conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("musicBrainz"), concept
- .getMusicBrainz());
- conceptFS.addToIndexes();
- }
- }
+ private static void setLanaguage(Results results, JCas aJCas) {
+ String language = results.getLanguage();
+ if (language != null)
+ aJCas.setDocumentLanguage(language);
}
}
Modified: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/exception/MappingException.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/exception/MappingException.java?rev=992621&r1=992561&r2=992621&view=diff
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/exception/MappingException.java (original)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/exception/MappingException.java Sat Sep 4 15:05:01 2010
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.uima.alchemy.utils.exception;
+package org.apache.uima.alchemy.mapper.exception;
public class MappingException extends Exception {
Added: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/AlchemyOutputProcessor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/AlchemyOutputProcessor.java?rev=992621&view=auto
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/AlchemyOutputProcessor.java (added)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/AlchemyOutputProcessor.java Sat Sep 4 15:05:01 2010
@@ -0,0 +1,34 @@
+/**
+ * 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.uima.alchemy.mapper.processor;
+
+import org.apache.uima.alchemy.digester.domain.Results;
+import org.apache.uima.jcas.JCas;
+
+public interface AlchemyOutputProcessor {
+
+ /**
+ * process AlchemyAPI output results and populate {@link JCas} with the proper FeatureStructures
+ *
+ * @param cas
+ * @param results
+ */
+ public void process(JCas cas, Results results) throws Exception;
+
+}
Added: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/AnnotatedEntitiesProcessor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/AnnotatedEntitiesProcessor.java?rev=992621&view=auto
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/AnnotatedEntitiesProcessor.java (added)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/AnnotatedEntitiesProcessor.java Sat Sep 4 15:05:01 2010
@@ -0,0 +1,57 @@
+/**
+ * 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.uima.alchemy.mapper.processor;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.uima.alchemy.digester.domain.AnnotatedResults;
+import org.apache.uima.alchemy.digester.domain.Results;
+import org.apache.uima.alchemy.ts.entity.AlchemyAnnotation;
+import org.apache.uima.jcas.JCas;
+
+public class AnnotatedEntitiesProcessor implements AlchemyOutputProcessor {
+
+ public void process(JCas cas, Results results) throws Exception {
+ String annotatedText = ((AnnotatedResults) results).getAnnotatedText();
+
+ // find strings of pattern 'TYPE[TEXT'
+ String[] ants = StringUtils.substringsBetween(annotatedText, "[", "]");
+
+ // map the ants to UIMA CAS
+ for (String ant : ants) {
+ if (ant.indexOf("[") > 0) {
+ AlchemyAnnotation alchemyAnnotation = new AlchemyAnnotation(cas);
+
+ int indexOfAnt = annotatedText.indexOf(ant);
+ alchemyAnnotation.setBegin(indexOfAnt - 1);
+
+ String antText = ant.substring(ant.indexOf("[") + 1);
+ alchemyAnnotation.setEnd(indexOfAnt + antText.length() - 1);
+
+ String antType = ant.substring(0, ant.indexOf("["));
+ alchemyAnnotation.setAlchemyType(antType);
+ alchemyAnnotation.addToIndexes();
+
+ annotatedText = annotatedText.replaceFirst("\\[" + ant.replace("[", "\\[") + "\\]\\]",
+ antText);
+ }
+ }
+
+ }
+
+}
Added: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/CategorizationProcessor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/CategorizationProcessor.java?rev=992621&view=auto
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/CategorizationProcessor.java (added)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/CategorizationProcessor.java Sat Sep 4 15:05:01 2010
@@ -0,0 +1,47 @@
+/**
+ * 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.uima.alchemy.mapper.processor;
+
+import org.apache.uima.alchemy.digester.domain.CategorizationResults;
+import org.apache.uima.alchemy.digester.domain.Results;
+import org.apache.uima.alchemy.mapper.exception.MappingException;
+import org.apache.uima.alchemy.ts.categorization.Category;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.jcas.JCas;
+
+public class CategorizationProcessor implements AlchemyOutputProcessor {
+
+ public void process(JCas cas, Results results) throws Exception {
+ try {
+ FeatureStructure fs = new Category(cas);
+ Type type = fs.getType();
+ fs.setFeatureValueFromString(type.getFeatureByBaseName("score"),
+ ((CategorizationResults) results).getScore());
+ fs.setFeatureValueFromString(type.getFeatureByBaseName("text"),
+ ((CategorizationResults) results).getCategory());
+ cas.addFsToIndexes(fs);
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new MappingException(e);
+ }
+
+ }
+
+}
Added: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/ConceptTaggingProcessor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/ConceptTaggingProcessor.java?rev=992621&view=auto
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/ConceptTaggingProcessor.java (added)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/ConceptTaggingProcessor.java Sat Sep 4 15:05:01 2010
@@ -0,0 +1,65 @@
+/**
+ * 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.uima.alchemy.mapper.processor;
+
+import java.util.List;
+
+import org.apache.uima.alchemy.digester.domain.Concept;
+import org.apache.uima.alchemy.digester.domain.ConceptResults;
+import org.apache.uima.alchemy.digester.domain.Results;
+import org.apache.uima.alchemy.ts.concept.ConceptFS;
+import org.apache.uima.cas.Type;
+import org.apache.uima.jcas.JCas;
+
+public class ConceptTaggingProcessor implements AlchemyOutputProcessor {
+
+ public void process(JCas cas, Results results) throws Exception {
+ ConceptResults conceptResults = (ConceptResults) results;
+ if (conceptResults.getConcepts() != null) {
+ List<Concept> concepts = conceptResults.getConcepts().getConcepts();
+ for (Concept concept : concepts) {
+ ConceptFS conceptFS = new ConceptFS(cas);
+ Type type = conceptFS.getType();
+ conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("text"), concept.getText());
+ conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("relevance"), concept
+ .getRelevance());
+ conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("website"), concept
+ .getWebsite());
+ conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("geo"), concept.getGeo());
+ conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("dbpedia"), concept
+ .getDbpedia());
+ conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("yago"), concept.getYago());
+ conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("opencyc"), concept
+ .getOpencyc());
+ conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("ciaFactbook"), concept
+ .getCiaFactbook());
+ conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("geonames"), concept
+ .getGeonames());
+ conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("crunchbase"), concept
+ .getCrunchbase());
+ conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("semanticCrunchbase"),
+ concept.getSemanticCrunchbase());
+ conceptFS.setFeatureValueFromString(type.getFeatureByBaseName("musicBrainz"), concept
+ .getMusicBrainz());
+ conceptFS.addToIndexes();
+ }
+ }
+ }
+
+}
Added: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/KeywordProcessor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/KeywordProcessor.java?rev=992621&view=auto
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/KeywordProcessor.java (added)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/KeywordProcessor.java Sat Sep 4 15:05:01 2010
@@ -0,0 +1,44 @@
+/**
+ * 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.uima.alchemy.mapper.processor;
+
+import org.apache.uima.alchemy.digester.domain.Keyword;
+import org.apache.uima.alchemy.digester.domain.KeywordResults;
+import org.apache.uima.alchemy.digester.domain.Results;
+import org.apache.uima.alchemy.mapper.exception.MappingException;
+import org.apache.uima.alchemy.ts.keywords.KeywordFS;
+import org.apache.uima.cas.Type;
+import org.apache.uima.jcas.JCas;
+
+public class KeywordProcessor implements AlchemyOutputProcessor {
+
+ public void process(JCas cas, Results results) throws Exception {
+ for (Keyword k : ((KeywordResults) results).getKeywords()) {
+ try {
+ KeywordFS fs = new KeywordFS(cas);
+ Type type = fs.getType();
+ fs.setFeatureValueFromString(type.getFeatureByBaseName("text"), k.getText()); // text
+ fs.addToIndexes();
+ } catch (Exception e) {
+ throw new MappingException(e);
+ }
+ }
+ }
+
+}
Added: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/LanguageProcessor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/LanguageProcessor.java?rev=992621&view=auto
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/LanguageProcessor.java (added)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/LanguageProcessor.java Sat Sep 4 15:05:01 2010
@@ -0,0 +1,50 @@
+/**
+ * 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.uima.alchemy.mapper.processor;
+
+import org.apache.uima.alchemy.digester.domain.LanguageDetectionResults;
+import org.apache.uima.alchemy.digester.domain.Results;
+import org.apache.uima.alchemy.ts.language.LanguageFS;
+import org.apache.uima.cas.Type;
+import org.apache.uima.jcas.JCas;
+
+public class LanguageProcessor implements AlchemyOutputProcessor {
+
+ public void process(JCas cas, Results results) throws Exception {
+ LanguageFS languageFS = new LanguageFS(cas);
+ Type type = languageFS.getType();
+ LanguageDetectionResults languageDetectionResults = (LanguageDetectionResults) results;
+ languageFS.setFeatureValueFromString(type.getFeatureByBaseName("language"),
+ languageDetectionResults.getLanguage());
+ languageFS.setFeatureValueFromString(type.getFeatureByBaseName("iso6391"),
+ languageDetectionResults.getIso6391());
+ languageFS.setFeatureValueFromString(type.getFeatureByBaseName("iso6392"),
+ languageDetectionResults.getIso6392());
+ languageFS.setFeatureValueFromString(type.getFeatureByBaseName("iso6393"),
+ languageDetectionResults.getIso6393());
+ languageFS.setFeatureValueFromString(type.getFeatureByBaseName("ethnologue"),
+ languageDetectionResults.getEthnologue());
+ languageFS.setFeatureValueFromString(type.getFeatureByBaseName("nativeSpeakers"),
+ languageDetectionResults.getNativeSpeakers());
+ languageFS.setFeatureValueFromString(type.getFeatureByBaseName("wikipedia"),
+ languageDetectionResults.getWikipedia());
+ languageFS.addToIndexes();
+ }
+
+}
Added: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/MicroformatsProcessor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/MicroformatsProcessor.java?rev=992621&view=auto
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/MicroformatsProcessor.java (added)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/MicroformatsProcessor.java Sat Sep 4 15:05:01 2010
@@ -0,0 +1,42 @@
+/**
+ * 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.uima.alchemy.mapper.processor;
+
+import org.apache.uima.alchemy.digester.domain.Microformat;
+import org.apache.uima.alchemy.digester.domain.MicroformatsResults;
+import org.apache.uima.alchemy.digester.domain.Results;
+import org.apache.uima.alchemy.ts.microformats.MicroformatFS;
+import org.apache.uima.cas.Type;
+import org.apache.uima.jcas.JCas;
+
+public class MicroformatsProcessor implements AlchemyOutputProcessor {
+
+ public void process(JCas cas, Results results) throws Exception {
+ for (Microformat microformat : ((MicroformatsResults) results).getMicroformats()) {
+ MicroformatFS microformatFS = new MicroformatFS(cas);
+ Type type = microformatFS.getType();
+ microformatFS.setFeatureValueFromString(type.getFeatureByBaseName("fieldName"), microformat
+ .getFieldName());
+ microformatFS.setFeatureValueFromString(type.getFeatureByBaseName("fieldData"), microformat
+ .getFieldData());
+ microformatFS.addToIndexes();
+ }
+ }
+
+}
Added: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/RankedEntitiesProcessor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/RankedEntitiesProcessor.java?rev=992621&view=auto
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/RankedEntitiesProcessor.java (added)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/RankedEntitiesProcessor.java Sat Sep 4 15:05:01 2010
@@ -0,0 +1,125 @@
+/**
+ * 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.uima.alchemy.mapper.processor;
+
+import org.apache.uima.alchemy.digester.domain.EntitiesResults;
+import org.apache.uima.alchemy.digester.domain.Entity;
+import org.apache.uima.alchemy.digester.domain.Results;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.cas.StringArray;
+
+public class RankedEntitiesProcessor implements AlchemyOutputProcessor {
+
+ private static final String ENTITY_PACKAGE_NAME = "org.apache.uima.alchemy.ts.entity.";
+
+ public void process(JCas cas, Results results) throws Exception {
+
+ for (Entity entity : ((EntitiesResults) results).getEntities().getEntities()) {
+
+ FeatureStructure fs = null;
+ // get feature structure for the entity
+ fs = getFeatureStructure(entity.getType(), cas);
+
+ if (fs != null) {
+
+ Type type = fs.getType();
+
+ /* set each FS feature value */
+ fs.setFeatureValueFromString(type.getFeatureByBaseName("count"), entity.getCount()); // count
+ fs.setFeatureValueFromString(type.getFeatureByBaseName("text"), entity.getText()); // text
+ fs.setFeatureValueFromString(type.getFeatureByBaseName("relevance"), entity.getRelevance()); // relevance
+ if (entity.getDisambiguated() != null) {
+ fs.setFeatureValueFromString(type.getFeatureByBaseName("disambiguation"), entity
+ .getDisambiguated().getName()); // disambiguation name
+ fs.setFeatureValueFromString(type.getFeatureByBaseName("dbpedia"), entity
+ .getDisambiguated().getDbpedia()); // dbpedia
+ fs.setFeatureValueFromString(type.getFeatureByBaseName("website"), entity
+ .getDisambiguated().getWebsite()); // website
+ fs.setFeatureValueFromString(type.getFeatureByBaseName("subType"), entity
+ .getDisambiguated().getSubType()); // subtype
+ fs.setFeatureValueFromString(type.getFeatureByBaseName("geo"), entity.getDisambiguated()
+ .getGeo()); // geo
+ fs.setFeatureValueFromString(type.getFeatureByBaseName("opencyc"), entity
+ .getDisambiguated().getOpencyc()); // opencyc
+ fs.setFeatureValueFromString(type.getFeatureByBaseName("yago"), entity.getDisambiguated()
+ .getYago()); // yago
+ fs.setFeatureValueFromString(type.getFeatureByBaseName("umbel"), entity
+ .getDisambiguated().getUmbel()); // umbel
+ fs.setFeatureValueFromString(type.getFeatureByBaseName("freebase"), entity
+ .getDisambiguated().getFreebase()); // freebase
+ fs.setFeatureValueFromString(type.getFeatureByBaseName("ciaFactbook"), entity
+ .getDisambiguated().getCiaFactbook()); // ciaFactbook
+ fs.setFeatureValueFromString(type.getFeatureByBaseName("census"), entity
+ .getDisambiguated().getCensus()); // census
+ fs.setFeatureValueFromString(type.getFeatureByBaseName("geonames"), entity
+ .getDisambiguated().getGeonames()); // geonames
+ fs.setFeatureValueFromString(type.getFeatureByBaseName("musicBrainz"), entity
+ .getDisambiguated().getMusicBrainz()); // musicBrainz
+ }
+ if (entity.getQuotations() != null && entity.getQuotations().getQuotations() != null
+ && entity.getQuotations().getQuotations().size() > 0) {
+ StringArray quotationsFeatureStructure = new StringArray(cas, entity.getQuotations()
+ .getQuotations().size());
+ int i = 0;
+ for (String quotation : entity.getQuotations().getQuotations()) {
+ quotationsFeatureStructure.set(i, quotation);
+ i++;
+ }
+ fs.setFeatureValue(type.getFeatureByBaseName("quotations"), quotationsFeatureStructure);
+ }
+ cas.addFsToIndexes(fs);
+ }
+ }
+ }
+
+ private static FeatureStructure getFeatureStructure(String type, JCas aJCas) {
+ FeatureStructure fsObject = null;
+ String typeName = new StringBuilder(ENTITY_PACKAGE_NAME).append(type).toString();
+ Class<?> typeClass = getClassFromName(typeName);
+ if (typeClass != null) {
+ try {
+ /* usually jcas gen creates the constructor with jcas argument as the second one */
+ fsObject = (FeatureStructure) typeClass.getConstructors()[1].newInstance(aJCas);
+ } catch (Exception e) {
+ /* for exceptional cases in which jcas parameter constructor is the first */
+ try {
+ fsObject = (FeatureStructure) typeClass.getConstructors()[0].newInstance(aJCas);
+ } catch (Exception inner) {
+ /* could not instantiate a FS via reflection */
+ inner.printStackTrace();
+ }
+ }
+ }
+ return fsObject;
+ }
+
+ private static Class<?> getClassFromName(String typeName) {
+ Class<?> toReturn = null;
+ try {
+ toReturn = Class.forName(typeName);
+ } catch (ClassNotFoundException cnfe) {
+ // do nothing
+ }
+
+ return toReturn;
+ }
+
+}
Modified: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/entity/AlchemyAnnotation.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/entity/AlchemyAnnotation.java?rev=992621&r1=992620&r2=992621&view=diff
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/entity/AlchemyAnnotation.java (original)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/entity/AlchemyAnnotation.java Sat Sep 4 15:05:01 2010
@@ -23,7 +23,6 @@ package org.apache.uima.alchemy.ts.entit
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.jcas.cas.TOP_Type;
-
import org.apache.uima.jcas.tcas.Annotation;
/**
Modified: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/entity/AlchemyAnnotation_Type.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/entity/AlchemyAnnotation_Type.java?rev=992621&r1=992620&r2=992621&view=diff
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/entity/AlchemyAnnotation_Type.java (original)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/entity/AlchemyAnnotation_Type.java Sat Sep 4 15:05:01 2010
@@ -20,15 +20,15 @@
/* First created by JCasGen Sat Jan 09 18:51:20 CET 2010 */
package org.apache.uima.alchemy.ts.entity;
-import org.apache.uima.jcas.JCas;
-import org.apache.uima.jcas.JCasRegistry;
-import org.apache.uima.cas.impl.CASImpl;
-import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.Feature;
import org.apache.uima.cas.FeatureStructure;
-import org.apache.uima.cas.impl.TypeImpl;
import org.apache.uima.cas.Type;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
import org.apache.uima.cas.impl.FeatureImpl;
-import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.jcas.tcas.Annotation_Type;
/**
Modified: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/entity/Anniversary.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/entity/Anniversary.java?rev=992621&r1=992620&r2=992621&view=diff
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/entity/Anniversary.java (original)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/entity/Anniversary.java Sat Sep 4 15:05:01 2010
@@ -21,16 +21,13 @@ package org.apache.uima.alchemy.ts.entit
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.JCasRegistry;
-import org.apache.uima.jcas.cas.StringArray;
-import org.apache.uima.jcas.cas.TOP;
import org.apache.uima.jcas.cas.TOP_Type;
-/**
- * Updated by JCasGen Sun Nov 15 23:15:39 CET 2009 XML source:
- *
- * @generated
- */
-public class Anniversary extends TOP {
+/**
+ * Updated by JCasGen Sat Sep 04 11:45:18 CEST 2010
+ * XML source: /Users/tommaso/Documents/workspaces/uima_ws/sandbox/AlchemyAPIAnnotator/desc/TextRankedEntityExtractionAEDescriptor.xml
+ * @generated */
+public class Anniversary extends BaseEntity {
/**
* @generated
* @ordered
@@ -44,18 +41,15 @@ public class Anniversary extends TOP {
public final static int type = typeIndexID;
/** @generated */
- public int getTypeIndexID() {
- return typeIndexID;
- }
-
+ public int getTypeIndexID() {return typeIndexID;}
+
/**
* Never called. Disable default constructor
*
* @generated
*/
- protected Anniversary() {
- }
-
+ protected Anniversary() {}
+
/**
* Internal - constructor used by generator
*
@@ -65,493 +59,16 @@ public class Anniversary extends TOP {
super(addr, type);
readObject();
}
-
+
/** @generated */
public Anniversary(JCas jcas) {
super(jcas);
- readObject();
- }
+ readObject();
+ }
- /**
- * <!-- begin-user-doc --> Write your own initialization here <!-- end-user-doc -->
- *
- * @generated modifiable
- */
+ /** <!-- begin-user-doc --> Write your own initialization here <!-- end-user-doc -->
+ @generated modifiable */
private void readObject() {
}
- // *--------------*
- // * Feature: text
-
- /**
- * getter for text - gets
- *
- * @generated
- */
- public String getText() {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_text == null)
- jcasType.jcas.throwFeatMissing("text", "org.apache.uima.alchemy.ts.entity.Anniversary");
- return jcasType.ll_cas.ll_getStringValue(addr, ((Anniversary_Type) jcasType).casFeatCode_text);
- }
-
- /**
- * setter for text - sets
- *
- * @generated
- */
- public void setText(String v) {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_text == null)
- jcasType.jcas.throwFeatMissing("text", "org.apache.uima.alchemy.ts.entity.Anniversary");
- jcasType.ll_cas.ll_setStringValue(addr, ((Anniversary_Type) jcasType).casFeatCode_text, v);
- }
-
- // *--------------*
- // * Feature: count
-
- /**
- * getter for count - gets
- *
- * @generated
- */
- public String getCount() {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_count == null)
- jcasType.jcas.throwFeatMissing("count", "org.apache.uima.alchemy.ts.entity.Anniversary");
- return jcasType.ll_cas.ll_getStringValue(addr, ((Anniversary_Type) jcasType).casFeatCode_count);
- }
-
- /**
- * setter for count - sets
- *
- * @generated
- */
- public void setCount(String v) {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_count == null)
- jcasType.jcas.throwFeatMissing("count", "org.apache.uima.alchemy.ts.entity.Anniversary");
- jcasType.ll_cas.ll_setStringValue(addr, ((Anniversary_Type) jcasType).casFeatCode_count, v);
- }
-
- // *--------------*
- // * Feature: relevance
-
- /**
- * getter for relevance - gets
- *
- * @generated
- */
- public String getRelevance() {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_relevance == null)
- jcasType.jcas.throwFeatMissing("relevance", "org.apache.uima.alchemy.ts.entity.Anniversary");
- return jcasType.ll_cas.ll_getStringValue(addr,
- ((Anniversary_Type) jcasType).casFeatCode_relevance);
- }
-
- /**
- * setter for relevance - sets
- *
- * @generated
- */
- public void setRelevance(String v) {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_relevance == null)
- jcasType.jcas.throwFeatMissing("relevance", "org.apache.uima.alchemy.ts.entity.Anniversary");
- jcasType.ll_cas.ll_setStringValue(addr, ((Anniversary_Type) jcasType).casFeatCode_relevance, v);
- }
-
- // *--------------*
- // * Feature: disambiguation
-
- /**
- * getter for disambiguation - gets
- *
- * @generated
- */
- public String getDisambiguation() {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_disambiguation == null)
- jcasType.jcas.throwFeatMissing("disambiguation",
- "org.apache.uima.alchemy.ts.entity.Anniversary");
- return jcasType.ll_cas.ll_getStringValue(addr,
- ((Anniversary_Type) jcasType).casFeatCode_disambiguation);
- }
-
- /**
- * setter for disambiguation - sets
- *
- * @generated
- */
- public void setDisambiguation(String v) {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_disambiguation == null)
- jcasType.jcas.throwFeatMissing("disambiguation",
- "org.apache.uima.alchemy.ts.entity.Anniversary");
- jcasType.ll_cas.ll_setStringValue(addr,
- ((Anniversary_Type) jcasType).casFeatCode_disambiguation, v);
- }
-
- // *--------------*
- // * Feature: subType
-
- /**
- * getter for subType - gets
- *
- * @generated
- */
- public String getSubType() {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_subType == null)
- jcasType.jcas.throwFeatMissing("subType", "org.apache.uima.alchemy.ts.entity.Anniversary");
- return jcasType.ll_cas.ll_getStringValue(addr,
- ((Anniversary_Type) jcasType).casFeatCode_subType);
- }
-
- /**
- * setter for subType - sets
- *
- * @generated
- */
- public void setSubType(String v) {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_subType == null)
- jcasType.jcas.throwFeatMissing("subType", "org.apache.uima.alchemy.ts.entity.Anniversary");
- jcasType.ll_cas.ll_setStringValue(addr, ((Anniversary_Type) jcasType).casFeatCode_subType, v);
- }
-
- // *--------------*
- // * Feature: website
-
- /**
- * getter for website - gets
- *
- * @generated
- */
- public String getWebsite() {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_website == null)
- jcasType.jcas.throwFeatMissing("website", "org.apache.uima.alchemy.ts.entity.Anniversary");
- return jcasType.ll_cas.ll_getStringValue(addr,
- ((Anniversary_Type) jcasType).casFeatCode_website);
- }
-
- /**
- * setter for website - sets
- *
- * @generated
- */
- public void setWebsite(String v) {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_website == null)
- jcasType.jcas.throwFeatMissing("website", "org.apache.uima.alchemy.ts.entity.Anniversary");
- jcasType.ll_cas.ll_setStringValue(addr, ((Anniversary_Type) jcasType).casFeatCode_website, v);
- }
-
- // *--------------*
- // * Feature: geo
-
- /**
- * getter for geo - gets
- *
- * @generated
- */
- public String getGeo() {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_geo == null)
- jcasType.jcas.throwFeatMissing("geo", "org.apache.uima.alchemy.ts.entity.Anniversary");
- return jcasType.ll_cas.ll_getStringValue(addr, ((Anniversary_Type) jcasType).casFeatCode_geo);
- }
-
- /**
- * setter for geo - sets
- *
- * @generated
- */
- public void setGeo(String v) {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_geo == null)
- jcasType.jcas.throwFeatMissing("geo", "org.apache.uima.alchemy.ts.entity.Anniversary");
- jcasType.ll_cas.ll_setStringValue(addr, ((Anniversary_Type) jcasType).casFeatCode_geo, v);
- }
-
- // *--------------*
- // * Feature: dbpedia
-
- /**
- * getter for dbpedia - gets
- *
- * @generated
- */
- public String getDbpedia() {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_dbpedia == null)
- jcasType.jcas.throwFeatMissing("dbpedia", "org.apache.uima.alchemy.ts.entity.Anniversary");
- return jcasType.ll_cas.ll_getStringValue(addr,
- ((Anniversary_Type) jcasType).casFeatCode_dbpedia);
- }
-
- /**
- * setter for dbpedia - sets
- *
- * @generated
- */
- public void setDbpedia(String v) {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_dbpedia == null)
- jcasType.jcas.throwFeatMissing("dbpedia", "org.apache.uima.alchemy.ts.entity.Anniversary");
- jcasType.ll_cas.ll_setStringValue(addr, ((Anniversary_Type) jcasType).casFeatCode_dbpedia, v);
- }
-
- // *--------------*
- // * Feature: yago
-
- /**
- * getter for yago - gets
- *
- * @generated
- */
- public String getYago() {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_yago == null)
- jcasType.jcas.throwFeatMissing("yago", "org.apache.uima.alchemy.ts.entity.Anniversary");
- return jcasType.ll_cas.ll_getStringValue(addr, ((Anniversary_Type) jcasType).casFeatCode_yago);
- }
-
- /**
- * setter for yago - sets
- *
- * @generated
- */
- public void setYago(String v) {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_yago == null)
- jcasType.jcas.throwFeatMissing("yago", "org.apache.uima.alchemy.ts.entity.Anniversary");
- jcasType.ll_cas.ll_setStringValue(addr, ((Anniversary_Type) jcasType).casFeatCode_yago, v);
- }
-
- // *--------------*
- // * Feature: opencyc
-
- /**
- * getter for opencyc - gets
- *
- * @generated
- */
- public String getOpencyc() {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_opencyc == null)
- jcasType.jcas.throwFeatMissing("opencyc", "org.apache.uima.alchemy.ts.entity.Anniversary");
- return jcasType.ll_cas.ll_getStringValue(addr,
- ((Anniversary_Type) jcasType).casFeatCode_opencyc);
- }
-
- /**
- * setter for opencyc - sets
- *
- * @generated
- */
- public void setOpencyc(String v) {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_opencyc == null)
- jcasType.jcas.throwFeatMissing("opencyc", "org.apache.uima.alchemy.ts.entity.Anniversary");
- jcasType.ll_cas.ll_setStringValue(addr, ((Anniversary_Type) jcasType).casFeatCode_opencyc, v);
- }
-
- // *--------------*
- // * Feature: umbel
-
- /**
- * getter for umbel - gets
- *
- * @generated
- */
- public String getUmbel() {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_umbel == null)
- jcasType.jcas.throwFeatMissing("umbel", "org.apache.uima.alchemy.ts.entity.Anniversary");
- return jcasType.ll_cas.ll_getStringValue(addr, ((Anniversary_Type) jcasType).casFeatCode_umbel);
- }
-
- /**
- * setter for umbel - sets
- *
- * @generated
- */
- public void setUmbel(String v) {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_umbel == null)
- jcasType.jcas.throwFeatMissing("umbel", "org.apache.uima.alchemy.ts.entity.Anniversary");
- jcasType.ll_cas.ll_setStringValue(addr, ((Anniversary_Type) jcasType).casFeatCode_umbel, v);
- }
-
- // *--------------*
- // * Feature: freebase
-
- /**
- * getter for freebase - gets
- *
- * @generated
- */
- public String getFreebase() {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_freebase == null)
- jcasType.jcas.throwFeatMissing("freebase", "org.apache.uima.alchemy.ts.entity.Anniversary");
- return jcasType.ll_cas.ll_getStringValue(addr,
- ((Anniversary_Type) jcasType).casFeatCode_freebase);
- }
-
- /**
- * setter for freebase - sets
- *
- * @generated
- */
- public void setFreebase(String v) {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_freebase == null)
- jcasType.jcas.throwFeatMissing("freebase", "org.apache.uima.alchemy.ts.entity.Anniversary");
- jcasType.ll_cas.ll_setStringValue(addr, ((Anniversary_Type) jcasType).casFeatCode_freebase, v);
- }
-
- // *--------------*
- // * Feature: ciaFactbook
-
- /**
- * getter for ciaFactbook - gets
- *
- * @generated
- */
- public String getCiaFactbook() {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_ciaFactbook == null)
- jcasType.jcas
- .throwFeatMissing("ciaFactbook", "org.apache.uima.alchemy.ts.entity.Anniversary");
- return jcasType.ll_cas.ll_getStringValue(addr,
- ((Anniversary_Type) jcasType).casFeatCode_ciaFactbook);
- }
-
- /**
- * setter for ciaFactbook - sets
- *
- * @generated
- */
- public void setCiaFactbook(String v) {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_ciaFactbook == null)
- jcasType.jcas
- .throwFeatMissing("ciaFactbook", "org.apache.uima.alchemy.ts.entity.Anniversary");
- jcasType.ll_cas.ll_setStringValue(addr, ((Anniversary_Type) jcasType).casFeatCode_ciaFactbook,
- v);
- }
-
- // *--------------*
- // * Feature: census
-
- /**
- * getter for census - gets
- *
- * @generated
- */
- public String getCensus() {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_census == null)
- jcasType.jcas.throwFeatMissing("census", "org.apache.uima.alchemy.ts.entity.Anniversary");
- return jcasType.ll_cas
- .ll_getStringValue(addr, ((Anniversary_Type) jcasType).casFeatCode_census);
- }
-
- /**
- * setter for census - sets
- *
- * @generated
- */
- public void setCensus(String v) {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_census == null)
- jcasType.jcas.throwFeatMissing("census", "org.apache.uima.alchemy.ts.entity.Anniversary");
- jcasType.ll_cas.ll_setStringValue(addr, ((Anniversary_Type) jcasType).casFeatCode_census, v);
- }
-
- // *--------------*
- // * Feature: geonames
-
- /**
- * getter for geonames - gets
- *
- * @generated
- */
- public String getGeonames() {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_geonames == null)
- jcasType.jcas.throwFeatMissing("geonames", "org.apache.uima.alchemy.ts.entity.Anniversary");
- return jcasType.ll_cas.ll_getStringValue(addr,
- ((Anniversary_Type) jcasType).casFeatCode_geonames);
- }
-
- /**
- * setter for geonames - sets
- *
- * @generated
- */
- public void setGeonames(String v) {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_geonames == null)
- jcasType.jcas.throwFeatMissing("geonames", "org.apache.uima.alchemy.ts.entity.Anniversary");
- jcasType.ll_cas.ll_setStringValue(addr, ((Anniversary_Type) jcasType).casFeatCode_geonames, v);
- }
-
- // *--------------*
- // * Feature: musicBrainz
-
- /**
- * getter for musicBrainz - gets
- *
- * @generated
- */
- public String getMusicBrainz() {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_musicBrainz == null)
- jcasType.jcas
- .throwFeatMissing("musicBrainz", "org.apache.uima.alchemy.ts.entity.Anniversary");
- return jcasType.ll_cas.ll_getStringValue(addr,
- ((Anniversary_Type) jcasType).casFeatCode_musicBrainz);
- }
-
- /**
- * setter for musicBrainz - sets
- *
- * @generated
- */
- public void setMusicBrainz(String v) {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_musicBrainz == null)
- jcasType.jcas
- .throwFeatMissing("musicBrainz", "org.apache.uima.alchemy.ts.entity.Anniversary");
- jcasType.ll_cas.ll_setStringValue(addr, ((Anniversary_Type) jcasType).casFeatCode_musicBrainz,
- v);
- }
-
- // *--------------*
- // * Feature: quotations
-
- /**
- * getter for quotations - gets
- *
- * @generated
- */
- public StringArray getQuotations() {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_quotations == null)
- jcasType.jcas.throwFeatMissing("quotations", "org.apache.uima.alchemy.ts.entity.Anniversary");
- return (StringArray) (jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr,
- ((Anniversary_Type) jcasType).casFeatCode_quotations)));
- }
-
- /**
- * setter for quotations - sets
- *
- * @generated
- */
- public void setQuotations(StringArray v) {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_quotations == null)
- jcasType.jcas.throwFeatMissing("quotations", "org.apache.uima.alchemy.ts.entity.Anniversary");
- jcasType.ll_cas.ll_setRefValue(addr, ((Anniversary_Type) jcasType).casFeatCode_quotations,
- jcasType.ll_cas.ll_getFSRef(v));
- }
-
- /**
- * indexed getter for quotations - gets an indexed value -
- *
- * @generated
- */
- public String getQuotations(int i) {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_quotations == null)
- jcasType.jcas.throwFeatMissing("quotations", "org.apache.uima.alchemy.ts.entity.Anniversary");
- jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr,
- ((Anniversary_Type) jcasType).casFeatCode_quotations), i);
- return jcasType.ll_cas.ll_getStringArrayValue(jcasType.ll_cas.ll_getRefValue(addr,
- ((Anniversary_Type) jcasType).casFeatCode_quotations), i);
- }
-
- /**
- * indexed setter for quotations - sets an indexed value -
- *
- * @generated
- */
- public void setQuotations(int i, String v) {
- if (Anniversary_Type.featOkTst && ((Anniversary_Type) jcasType).casFeat_quotations == null)
- jcasType.jcas.throwFeatMissing("quotations", "org.apache.uima.alchemy.ts.entity.Anniversary");
- jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr,
- ((Anniversary_Type) jcasType).casFeatCode_quotations), i);
- jcasType.ll_cas.ll_setStringArrayValue(jcasType.ll_cas.ll_getRefValue(addr,
- ((Anniversary_Type) jcasType).casFeatCode_quotations), i, v);
- }
}