4

I'm using Ruta annotation framework for annotating the input text previously I was using Ruta script from classpath. But according to client requirement we have to move out Ruta script outside the code all this need to be decouple from the system. I'm available to achieve all this. What i'm doing is while system start i'm reading all engine & scripts resource & caching into goggle gauvas cache, every thing is working fine.The only issue is sometime while running the batches(concurrent processes)Ruta framework throw exception.

See below stack trace.

Caused by: java.lang.IllegalArgumentException: Document is ambiguous, use one of the following instead : org.apache.uima.ruta.type.Document uima.tcas.DocumentAnnotation at org.apache.uima.ruta.RutaEnvironment.getType(RutaEnvironment.java:367) at org.apache.uima.ruta.RutaEnvironment.getType(RutaEnvironment.java:376) at org.apache.uima.ruta.RutaEnvironment.getType(RutaEnvironment.java:376) at org.apache.uima.ruta.expression.type.SimpleTypeExpression.getType(SimpleTypeExpression.java:45) at org.apache.uima.ruta.rule.RutaTypeMatcher.getType(RutaTypeMatcher.java:247) at org.apache.uima.ruta.rule.RutaTypeMatcher.getTypes(RutaTypeMatcher.java:262) at org.apache.uima.ruta.rule.RutaTypeMatcher.getMatchingAnnotations(RutaTypeMatcher.java:58) at org.apache.uima.ruta.rule.RutaRuleElement.getAnchors(RutaRuleElement.java:52) at org.apache.uima.ruta.rule.RutaRuleElement.startMatch(RutaRuleElement.java:59) 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.RutaScriptBlock.apply(RutaScriptBlock.java:63) at org.apache.uima.ruta.action.CallAction.callScript(CallAction.java:96) at org.apache.uima.ruta.action.CallAction.execute(CallAction.java:78) 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:554) at org.apache.uima.ruta.rule.AbstractRuleElement.doneMatching(AbstractRuleElement.java:84) at org.apache.uima.ruta.rule.ComposedRuleElement.fallback(ComposedRuleElement.java:475) at org.apache.uima.ruta.rule.ComposedRuleElement.fallbackContinue(ComposedRuleElement.java:384) at org.apache.uima.ruta.rule.RutaRuleElement.startMatch(RutaRuleElement.java:100) 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:477) ... 22 more

PS: I face this issue when i run batches not for single instance;

Gaurav
  • 139
  • 1
  • 16
  • I asume that you use ruta < 2.5.0? Document was removed in 2.5.0. However, this problem should not occur anyway. You can upgrade to 2.5.0, but please mind that there is a bug concerning the datapath in 2.5.0. As a hotfix you could also replace Document by DocumentAnnotation in your scripts. – Peter Kluegl Nov 24 '16 at 07:50
  • @PeterKluegl I'm using 2.2.0 according to you Document is removed in 2.5.0 So i don't think it is will create problem. – Gaurav Nov 24 '16 at 08:03
  • Yes and no. The problem is that there is a clash of short names. The exception occurs because the Type is there. DocumentAnnotation has an alias to Document. As a result, the script cannot resolve the Type of the given string "Document" – Peter Kluegl Nov 24 '16 at 08:06
  • Can you check the dependencies, if there are some additional libs that include a differenent version? – Peter Kluegl Dec 04 '16 at 14:18
  • The changes you suggested are working fine now I'll check additional lib dependency – Gaurav Dec 06 '16 at 07:14

1 Answers1

0

I have the same problem with the predefined types like NUM, SPECIAL, etc. I integrated the bibtex-examples from ruta in my pipeline and tried to call a rutaEngine like in the answer 1 (just the Year script). I also use DKPro core.opennlp.OpenNlpSegmenter. When runnning the script I get a similar error like in the original question:

Caused by: java.lang.IllegalArgumentException: NUM is ambiguous, use one of 
the following instead : de.tudarmstadt.ukp.dkpro.core.api.syntax.type.dependency.NUM 
org.apache.uima.ruta.type.NUM 
at org.apache.uima.ruta.RutaEnvironment.getType(RutaEnvironment.java:459)

An additional problem is that I cannot declare own "temorary" types (e.g. "Marker") in statements like "aaa" -> Marker. The error reads "Not able to resolve type: Marker It works well inside the RUTA project, but not outside in my "real" project.