Hi, then you have specified the type system lookup in META-INF/org.apache.uima.fit/types.txt?
You do not want to specify your rules in a separate file? You could then use the ruta-maven-plugin and include the generated descriptor in your classpath lookup (I assume). Without files, you need to merge the typesystem descriptor somehow with the found ones. In both cases, however, you need to take care of the type priorities. I haven't used this way yet, so I have to play around a bit in order to learn if uimaFIT automatically loads the type priotities from the ruta dependency. I will come up with a working example, but it will take some time (I am a bit busy this week). Best, Peter Am 29.06.2015 um 16:58 schrieb Min Jiang: > Hi Peter, > > Thanks very much for your great comment! > > The version we are using 2.2.1. > We use JCasFactory.createJCas (uima fit) to create CAS, could you please > share an example > on how to call the method "rutafac.createTypeSystemDescription(ruta, > descriptorInformation, options, classloader)" > > By the way, our code is underdevelopment and will be open source for academic > use only. > > Thanks. > Min > ________________________________________ > From: Peter Klügl (JIRA) <[email protected]> > Sent: Monday, June 29, 2015 5:02 AM > To: Min Jiang > Subject: [jira] [Commented] (UIMA-4480) Cannot declar new type in Java code > to apply Ruta rules > > [ > https://urldefense.proofpoint.com/v2/url?u=https-3A__issues.apache.org_jira_browse_UIMA-2D4480-3Fpage-3Dcom.atlassian.jira.plugin.system.issuetabpanels-3Acomment-2Dtabpanel-26focusedCommentId-3D14605367-23comment-2D14605367&d=BQIFaQ&c=6vgNTiRn9_pqCD9hKx9JgXN1VapJQ8JVoF8oWH1AgfQ&r=jz3QK4K87Lm_Nwht1EPnpOuO0lNxA_ixkxTg7PAIq2A&m=bvQTwuAVAZURKKCWlOG7rWaGKKP6W-qt2XsHFrGcq2g&s=QQVJIdkyei6m2zdU_GR4IYVhPVKTJL07kz3SdLRMRFA&e= > ] > > Peter Klügl commented on UIMA-4480: > ----------------------------------- > > Much depends on how you use UIMA or to be more precise, on how you create > your CAS. Do you use, for example, a uimaFIT factory method for creating the > CAS, or an analysis engine? > > If I know how you create your CAS, then I can provide a simpler code snippet > :-) > > Is you code open source? > >> Cannot declar new type in Java code to apply Ruta rules >> ------------------------------------------------------- >> >> Key: UIMA-4480 >> URL: >> https://urldefense.proofpoint.com/v2/url?u=https-3A__issues.apache.org_jira_browse_UIMA-2D4480&d=BQIFaQ&c=6vgNTiRn9_pqCD9hKx9JgXN1VapJQ8JVoF8oWH1AgfQ&r=jz3QK4K87Lm_Nwht1EPnpOuO0lNxA_ixkxTg7PAIq2A&m=bvQTwuAVAZURKKCWlOG7rWaGKKP6W-qt2XsHFrGcq2g&s=FeieLlIpo8jt5BnNVS7SJB8vzj0LYqwKV2jYDX5qmxY&e= >> Project: UIMA >> Issue Type: Bug >> Components: ruta >> Affects Versions: 2.2.1ruta >> Reporter: Min Jiang >> Assignee: Peter Klügl >> Fix For: 2.3.1ruta >> >> >> I used Java code to apply UIMA Ruta rules, but with declare statement, ruta >> cannot recognize the new created annotation type. >> Here is the code I used: >> String rutaStr2 = "DECLARE person; W{REGEXP(\"Patient\") -> MARK(person)};"; >> Ruta.apply( aJCas.getCas(), rutaStr2 ); >> The error is like: >> Jun 24, 2015 3:01:07 PM >> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl >> callAnalysisComponentProcess(417) >> 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.engine.Ruta.apply(Ruta.java:75) >> at org.apache.uima.ruta.engine.Ruta.apply(Ruta.java:83) >> at >> edu.uth.clamp.nlp.attr.ast.LinearAssertion.main(LinearAssertion.java:610) >> Caused by: java.lang.IllegalArgumentException: Not able to resolve type: >> animal >> at >> org.apache.uima.ruta.expression.type.SimpleTypeExpression.getType(SimpleTypeExpression.java:47) >> at >> org.apache.uima.ruta.action.AbstractMarkAction.createAnnotation(AbstractMarkAction.java:42) >> at org.apache.uima.ruta.action.MarkAction.execute(MarkAction.java:57) >> 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.startMatch(RutaRuleElement.java:106) >> 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) >> ... 7 more >> 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.engine.Ruta.apply(Ruta.java:75) >> at org.apache.uima.ruta.engine.Ruta.apply(Ruta.java:83) >> at >> edu.uth.clamp.nlp.attr.ast.LinearAssertion.main(LinearAssertion.java:610) >> Caused by: java.lang.IllegalArgumentException: Not able to resolve type: >> animal >> at >> org.apache.uima.ruta.expression.type.SimpleTypeExpression.getType(SimpleTypeExpression.java:47) >> at >> org.apache.uima.ruta.action.AbstractMarkAction.createAnnotation(AbstractMarkAction.java:42) >> at org.apache.uima.ruta.action.MarkAction.execute(MarkAction.java:57) >> 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.startMatch(RutaRuleElement.java:106) >> 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) >> ... 7 more > > > -- > This message was sent by Atlassian JIRA > (v6.3.4#6332)
