[
https://issues.apache.org/jira/browse/UIMA-3368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13804185#comment-13804185
]
Peter Klügl commented on UIMA-3368:
-----------------------------------
Ah sorry, I haven't read your description carefully enough (I still had the
exception you mailed me in my mind). This is a simple problem: The
Typesystem.xml UIMA-AS is using does not contain the ruta types. Most of them
are optional, for explanation, seeding and so on. But there are at least two
the ruta engine actually needs all the time: RutaBasic and RutaFrame (I think).
Try to import the BasicTypeSystem.xml in your Typesystem.xml. I was able to run
the annotator with runRemoteAsyncAE locally.
> Ruta and UIMA-AS
> ----------------
>
> Key: UIMA-3368
> URL: https://issues.apache.org/jira/browse/UIMA-3368
> Project: UIMA
> Issue Type: Bug
> Components: Async Scaleout, ruta
> Affects Versions: 2.4.0AS, 2.1.0ruta
> Reporter: Prokopis Prokopidis
> Priority: Minor
> Attachments: SimpleAnnotator.zip
>
>
> Hi,
> I get errors when applying Ruta rules from an Annotator deployed as a UIMA-AS
> service. Here's my situation.
> I have a SimpleAnnotator class that assigns tags to Tokens. So, when I have a
> test.txt in my input with this content:
> $ more test.txt
> A room .
> ... I get, among other things, the following output
> {code:xml}<examples:Token xmi:id="21" sofa="1" begin="1" end="2" pos="aTag"/>
> <examples:Token xmi:id="26" sofa="1" begin="3" end="7" pos="anotherTag"/>
> {code}
> To get the tags, I use java code as in the attached SimpleAnnotator.java and
> ruta rules.
> All's fine when I run this a standard UIMA pipeline. But, if I deploy the
> annotator in UIMA-AS and I send the same text to the queue created, I get
> NullPointerException's similar to those:
> Caused by: java.lang.NullPointerException
> at
> org.apache.uima.cas.impl.FSIndexRepositoryImpl.getIndex(FSIndexRepositoryImpl.java:1334)
> at
> org.apache.uima.cas.impl.CASImpl.getAnnotationIndex(CASImpl.java:3935)
> at
> org.apache.uima.ruta.RutaStream.updateIterators(RutaStream.java:131)
> at org.apache.uima.ruta.RutaStream.<init>(RutaStream.java:94)
> at org.apache.uima.ruta.RutaStream.<init>(RutaStream.java:138)
> at
> org.apache.uima.ruta.engine.RutaEngine.initializeStream(RutaEngine.java:580)
> at org.apache.uima.ruta.engine.RutaEngine.process(RutaEngine.java:440)
> at
> org.apache.uima.analysis_component.JCasAnnotator_ImplBase.process(JCasAnnotator_ImplBase.java:48)
> at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:375)
> }}
> and rules are not applied.
> I can provide an eclipse project including a typesystem and a deployment
> descriptor if needed.
> Many thanks for looking into this,
> Prokopis
> {code:java}
> package org.apache.uima.examples;
> import java.util.HashMap;
> import java.util.Map;
> import java.util.regex.Matcher;
> import java.util.regex.Pattern;
> import org.apache.uima.analysis_component.JCasAnnotator_ImplBase;
> import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
> import org.apache.uima.jcas.JCas;
> import org.apache.uima.ruta.engine.Ruta;
> import org.apache.uima.ruta.engine.RutaEngine;
> public class SimpleAnnotator extends JCasAnnotator_ImplBase {
> public void process(JCas aJCas) throws AnalysisEngineProcessException {
> String text = aJCas.getDocumentText();
> Matcher matcher = Pattern.compile("\\w+").matcher(text);
> while(matcher.find()){
> Token token = new Token(aJCas, matcher.start(), matcher.end());
> token.setPos("aTag");
> token.addToIndexes();
> }
> Map<String, Object> parameters = null;
> parameters = new HashMap<String, Object>();
> parameters.put(RutaEngine.PARAM_REMOVE_BASICS, true);
> parameters.put(RutaEngine.PARAM_SEEDERS, new String[0]);
> String rules =
> "Token{REGEXP(\"room\")-> Token.pos=\"STOP\"};
> \n"
> + "Token{REGEXP(Token.pos, \"STOP\")->
> Token.pos=\"anotherTag\"};";
> try {
> Ruta.apply(aJCas.getCas(), rules, parameters);
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.1#6144)