uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Valentin Tablan <v.tab...@gmail.com>
Subject RUTA: GATHER and optional rule elements
Date Tue, 10 Feb 2015 13:08:25 GMT
Hi,

How does GATHER interact with optional rule elements? I've not found any
explicit statements about this in the docs, and I would prefer getting an
authorised opinion.


The following RUTA grammar:

============
DECLARE Annotation A;
DECLARE Annotation B;
DECLARE Annotation C(Annotation a, Annotation b);

W{REGEXP("A")->MARK(A)};
W{REGEXP("B")->MARK(B)};


A B?{-> GATHER(C, 1, 2, "a" = 1, "b" = 2)};
=============

Run s as expected on the input "A B C", but gets a NullPointerException on
"A X C", presumably because the 2 index is not mapped to anything.

Is there a way to handle this kind of situation; for example to create the
C annotation, with an unpopulated "b" feature?


Here's the exception trace, for reference:

=========================
SEVERE: Exception occurred
org.apache.uima.analysis_engine.AnalysisEngineProcessException: Annotator
processing failed.
at org.apache.uima.ruta.engine.RutaEngine.process(RutaEngine.java:496)
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:385)
at
org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:309)
at
org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:267)
at
org.apache.uima.ruta.ide.launching.RutaLauncher.processFile(RutaLauncher.java:168)
at
org.apache.uima.ruta.ide.launching.RutaLauncher.main(RutaLauncher.java:129)
Caused by: java.lang.NullPointerException
at java.util.ArrayList.addAll(ArrayList.java:577)
at
org.apache.uima.ruta.action.GatherAction.getMatchInfo(GatherAction.java:200)
at
org.apache.uima.ruta.action.GatherAction.gatherFeatures(GatherAction.java:126)
at org.apache.uima.ruta.action.GatherAction.execute(GatherAction.java:90)
at
org.apache.uima.ruta.rule.AbstractRuleElement.apply(AbstractRuleElement.java:130)
at
org.apache.uima.ruta.rule.RuleElementCaretaker.applyRuleElements(RuleElementCaretaker.java:111)
at
org.apache.uima.ruta.rule.ComposedRuleElement.applyRuleElements(ComposedRuleElement.java:559)
at
org.apache.uima.ruta.rule.AbstractRuleElement.doneMatching(AbstractRuleElement.java:84)
at
org.apache.uima.ruta.rule.ComposedRuleElement.fallback(ComposedRuleElement.java:480)
at
org.apache.uima.ruta.rule.ComposedRuleElement.fallbackContinue(ComposedRuleElement.java:384)
at
org.apache.uima.ruta.rule.RutaRuleElement.continueMatchSomewhereElse(RutaRuleElement.java:219)
at
org.apache.uima.ruta.rule.RutaRuleElement.stepbackMatch(RutaRuleElement.java:291)
at
org.apache.uima.ruta.rule.RutaRuleElement.continueMatch(RutaRuleElement.java:234)
at
org.apache.uima.ruta.rule.RutaRuleElement.startMatch(RutaRuleElement.java:92)
at
org.apache.uima.ruta.rule.ComposedRuleElement.startMatch(ComposedRuleElement.java:73)
at org.apache.uima.ruta.rule.RutaRule.apply(RutaRule.java:47)
at org.apache.uima.ruta.rule.RutaRule.apply(RutaRule.java:40)
at org.apache.uima.ruta.rule.RutaRule.apply(RutaRule.java:29)
at org.apache.uima.ruta.RutaScriptBlock.apply(RutaScriptBlock.java:63)
at org.apache.uima.ruta.RutaModule.apply(RutaModule.java:48)
at org.apache.uima.ruta.engine.RutaEngine.process(RutaEngine.java:494)
... 6 more

Exception in thread "main"
org.apache.uima.analysis_engine.AnalysisEngineProcessException: Annotator
processing failed.
at org.apache.uima.ruta.engine.RutaEngine.process(RutaEngine.java:496)
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:385)
at
org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:309)
at
org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:267)
at
org.apache.uima.ruta.ide.launching.RutaLauncher.processFile(RutaLauncher.java:168)
at
org.apache.uima.ruta.ide.launching.RutaLauncher.main(RutaLauncher.java:129)
Caused by: java.lang.NullPointerException
at java.util.ArrayList.addAll(ArrayList.java:577)
at
org.apache.uima.ruta.action.GatherAction.getMatchInfo(GatherAction.java:200)
at
org.apache.uima.ruta.action.GatherAction.gatherFeatures(GatherAction.java:126)
at org.apache.uima.ruta.action.GatherAction.execute(GatherAction.java:90)
at
org.apache.uima.ruta.rule.AbstractRuleElement.apply(AbstractRuleElement.java:130)
at
org.apache.uima.ruta.rule.RuleElementCaretaker.applyRuleElements(RuleElementCaretaker.java:111)
at
org.apache.uima.ruta.rule.ComposedRuleElement.applyRuleElements(ComposedRuleElement.java:559)
at
org.apache.uima.ruta.rule.AbstractRuleElement.doneMatching(AbstractRuleElement.java:84)
at
org.apache.uima.ruta.rule.ComposedRuleElement.fallback(ComposedRuleElement.java:480)
at
org.apache.uima.ruta.rule.ComposedRuleElement.fallbackContinue(ComposedRuleElement.java:384)
at
org.apache.uima.ruta.rule.RutaRuleElement.continueMatchSomewhereElse(RutaRuleElement.java:219)
at
org.apache.uima.ruta.rule.RutaRuleElement.stepbackMatch(RutaRuleElement.java:291)
at
org.apache.uima.ruta.rule.RutaRuleElement.continueMatch(RutaRuleElement.java:234)
at
org.apache.uima.ruta.rule.RutaRuleElement.startMatch(RutaRuleElement.java:92)
at
org.apache.uima.ruta.rule.ComposedRuleElement.startMatch(ComposedRuleElement.java:73)
at org.apache.uima.ruta.rule.RutaRule.apply(RutaRule.java:47)
at org.apache.uima.ruta.rule.RutaRule.apply(RutaRule.java:40)
at org.apache.uima.ruta.rule.RutaRule.apply(RutaRule.java:29)
at org.apache.uima.ruta.RutaScriptBlock.apply(RutaScriptBlock.java:63)
at org.apache.uima.ruta.RutaModule.apply(RutaModule.java:48)
at org.apache.uima.ruta.engine.RutaEngine.process(RutaEngine.java:494)
... 6 more

=========================

Thanks!

Valentin

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message